- Learning Goals
- Project Description
- Example Code
- Setup
- Data Structure
- End Points
- Suggestions for Use
- Contributors
- Expose API with integration of multiple APIs, including requiring an authentication token.
- Utilize ErrorSerializer and JSONAPI formatting.
- Impliment
cachingto speed up process when search query includes location / city & state or latitude & longitude. - Complete application based on criteria from other developers.
- Practice robust testing for poros, services, facades, and requests using mocking tool VCR.
Road Trip Planner BE is a back-end project that exposes multiple API endpoints to make data available from MapQuest API, Unspash API, Open Library API, and Weather API. It allows the front-end to obtain JSON data that contains weather forecast information for a city, where the city and state are passed in the URL body as a location param. This API also utilizes OpenLibrary API to search for books about the destination location. Additionally, there is an endpoint that retrieves a background image from Unsplash API.
- Ruby 3.2.2
- Rails 7.0.7.2
- Faraday gem to interact with APIs
- JSONAPI Serializer gem for formatting JSON responses
- SimpleCov gem for code coverage tracking
- ShouldaMatchers gem for testing assertions
- VCR / Webmock to stub HTTP requests in tests to simulate API interactions
- Fork/Clone the BE repo
bundle installrails sto start server atlocalhost:3000- Hit the endpoints with Postman or your front-end
- Optionally: visit the front-end repo, fork/clone,
npm installthennmp start- selectYto run onlocalhost:3001for React
dataattribute containsid=null,type="forecast", andattributes.attributesis an object that contains weather information:current_weathercurrent_weatherholds the weather data aslast_updated(format "2023-04-07 16:30"),temperature(float / Fahrenheit),feels_like(float / Fahrenheit),humidity(int or float),uvi(int or float),visibility(int or float),condition(string),icon(png string for current weather condition)daily_weatherholds array of next 5 days of weather data:date(format "2023-04-07"),sunrise(format "07:13 AM"),sunset(format "08:07 PM"),max_temp(float / Fahrenheit),min_temp(float / Fahrenheit),condition(string),icon(png string for weather condition)hourly_weatherholds array of 24 hours data for current day‘‘‘:time(format "22:00"),temperature(float / Fahrenheit),conditions(string / per hour),icon(png string for weather condition per hour)
- Get data as one endpoint:
GET /api/v1/data- takes in 'location' as a param. - Get weather for a city:
GET /api/v0/forecast?location=cincinatti,oh- data can be sent as params,unitsare optional ("imperial" or "metric") - Units default to imperial. - User Registration:
POST /api/v0/users- raw data needs to be sent in the body of the request - Login:
POST /api/v0/sessions- raw data needs to be sent in the body of the request - Create Roadtrip:
POST /api/v0/road_trip- raw data needs to be sent in the body of the request,unitsare optional but can be passed as params ("imperial" or "metric") - Units default to imperial. - Search Books:
GET /api/v0/book_search?location=#{location}&quantity=#{quantity}- data can be sent as params (location);quantity: optional,units: optional ("imperial" or "metric"). Units default to imperial. - Backgrounds:
GET api/v0/backgrounds?location=#{location}- will return a photo of that location
- Clone the application: Create a clone of this repository
- Obtain an API key: Sign-up with email, password, and confirmation password to receive a response with your unique API key (currently no limits)
- Allen Russell - GitHub: @garussell





