Class: DuffelAPI::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/duffel_api/client.rb

Overview

A client for accessing the Duffel API, configured with a provided access token and base URL, which provides access to API services

Constant Summary collapse

API_VERSION =
"beta"

Instance Method Summary collapse

Constructor Details

#initialize(access_token:, base_url: "https://api.duffel.com") ⇒ Client

Sets up the client with your access token

Parameters:

  • access_token (String)

    A test or live mode access token

  • base_url (String) (defaults to: "https://api.duffel.com")

    The URL of the Duffel API


14
15
16
# 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

Instance Method Details

#aircraftServices::AircraftService


19
20
21
# File 'lib/duffel_api/client.rb', line 19

def aircraft
  @aircraft ||= Services::AircraftService.new(@api_service)
end

#airlinesServices::AirlinesService


24
25
26
# File 'lib/duffel_api/client.rb', line 24

def airlines
  @airlines ||= Services::AirlinesService.new(@api_service)
end

#airportsServices::AirportsService


29
30
31
# File 'lib/duffel_api/client.rb', line 29

def airports
  @airports ||= Services::AirportsService.new(@api_service)
end

#offer_passengersServices::OfferPassengersService


34
35
36
# File 'lib/duffel_api/client.rb', line 34

def offer_passengers
  @offer_passengers ||= Services::OfferPassengersService.new(@api_service)
end

#offer_requestsServices::OfferRequestsService


39
40
41
# File 'lib/duffel_api/client.rb', line 39

def offer_requests
  @offer_requests ||= Services::OfferRequestsService.new(@api_service)
end

#offersServices::OffersService


44
45
46
# File 'lib/duffel_api/client.rb', line 44

def offers
  @offers ||= Services::OffersService.new(@api_service)
end

#order_cancellationsServices::OrderCancellationsService


49
50
51
# File 'lib/duffel_api/client.rb', line 49

def order_cancellations
  @order_cancellations ||= Services::OrderCancellationsService.new(@api_service)
end

#order_change_offersServices::OrderChangeOffersService


54
55
56
# File 'lib/duffel_api/client.rb', line 54

def order_change_offers
  @order_change_offers ||= Services::OrderChangeOffersService.new(@api_service)
end

#order_change_requestsServices::OrderChangeRequestsService


59
60
61
# File 'lib/duffel_api/client.rb', line 59

def order_change_requests
  @order_change_requests ||= Services::OrderChangeRequestsService.new(@api_service)
end

#order_changesServices::OrderChangesService


64
65
66
# File 'lib/duffel_api/client.rb', line 64

def order_changes
  @order_changes ||= Services::OrderChangesService.new(@api_service)
end

#ordersServices::OrdersService


69
70
71
# File 'lib/duffel_api/client.rb', line 69

def orders
  @orders ||= Services::OrdersService.new(@api_service)
end

#payment_intentsServices::PaymentIntentsService


74
75
76
# File 'lib/duffel_api/client.rb', line 74

def payment_intents
  @payment_intents ||= Services::PaymentIntentsService.new(@api_service)
end

#paymentsServices::PaymentsService


79
80
81
# File 'lib/duffel_api/client.rb', line 79

def payments
  @payments ||= Services::PaymentsService.new(@api_service)
end

#refundsServices::RefundsService


84
85
86
# File 'lib/duffel_api/client.rb', line 84

def refunds
  @refunds ||= Services::RefundsService.new(@api_service)
end

#seat_mapsServices::SeatMapsService


89
90
91
# File 'lib/duffel_api/client.rb', line 89

def seat_maps
  @seat_maps ||= Services::SeatMapsService.new(@api_service)
end

#webhooksServices::WebhooksService


94
95
96
# File 'lib/duffel_api/client.rb', line 94

def webhooks
  @webhooks ||= Services::WebhooksService.new(@api_service)
end