Class: DuffelAPI::Services::AirlinesService
- Inherits:
-
BaseService
- Object
- BaseService
- DuffelAPI::Services::AirlinesService
- Defined in:
- lib/duffel_api/services/airlines_service.rb
Instance Method Summary collapse
-
#all(options = {}) ⇒ Enumerator
Returns an
Enumeratorwhich can automatically cycle through multiple pages of ‘Resources;:Airline`s. -
#get(id, options = {}) ⇒ Resources::Airline
Retrieves a single airline by ID.
-
#list(options = {}) ⇒ Object
Lists airports, returning a single page of results.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from DuffelAPI::Services::BaseService
Instance Method Details
#all(options = {}) ⇒ Enumerator
Returns an Enumerator which can automatically cycle through multiple pages of ‘Resources;:Airline`s
30 31 32 33 34 35 |
# File 'lib/duffel_api/services/airlines_service.rb', line 30 def all( = {}) DuffelAPI::Paginator.new( service: self, options: , ).enumerator end |
#get(id, options = {}) ⇒ Resources::Airline
Retrieves a single airline by ID
42 43 44 45 46 47 48 49 50 |
# File 'lib/duffel_api/services/airlines_service.rb', line 42 def get(id, = {}) path = substitute_url_pattern("/air/airlines/:id", "id" => id) response = make_request(:get, path, ) return if response.raw_body.nil? Resources::Airline.new(unenvelope_body(response.parsed_body), response) end |
#list(options = {}) ⇒ Object
Lists airports, returning a single page of results
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/duffel_api/services/airlines_service.rb', line 11 def list( = {}) path = "/air/airlines" response = make_request(:get, path, ) ListResponse.new( response: response, unenveloped_body: unenvelope_body(response.parsed_body), resource_class: Resources::Airline, ) end |