Class: DuffelAPI::Services::OrderChangeOffersService
- Inherits:
-
BaseService
- Object
- BaseService
- DuffelAPI::Services::OrderChangeOffersService
- Defined in:
- lib/duffel_api/services/order_change_offers_service.rb
Constant Summary
Constants inherited from BaseService
BaseService::DEFAULT_ALL_PARAMS
Instance Method Summary collapse
-
#all(options = {}) ⇒ Enumerator
Returns an ‘Enumerator` which can automatically cycle through multiple pages of `Resources::OrderChangeOffer`s.
-
#get(id, options = {}) ⇒ Resources::OrderChangeOffer
Retrieves a single order change offer by ID.
-
#list(options = {}) ⇒ ListResponse
Lists order change offers, 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::OrderChangeOffer`s.
By default, this will use pages of 200 results under the hood, but this can be customised by specifying the ‘:limit` option in the `:params`.
34 35 36 37 38 39 40 41 |
# File 'lib/duffel_api/services/order_change_offers_service.rb', line 34 def all( = {}) [:params] = DEFAULT_ALL_PARAMS.merge([:params] || {}) Paginator.new( service: self, options: , ).enumerator end |
#get(id, options = {}) ⇒ Resources::OrderChangeOffer
Retrieves a single order change offer by ID
48 49 50 51 52 53 54 55 56 |
# File 'lib/duffel_api/services/order_change_offers_service.rb', line 48 def get(id, = {}) path = substitute_url_pattern("/air/order_change_offers/:id", "id" => id) response = make_request(:get, path, ) return if response.raw_body.nil? Resources::OrderChangeOffer.new(unenvelope_body(response.parsed_body), response) end |
#list(options = {}) ⇒ ListResponse
Lists order change offers, returning a single page of results.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/duffel_api/services/order_change_offers_service.rb', line 12 def list( = {}) path = "/air/order_change_offers" response = make_request(:get, path, ) ListResponse.new( response: response, unenveloped_body: unenvelope_body(response.parsed_body), resource_class: Resources::OrderChangeOffer, ) end |