Class: DuffelAPI::Services::OfferPassengersService

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

Constant Summary

Constants inherited from BaseService

BaseService::DEFAULT_ALL_PARAMS

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

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

Instance Method Details

#update(offer_id, passenger_id, options = {}) ⇒ Resources::OfferPassenger

Updates an offer passenger, based on the offer ID and passenger ID

Parameters:

  • offer_id (String)
  • passenger_id (String)
  • [required, (Hash)

    a customizable set of options

Returns:

Raises:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/duffel_api/services/offer_passengers_service.rb', line 13

def update(offer_id, passenger_id, options = {})
  path = substitute_url_pattern(
    "/air/offers/:offer_id/passengers/:passenger_id",
    "offer_id" => offer_id,
    "passenger_id" => passenger_id,
  )

  params = options.delete(:params) || {}
  options[:params] = {}
  options[:params]["data"] = params

  begin
    response = make_request(:patch, path, options)

    # Response doesn't raise any errors until #body is called
    response.tap(&:raw_body)
  end

  return if response.raw_body.nil?

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