- What it does
- How to Install GTFO-BE
- API Contract
- Schema
- Dependencies
- Testing
- Learning Goals
- Licenses
- Contact
- Acknowledgments
This project part of a Service-Oriented Architecture (SOA) application that provides users with flight and weather information based on search parameters that the user provides. The GTFO-BE serves as an intermediary from the GTFO-FE repo and the Weather-API and Flight-API repos. This service collects data from both the Weather and Flight APIs and compiles the data into one service that the front end can call.
To view the production site, please visit the GTFO link.
To view the other components of the application please visit the Github Project Organization.
For usage on your local machine follow the instructions listed below:
git clone [email protected]:GetThatFlightOut/GTFO-BE.git
cd GTFO-BE
bundle install
rake db:{create,migrate}
figaro install
#setup ENV variables in application.yml
#FLIGHT_API_HOST: "https://flight-api-service.herokuapp.com/"
#WEATHER_API_HOST: "https://gtfo-weather-api.herokuapp.com/"
rails s
get calls to: localhost:3000 in your web browser
To see an example response like that below you can use Postman to send a GET request to our BE hosted on Heroku here: https://gtfo-be.herokuapp.com/api/v1/search
Required parameters:
:departure_airport
- (string) - the IATA code of the origin airport
:departure_date
- (string) - %d/%m/%y - the earliest date considered for departing flight
:trip_duration
- (integer) - the number of days planned for the round trip
:limit
- (integer) - the maximum number of results to be returned (default is currently 20 fo the index page)
Sample view of an API call in Postman:
This is an example of an error response for Invalid Data (Missing/Incorrect)
{
"error": "Invalid Data",
"status": 400
}
Due to the sheer amount of data returned from the two APIs, our team decided to implement asynchronous threads with the Rails Executor. This operation allows GTFO to handle multiple HTTP requests simultaneously by running multiple threads, up to 20, to reduce response time by 50%.
- figaro
- faraday
- fast_jsonapi
- travis
- webmock
- vcr
- shoulda-matchers
- simplecov
- For testing our team implemented Travis CI with RSpec
Travis CI is cloud based and when we submit a pull request, Travis will attempt to build our project and run the tests to ensure everything is working as expected.
RSpec is a tool for unit testing that will ensure we have the intended functionality at each level of our code.
- In order to run the tests, run
bundle exec rspec
in the command line and you should have all passing tests.
-
Consume two external APIs
-
Build API's that return JSON responses
-
Refactor code for better code for improved organization/readability
-
Practice project management with project boards/daily standups/group retros
-
Utilize workflow: small commits, descriptive pull requests and code review
-
Write thorough and understandable documentation
-
Utilize a Service-Oriented Architecture with a front-end, a back-end, and at least one micro-service
- Ruby 2.5.3
- Rails 2.5.4.3
- Travis CI Enterprise
Thank you to Ian Douglas and Dione Wilson for being such amazing instructors and guiding us through this project!