Class: GoCardlessPro::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/gocardless_pro/client.rb

Overview

A class for working with and talking to the GoCardless API

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Get a Client configured to use HTTP Basic authentication with the GC Api

Parameters:

  • options (Hash<Symbol,String>)

    configuration for creating the client

Options Hash (options):

  • :environment (Symbol)

    the environment to connect to - one of ‘:live` or `:sandbox`.

  • :access_token (Symbol)

    the API token

  • :url (Symbol)

    the full URL used to make requests to. If you specify this, it will be used over the ‘environment` option.

  • :connection_options (Symbol)

    ‘Faraday` connection options hash, e.g. `{ request: { timeout: 3 } }`.



196
197
198
199
200
201
202
# File 'lib/gocardless_pro/client.rb', line 196

def initialize(options)
  access_token = options.delete(:access_token) || raise('No Access Token given to GoCardless Client')
  environment = options.delete(:environment) || :live
  url = options.delete(:url) || url_for_environment(environment)
  options = custom_options(options)
  @api_service = ApiService.new(url, access_token, options)
end

Instance Method Details

#bank_authorisationsObject

Access to the service for bank_authorisation to make API calls



7
8
9
# File 'lib/gocardless_pro/client.rb', line 7

def bank_authorisations
  @bank_authorisations ||= Services::BankAuthorisationsService.new(@api_service)
end

#bank_details_lookupsObject

Access to the service for bank_details_lookup to make API calls



12
13
14
# File 'lib/gocardless_pro/client.rb', line 12

def bank_details_lookups
  @bank_details_lookups ||= Services::BankDetailsLookupsService.new(@api_service)
end

#billing_request_flowsObject

Access to the service for billing_request_flow to make API calls



22
23
24
# File 'lib/gocardless_pro/client.rb', line 22

def billing_request_flows
  @billing_request_flows ||= Services::BillingRequestFlowsService.new(@api_service)
end

#billing_request_templatesObject

Access to the service for billing_request_template to make API calls



27
28
29
# File 'lib/gocardless_pro/client.rb', line 27

def billing_request_templates
  @billing_request_templates ||= Services::BillingRequestTemplatesService.new(@api_service)
end

#billing_requestsObject

Access to the service for billing_request to make API calls



17
18
19
# File 'lib/gocardless_pro/client.rb', line 17

def billing_requests
  @billing_requests ||= Services::BillingRequestsService.new(@api_service)
end

#blocksObject

Access to the service for block to make API calls



32
33
34
# File 'lib/gocardless_pro/client.rb', line 32

def blocks
  @blocks ||= Services::BlocksService.new(@api_service)
end

#creditor_bank_accountsObject

Access to the service for creditor_bank_account to make API calls



42
43
44
# File 'lib/gocardless_pro/client.rb', line 42

def creditor_bank_accounts
  @creditor_bank_accounts ||= Services::CreditorBankAccountsService.new(@api_service)
end

#creditorsObject

Access to the service for creditor to make API calls



37
38
39
# File 'lib/gocardless_pro/client.rb', line 37

def creditors
  @creditors ||= Services::CreditorsService.new(@api_service)
end

#currency_exchange_ratesObject

Access to the service for currency_exchange_rate to make API calls



47
48
49
# File 'lib/gocardless_pro/client.rb', line 47

def currency_exchange_rates
  @currency_exchange_rates ||= Services::CurrencyExchangeRatesService.new(@api_service)
end

#customer_bank_accountsObject

Access to the service for customer_bank_account to make API calls



57
58
59
# File 'lib/gocardless_pro/client.rb', line 57

def customer_bank_accounts
  @customer_bank_accounts ||= Services::CustomerBankAccountsService.new(@api_service)
end

#customer_notificationsObject

Access to the service for customer_notification to make API calls



62
63
64
# File 'lib/gocardless_pro/client.rb', line 62

def customer_notifications
  @customer_notifications ||= Services::CustomerNotificationsService.new(@api_service)
end

#customersObject

Access to the service for customer to make API calls



52
53
54
# File 'lib/gocardless_pro/client.rb', line 52

def customers
  @customers ||= Services::CustomersService.new(@api_service)
end

#eventsObject

Access to the service for event to make API calls



67
68
69
# File 'lib/gocardless_pro/client.rb', line 67

def events
  @events ||= Services::EventsService.new(@api_service)
end

#exportsObject

Access to the service for export to make API calls



72
73
74
# File 'lib/gocardless_pro/client.rb', line 72

def exports
  @exports ||= Services::ExportsService.new(@api_service)
end

#instalment_schedulesObject

Access to the service for instalment_schedule to make API calls



77
78
79
# File 'lib/gocardless_pro/client.rb', line 77

def instalment_schedules
  @instalment_schedules ||= Services::InstalmentSchedulesService.new(@api_service)
end

#institutionsObject

Access to the service for institution to make API calls



82
83
84
# File 'lib/gocardless_pro/client.rb', line 82

def institutions
  @institutions ||= Services::InstitutionsService.new(@api_service)
end

#logosObject

Access to the service for logo to make API calls



87
88
89
# File 'lib/gocardless_pro/client.rb', line 87

def logos
  @logos ||= Services::LogosService.new(@api_service)
end

#mandate_import_entriesObject

Access to the service for mandate_import_entry to make API calls



102
103
104
# File 'lib/gocardless_pro/client.rb', line 102

def mandate_import_entries
  @mandate_import_entries ||= Services::MandateImportEntriesService.new(@api_service)
end

#mandate_importsObject

Access to the service for mandate_import to make API calls



97
98
99
# File 'lib/gocardless_pro/client.rb', line 97

def mandate_imports
  @mandate_imports ||= Services::MandateImportsService.new(@api_service)
end

#mandate_pdfsObject

Access to the service for mandate_pdf to make API calls



107
108
109
# File 'lib/gocardless_pro/client.rb', line 107

def mandate_pdfs
  @mandate_pdfs ||= Services::MandatePdfsService.new(@api_service)
end

#mandatesObject

Access to the service for mandate to make API calls



92
93
94
# File 'lib/gocardless_pro/client.rb', line 92

def mandates
  @mandates ||= Services::MandatesService.new(@api_service)
end

#negative_balance_limitsObject

Access to the service for negative_balance_limit to make API calls



112
113
114
# File 'lib/gocardless_pro/client.rb', line 112

def negative_balance_limits
  @negative_balance_limits ||= Services::NegativeBalanceLimitsService.new(@api_service)
end

#payer_authorisationsObject

Access to the service for payer_authorisation to make API calls



117
118
119
# File 'lib/gocardless_pro/client.rb', line 117

def payer_authorisations
  @payer_authorisations ||= Services::PayerAuthorisationsService.new(@api_service)
end

#payer_themesObject

Access to the service for payer_theme to make API calls



122
123
124
# File 'lib/gocardless_pro/client.rb', line 122

def payer_themes
  @payer_themes ||= Services::PayerThemesService.new(@api_service)
end

#paymentsObject

Access to the service for payment to make API calls



127
128
129
# File 'lib/gocardless_pro/client.rb', line 127

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

#payout_itemsObject

Access to the service for payout_item to make API calls



137
138
139
# File 'lib/gocardless_pro/client.rb', line 137

def payout_items
  @payout_items ||= Services::PayoutItemsService.new(@api_service)
end

#payoutsObject

Access to the service for payout to make API calls



132
133
134
# File 'lib/gocardless_pro/client.rb', line 132

def payouts
  @payouts ||= Services::PayoutsService.new(@api_service)
end

#redirect_flowsObject

Access to the service for redirect_flow to make API calls



142
143
144
# File 'lib/gocardless_pro/client.rb', line 142

def redirect_flows
  @redirect_flows ||= Services::RedirectFlowsService.new(@api_service)
end

#refundsObject

Access to the service for refund to make API calls



147
148
149
# File 'lib/gocardless_pro/client.rb', line 147

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

#scenario_simulatorsObject

Access to the service for scenario_simulator to make API calls



152
153
154
# File 'lib/gocardless_pro/client.rb', line 152

def scenario_simulators
  @scenario_simulators ||= Services::ScenarioSimulatorsService.new(@api_service)
end

#scheme_identifiersObject

Access to the service for scheme_identifier to make API calls



157
158
159
# File 'lib/gocardless_pro/client.rb', line 157

def scheme_identifiers
  @scheme_identifiers ||= Services::SchemeIdentifiersService.new(@api_service)
end

#subscriptionsObject

Access to the service for subscription to make API calls



162
163
164
# File 'lib/gocardless_pro/client.rb', line 162

def subscriptions
  @subscriptions ||= Services::SubscriptionsService.new(@api_service)
end

#tax_ratesObject

Access to the service for tax_rate to make API calls



167
168
169
# File 'lib/gocardless_pro/client.rb', line 167

def tax_rates
  @tax_rates ||= Services::TaxRatesService.new(@api_service)
end

#transferred_mandatesObject

Access to the service for transferred_mandate to make API calls



172
173
174
# File 'lib/gocardless_pro/client.rb', line 172

def transferred_mandates
  @transferred_mandates ||= Services::TransferredMandatesService.new(@api_service)
end

#verification_detailsObject

Access to the service for verification_detail to make API calls



177
178
179
# File 'lib/gocardless_pro/client.rb', line 177

def verification_details
  @verification_details ||= Services::VerificationDetailsService.new(@api_service)
end

#webhooksObject

Access to the service for webhook to make API calls



182
183
184
# File 'lib/gocardless_pro/client.rb', line 182

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