My Rails API successfully accomplishes the baseline requirements set forth in the take-home prompt/instructions, with none of the stretch requirements attempted due to time constraints.
My Rails API will run (seed data included) via the desired steps in the take-home prompt/instructions.
- Gets a copy of the repository
- Run "bundle exec rails db:setup" (seed data is included)
- Run "bundle exec rails server"
- Run "bundle exec rails routes" to see the available routes
- Use a client to hit the endpoints found in prior step
My API was developed using TDD via Rspec & Shoulda Matchers & every API endpoint & model is fully tested & all tests are passing.
Below are the requested baseline requirements API endpoints with their routes & params need to access them as well as what to expect the data format to be from the response.
The API endpoints are broken down into 4 sections:
-Portfolios
-Sites
-Spaces
-Stats
GET /api/v1/portfolios
[
{
"id": 1,
"portfolio_name": "United States Fund",
"company_name": "ACME Inc.",
"company_size": 1000,
"country": "United States",
"created_at": "2022-10-28T20:28:20.707Z",
"updated_at": "2022-10-28T20:28:20.707Z"
},
{
"id": 2,
"portfolio_name": "Canada Fund",
"company_name": "Maple Leaf Holdings",
"company_size": 500,
"country": "Canada",
"created_at": "2022-10-28T20:28:20.715Z",
"updated_at": "2022-10-28T20:28:20.715Z"
},
{
"id": 3,
"portfolio_name": "Mexico Fund",
"company_name": "Mexico Corp.",
"company_size": 200,
"country": "Mexico",
"created_at": "2022-10-28T20:28:20.717Z",
"updated_at": "2022-10-28T20:28:20.717Z"
},
{
"id": 4,
"portfolio_name": "Brazil Fund",
"company_name": "Brazilian LLC",
"company_size": 100,
"country": "Brazil",
"created_at": "2022-10-28T20:28:20.719Z",
"updated_at": "2022-10-28T20:28:20.719Z"
},
{
"id": 5,
"portfolio_name": "Panama Fund",
"company_name": "Panama Non-Profit",
"company_size": 500,
"country": "Panama",
"created_at": "2022-10-28T20:28:20.720Z",
"updated_at": "2022-10-28T20:28:20.720Z"
}
]
You will need to know and pass in the id of the portfolio you are looking to find into the URL for a successful response.
GET /api/v1/portfolios/1
{
"id": 1,
"portfolio_name": "United States Fund",
"company_name": "ACME Inc.",
"company_size": 1000,
"country": "United States",
"created_at": "2022-10-28T20:28:20.707Z",
"updated_at": "2022-10-28T20:28:20.707Z"
}
You will need to know and pass in the id of the site you are looking to find into the URL for a successful response.
GET /api/v1/sites/1
{
"id": 1,
"site_name": "Larimer Plaza",
"site_address": "123 Main St. Denver, CO 80203",
"building_type": "office building",
"created_at": "2022-10-28T23:36:04.655Z",
"updated_at": "2022-10-28T23:36:04.655Z",
"portfolio_id": 1
}
You will need to know and pass in the id of the portfolio you are looking to find all the sites into the URL for a successful response.
GET /api/v1/sites?portfolio_id=1
[
{
"id": 1,
"site_name": "Larimer Plaza",
"site_address": "123 Main St. Denver, CO 80203",
"building_type": "office building",
"created_at": "2022-10-28T23:36:04.655Z",
"updated_at": "2022-10-28T23:36:04.655Z",
"portfolio_id": 1
},
{
"id": 2,
"site_name": "Shops at Fashion Valley",
"site_address": "7007 Friars Rd. San Diego, CA 92108",
"building_type": "mall",
"created_at": "2022-10-28T23:36:04.657Z",
"updated_at": "2022-10-28T23:36:04.657Z",
"portfolio_id": 1
},
{
"id": 3,
"site_name": "Mission Valley Outlets",
"site_address": "2640 Camino Del Rio San Diego, CA 92108",
"building_type": "outlet mall",
"created_at": "2022-10-28T23:36:04.659Z",
"updated_at": "2022-10-28T23:36:04.659Z",
"portfolio_id": 1
}
]
You will need to know and pass in the id of the space you are looking to find into the URL for a successful response.
GET /api/v1/spaces/1
{
"id": 1,
"space_name": "Suite C",
"property_type": "commercial",
"space_size": 2000,
"monthly_price": 100000,
"created_at": "2022-10-29T02:42:25.358Z",
"updated_at": "2022-10-29T02:42:25.358Z"
}
You will need to know and pass in the id of the site you are looking to find all the spaces into the URL for a successful response.
GET /api/v1/spaces?site_id=1
[
{
"id": 1,
"space_name": "Suite A",
"property_type": "commercial",
"space_size": 4000,
"monthly_price": 400000,
"created_at": "2022-10-29T03:12:30.838Z",
"updated_at": "2022-10-29T03:12:30.838Z",
"site_id": 1
},
{
"id": 2,
"space_name": "Suite B",
"property_type": "commercial",
"space_size": 3000,
"monthly_price": 200000,
"created_at": "2022-10-29T03:12:30.841Z",
"updated_at": "2022-10-29T03:12:30.841Z",
"site_id": 1
},
{
"id": 3,
"space_name": "Suite C",
"property_type": "commercial",
"space_size": 2000,
"monthly_price": 100000,
"created_at": "2022-10-29T03:12:30.842Z",
"updated_at": "2022-10-29T03:12:30.842Z",
"site_id": 1
}
]
You will need to know and pass in the id of the site you are looking to find all the spaces square footage stats into the URL for a successful response.
GET /api/v1/stats?site_id=1
{
"site_id": 1,
"site_name": "Larimer Plaza",
"total_square_footage": 9000,
"average_suare_footage": 3000
}
You will need to know and pass in the id of the portfolio you are looking to find all the spaces square footage stats into the URL for a successful response.
GET /api/v1/stats?portfolio_id=1
{
"portfolio_id": 1,
"portfolio_name": "United States Fund",
"sites": [
"Larimer Plaza",
"Shops at Fashion Valley",
"Mission Valley Outlets"
],
"total_square_footage": 9000,
"average_suare_footage": 3000
}
===================================================================
Hi! Thanks for your interest in working at Measurabl. This take-home test will help assess your skills in building an API using Ruby on Rails and provide a good starting point for discussion in a potential follow-up interview.
Some requirements are left intentionally open-ended. Make an implementation decision and go with it. If you feel there are trade-offs worth noting, please write them in the README.md at the root of your repository.
Please spend between no fewer than 2 hours and no more than 8 hours on this take-home test; they do not need to be consecutive hours. There is a baseline requirement and two stretch requirements. The stretch requirements are optional. If you take them on, feel free to implement or make notes about a potential implementation.
The solution should be delivered privately as a git repository (not publicly on GitHub). The repo can be zipped and emailed to your contact at Measurabl. If it is too large, please provide a link using a file sharing service (i.e. Google Drive, Dropbox, etc.)
The solution should be manually testable if someone takes the following steps:
- Gets a copy of the repository
- Runs bundle exec rails db:setup (seed data should be included)
- Runs bundle exec rails server
- Runs bundle exec rails routes to see the available routes
- Uses a client to hit the endpoints found in prior step
- Any additional setup or notes should be included in the README.md
Reminder: The repository should be delivered privately.
The core customer for Measurabl is an owner or operator of commercial real estate. There are a few fundamental concepts that we have in our system to serve these customers: Portfolios, Sites, and Spaces
This is a collection of sites (aka buildings) that are owned by an entity. For example, ACME, Inc. may have a North American Fund that holds 250 buildings in the US and Canada. The concept of that holding is a Portfolio.
Often, sites are referred to as Buildings, but a site may technically contain more than one building. An example may be a mini-mall with the main strip and two standalone stores. As such, we term each entity as a Site even if most of them are a single building.
A site is divided into Spaces, even if it is only 1 space for the site. An example of a site with multiple spaces is a mixed-use building, with the following spaces:
- 2 Commercial Office Spaces
- 4 Residential Units
- 1 Common Area (e.g. foyer and stairs)
Create an API in Ruby on Rails that serves the following information:
1) Portfolios:
- A list of portfolios in the system
- Detailed information about a single portfolio
2) Sites:
- A list of sites for a given portfolio
- Detailed information about a single site
3) Spaces:
- A list of spaces for a given site
- Detailed information about a single space
- Statistics of square footage of spaces for a site (e.g. Total, Average)
- Statistics of square footage of spaces for a portfolio (e.g. Total, Average)
Add authentication to the API, so the endpoints cannot be hit without valid credentials.
Add authorization to the API, so credentials are linked to portfolios and the responses reflect that link/authorization.
Thanks! That's It! Thanks again for your interest. As a reminder, the two stretch requirements are optional. Review the Delivering Solution section for instructions on sending your work to Measurabl.