Class: GoCardless::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.

  • :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.



75
76
77
78
79
80
81
# File 'lib/gocardless-pro/client.rb', line 75

def initialize(options)
  access_token = options.delete(:token) || fail('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

#creditor_bank_accountsObject

Access to the service for creditor_bank_account to make API calls



12
13
14
# File 'lib/gocardless-pro/client.rb', line 12

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

#creditorsObject

Access to the service for creditor to make API calls



7
8
9
# File 'lib/gocardless-pro/client.rb', line 7

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

#customer_bank_accountsObject

Access to the service for customer_bank_account to make API calls



22
23
24
# File 'lib/gocardless-pro/client.rb', line 22

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

#customersObject

Access to the service for customer to make API calls



17
18
19
# File 'lib/gocardless-pro/client.rb', line 17

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

#eventsObject

Access to the service for event to make API calls



27
28
29
# File 'lib/gocardless-pro/client.rb', line 27

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

#helpersObject

Access to the service for helper to make API calls



32
33
34
# File 'lib/gocardless-pro/client.rb', line 32

def helpers
  @helpers ||= Services::HelperService.new(@api_service)
end

#mandatesObject

Access to the service for mandate to make API calls



37
38
39
# File 'lib/gocardless-pro/client.rb', line 37

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

#paymentsObject

Access to the service for payment to make API calls



42
43
44
# File 'lib/gocardless-pro/client.rb', line 42

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

#payoutsObject

Access to the service for payout to make API calls



47
48
49
# File 'lib/gocardless-pro/client.rb', line 47

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

#redirect_flowsObject

Access to the service for redirect_flow to make API calls



52
53
54
# File 'lib/gocardless-pro/client.rb', line 52

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

#refundsObject

Access to the service for refund to make API calls



57
58
59
# File 'lib/gocardless-pro/client.rb', line 57

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

#subscriptionsObject

Access to the service for subscription to make API calls



62
63
64
# File 'lib/gocardless-pro/client.rb', line 62

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