Skip to content

Microservice for Get That Flight Out that provides flight information based on given search parameters.

Notifications You must be signed in to change notification settings

GetTheFlightOut/Flight-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flight-API

image

Table of Contents

What it does

This project is 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 Flight-API serves as an intermediary, or microservice, from the Kiwi API and the GTFO-BE repo. It retrieves data from the Kiwi API and packages it with only the information needed for the BE application, which in turn combines the data from both the Weather and Flight APIs to send a combination of data from the two in one package for the front end.

To view the production site, please visit the GTFO link.

To view the other components of the application please visit the Github Project Organization.

System Design

We planned out our project on this Miro Board.

Screen-Shot-2021-01-14-at-4-23-46-PM

How to Install Flight-API

git clone [email protected]:GetThatFlightOut/Flight-API.git
cd Flight-API
bundle install
shotgun

API Contract

The Flight API adheres to the standard JSON structure outlined on jsonapi.

  • GET /api/v1/flights: An example of a successful response body is as follows:
{"data":
  [{"id": "777",
    "type": "flight",
    "attributes":
     {"origin_city": "Denver",
      "destination_city": "Las Vegas",
      "origin_iata": "DEN",
      "destination_iata": "LAS",
      "latitude": 36.08,
      "longitude": -115.15222,
      "price": 48,
      "departure_datetime":
       "2021-01-30T16:18:00.000+00:00",
      "arrival_datetime":
       "2021-01-30T17:19:00.000+00:00",
      "r_departure_datetime":
       "2021-02-04T16:45:00.000+00:00",
      "r_arrival_datetime":
       "2021-02-04T19:44:00.000+00:00",
      "booking_link":
       "https://www.kiwi.com/deep?from=DEN&to=LAS&flightsId=0713244648e10000956fd20d_0%7C2446071348e60000bdad426d_0&price=40&passengers=1&affilid=picky&lang=en&currency=USD&booking_token=Bl1eEOekQmiUSdJPDhd8KsZsKxLkK2NMij2qwscBpXxiy-8M0wqdN84gJ22N7Vzz0XZ-VIuywxmaDjRSKDhXWuc0tH2KD-6hnWy5Ziwy_fQ2w-kf4X4AWTkJ0o_LUBr2CqwxKM6ktkn1c9sbKaQ43fXYfkcIaVtDlTxSpUJfeTato9hJNaFrCXFXs-GMbvPeKF-ksA15anp764WKIM54oedHG2ulK_OOcVmyl7ubD8C0s9m5E2IDaAdASAbpllQMXxpu2hKpJudVjCzErDR1hrh0g1fxZ2u3DyfJdJLQq0xuQ68OJj7xxPRXJ2ofAOOTFrRVUkQ7p09BdKNju138PifLQC2YknsSUQQPZuDFSinrqpJVkO8YVapsrDfZ1CxFPM_JhfXT27X16jNvRCjrckvwEKbPT9DRYgb0h4__WwnjcCxAqY3aaOhS-9H_gRFd49qiAknz13F40lWUIoZwQeoCRj7WCTbFT25rYTGZNLU8yvqkoDkeR2pzuBpto7PEGKqcBEDEuMHzt-B6OXSPVbphu1HLsJnrJguFL2Bq_PZV-ugdNsxIpe-v-DyiS0jubCvMQEeUac4_4_Ku6qa8Rj7HHex0NESs3Edrq_BuaYJIFPqVkx12_BTy_vdn6fvmnR-un5ecjkSCT4v12hd5h3WeObPc6jUA_9LcHQaHoSh8=",
      "trip_duration": 5,
      "id": 777}}]}
  • GET /api/v1/flights: An example of an unsuccessful response body is:
{"message":
  [{"param": "fly_from",
    "errors": ["Not recognized location: `ZZZ`"]}]}

The GET /api/v1/flights endpoint requires several parameters for a successful response. The required parameters are:

:fly_from - (string) - the IATA code of the origin airport

:date_from - (string) - %d%m%y - the earliest date considered for departing flight

:date_to - (string) - %d%m%y - the latest date considered for departing flight

:nights_in_dst_from - (integer) - the minimum length of stay considered for the round trip

:nights_in_dst_to - (integer) - the maximum length of stay considered for the round trip

:limit - (integer) - the maximum number of results to be returned

  • An example of valid required parameters is:
{:fly_from => 'DEN',
 :date_from => '30/01/2021',
 :date_to => '30/01/2021',
 :nights_in_dst_from => 5,
 :nights_in_dst_to => 5,
 :limit => 20
 }
  • To explore documentation if you're interested in incorporating other endpoints, please reference the Kiwi API docs.

Dependencies

  • This microservice uses the fast_jsonapi gem, which is no longer being maintained.

  • For this microservice we used the Sinatra with the Shotgun Gem to build a condensed ruby framework and run it on a local server.

  • We used the Faraday Gem to make calls to our API service.

  • We used the Figaro Gem to keep confidential information like API keys secure.

  • The SimpleCov gem was used to ensure that we covered 100% of our code with unit testing.

Testing

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.

Learning Goals

  • Consume 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

Licenses

  • Ruby 2.5.3
  • Sinatra
  • Travis CI Enterprise

Contact

Todd Estes: LinkedIn, Email, GitHub

Connor Ferguson: LinkedIn, Email, GitHub

George Soderholm: LinkedIn, Email, GitHub

Sage Freeman-Gonzales: LinkedIn, Email, GitHub

Sheryl Stillman: LinkedIn, Email, GitHub

Aidan Murray: LinkedIn, Email, GitHub

Jesse Mellinger: LinkedIn, Email, GitHub

Nick King: LinkedIn, Email, GitHub

Brian Liu: LinkedIn, Email, GitHub

Will Dunlap: LinkedIn, Email, GitHub

Acknowledgments

Thank you to Ian Douglas and Dione Wilson for being such amazing instructors and guiding us through this project!

About

Microservice for Get That Flight Out that provides flight information based on given search parameters.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages