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 } }`.



101
102
103
104
105
106
107
# File 'lib/gocardless_pro/client.rb', line 101

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_details_lookupsObject

Access to the service for bank_details_lookup to make API calls



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

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

#creditor_bank_accountsObject

Access to the service for creditor_bank_account to make API calls



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

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

#creditorsObject

Access to the service for creditor to make API calls



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

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

#customer_bank_accountsObject

Access to the service for customer_bank_account to make API calls



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

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



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

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

#customersObject

Access to the service for customer to make API calls



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

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

#eventsObject

Access to the service for event to make API calls



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

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

#mandate_import_entriesObject

Access to the service for mandate_import_entry to make API calls



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

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



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

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

#mandate_pdfsObject

Access to the service for mandate_pdf to make API calls



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

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

#mandatesObject

Access to the service for mandate to make API calls



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

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

#paymentsObject

Access to the service for payment to make API calls



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

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

#payout_itemsObject

Access to the service for payout_item to make API calls



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

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

#payoutsObject

Access to the service for payout to make API calls



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

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

#redirect_flowsObject

Access to the service for redirect_flow to make API calls



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

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

#refundsObject

Access to the service for refund to make API calls



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

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

#subscriptionsObject

Access to the service for subscription to make API calls



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

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