Class: DuffelAPI::Services::OrderChangeOffersService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/duffel_api/services/order_change_offers_service.rb

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #make_request

Constructor Details

This class inherits a constructor from DuffelAPI::Services::BaseService

Instance Method Details

#all(options = {}) ⇒ Object



18
19
20
21
22
23
# File 'lib/duffel_api/services/order_change_offers_service.rb', line 18

def all(options = {})
  Paginator.new(
    service: self,
    options: options,
  ).enumerator
end

#get(id, options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/duffel_api/services/order_change_offers_service.rb', line 25

def get(id, options = {})
  path = substitute_url_pattern("/air/order_change_offers/:id", "id" => id)

  response = make_request(:get, path, options)

  return if response.raw_body.nil?

  Resources::OrderChangeOffer.new(unenvelope_body(response.parsed_body), response)
end

#list(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/duffel_api/services/order_change_offers_service.rb', line 6

def list(options = {})
  path = "/air/order_change_offers"

  response = make_request(:get, path, options)

  ListResponse.new(
    response: response,
    unenveloped_body: unenvelope_body(response.parsed_body),
    resource_class: Resources::OrderChangeOffer,
  )
end