Class: Skyscanner::SkyscannerApi
- Inherits:
-
Object
- Object
- Skyscanner::SkyscannerApi
- Defined in:
- lib/movlog/skyscanner_api.rb
Overview
Service for all SkyScanner API calls
Constant Summary collapse
- SKY_URL =
'http://partners.api.skyscanner.net/apiservices/browseroutes/'- API_VER =
'v1.0'- SKY_API_URL =
URI.join(SKY_URL, "#{API_VER}/")
Class Method Summary collapse
Class Method Details
.config ⇒ Object
16 17 18 19 20 21 |
# File 'lib/movlog/skyscanner_api.rb', line 16 def self.config return @config if @config @config = { api_key: ENV['SKY_API_KEY'] } end |
.config=(credentials) ⇒ Object
11 12 13 14 |
# File 'lib/movlog/skyscanner_api.rb', line 11 def self.config=(credentials) @config = {} unless @config @config.update(credentials) end |
.routes_info(data) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/movlog/skyscanner_api.rb', line 23 def self.routes_info(data) skyscanner_routes_response = HTTP.get( route_info_url(data), params: { apiKey: config[:api_key] } ) JSON.parse(skyscanner_routes_response.to_s) end |