class DuffelAPI::Client
A client for accessing the Duffel API, configured with a provided access token and base URL, which provides access to API services
Constants
- API_VERSION
Public Class Methods
Sets up the client with your access token
@param access_token [String] A test or live mode access token @param base_url [String] The URL of the Duffel API @return [Client]
# File lib/duffel_api/client.rb, line 14 def initialize(access_token:, base_url: "https://api.duffel.com") @api_service = APIService.new(base_url, access_token, **default_options) end
Public Instance Methods
@return [Services::AircraftService]
# File lib/duffel_api/client.rb, line 19 def aircraft @aircraft ||= Services::AircraftService.new(@api_service) end
@return [Services::AirlinesService]
# File lib/duffel_api/client.rb, line 24 def airlines @airlines ||= Services::AirlinesService.new(@api_service) end
@return [Services::AirportsService]
# File lib/duffel_api/client.rb, line 29 def airports @airports ||= Services::AirportsService.new(@api_service) end
@return [Services::OfferPassengersService]
# File lib/duffel_api/client.rb, line 34 def offer_passengers @offer_passengers ||= Services::OfferPassengersService.new(@api_service) end
@return [Services::OfferRequestsService]
# File lib/duffel_api/client.rb, line 39 def offer_requests @offer_requests ||= Services::OfferRequestsService.new(@api_service) end
@return [Services::OffersService]
# File lib/duffel_api/client.rb, line 44 def offers @offers ||= Services::OffersService.new(@api_service) end
@return [Services::OrderCancellationsService]
# File lib/duffel_api/client.rb, line 49 def order_cancellations @order_cancellations ||= Services::OrderCancellationsService.new(@api_service) end
@return [Services::OrderChangeOffersService]
# File lib/duffel_api/client.rb, line 54 def order_change_offers @order_change_offers ||= Services::OrderChangeOffersService.new(@api_service) end
@return [Services::OrderChangeRequestsService]
# File lib/duffel_api/client.rb, line 59 def order_change_requests @order_change_requests ||= Services::OrderChangeRequestsService.new(@api_service) end
@return [Services::OrderChangesService]
# File lib/duffel_api/client.rb, line 64 def order_changes @order_changes ||= Services::OrderChangesService.new(@api_service) end
@return [Services::OrdersService]
# File lib/duffel_api/client.rb, line 69 def orders @orders ||= Services::OrdersService.new(@api_service) end
@return [Services::PaymentIntentsService]
# File lib/duffel_api/client.rb, line 74 def payment_intents @payment_intents ||= Services::PaymentIntentsService.new(@api_service) end
@return [Services::PaymentsService]
# File lib/duffel_api/client.rb, line 79 def payments @payments ||= Services::PaymentsService.new(@api_service) end
@return [Services::RefundsService]
# File lib/duffel_api/client.rb, line 84 def refunds @refunds ||= Services::RefundsService.new(@api_service) end
@return [Services::SeatMapsService]
# File lib/duffel_api/client.rb, line 89 def seat_maps @seat_maps ||= Services::SeatMapsService.new(@api_service) end
@return [Services::WebhooksService]
# File lib/duffel_api/client.rb, line 94 def webhooks @webhooks ||= Services::WebhooksService.new(@api_service) end
Private Instance Methods
# File lib/duffel_api/client.rb, line 100 def default_options { default_headers: { "Duffel-Version" => API_VERSION, "User-Agent" => "Duffel/#{API_VERSION} duffel_api_ruby/#{DuffelAPI::VERSION}", "Content-Type" => "application/json", }, } end