Class: Starling::Client

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

Overview

The client for the Starling Bank API, providing authenticated access to the various endpoints offered in the API, with a uniform, idiomatic Ruby interface.

Constant Summary collapse

ENVIRONMENT_BASE_URLS =

URLs for the two Starling Bank API environments, production and sandbox

{
  production: 'https://api.starlingbank.com',
  sandbox: 'https://api-sandbox.starlingbank.com'
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(access_token:, environment: :production, default_headers: {}, connection_options: {}) ⇒ Starling::Client

Instantiates a client for accessing the Starling Bank API


25
26
27
28
29
30
31
# File 'lib/starling/client.rb', line 25

def initialize(access_token:, environment: :production, default_headers: {},
               connection_options: {})
  @api_service = ApiService.new(fetch_base_url_for_environment(environment),
                                access_token: access_token,
                                default_headers: default_headers,
                                connection_options: connection_options)
end

Instance Method Details

#accountStarling::Services::AccountService

Provides access to the Account API


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

def 
  Services::AccountService.new(@api_service)
end

#account_balanceStarling::Services::AccountBalanceService

Provides access to the Account Balance API


46
47
48
# File 'lib/starling/client.rb', line 46

def 
  Services::AccountBalanceService.new(@api_service)
end

#addressesStarling::Services::AddressesService

Provides access to the Addresses API


103
104
105
# File 'lib/starling/client.rb', line 103

def addresses
  Services::AddressesService.new(@api_service)
end

#cardStarling::Services::CardService

Provides access to the Card API


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

def card
  Services::CardService.new(@api_service)
end

#contact_accountsStarling::Services::ContactAccountsService

Provides access to the Contact Accounts API


129
130
131
# File 'lib/starling/client.rb', line 129

def contact_accounts
  Services::ContactAccountsService.new(@api_service)
end

#contactsStarling::Services::ContactsService

Provides access to the Contacts API


120
121
122
# File 'lib/starling/client.rb', line 120

def contacts
  Services::ContactsService.new(@api_service)
end

#customerStarling::Services::CustomerService

Provides access to the Customer API


95
96
97
# File 'lib/starling/client.rb', line 95

def customer
  Services::CustomerService.new(@api_service)
end

#direct_debit_mandatesStarling::Services::DirectDebitMandatesService

Provides access to the Direct Debit Mandates API


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

def direct_debit_mandates
  Services::DirectDebitMandatesService.new(@api_service)
end

#direct_debit_transactionsStarling::Services::DirectDebitTransactionsService

Provides access to the Transaction Direct Debit API


168
169
170
# File 'lib/starling/client.rb', line 168

def direct_debit_transactions
  Services::DirectDebitTransactionsService.new(@api_service)
end

#inbound_faster_payments_transactionsStarling::Services::InboundFasterPaymentsTransactionsService

Provides access to the Transaction Faster Payment In API


143
144
145
# File 'lib/starling/client.rb', line 143

def inbound_faster_payments_transactions
  Services::InboundFasterPaymentsTransactionsService.new(@api_service)
end

#mastercard_transactionsStarling::Services::MastercardTransactionsService

Provides access to the Transaction Mastercard API


186
187
188
# File 'lib/starling/client.rb', line 186

def mastercard_transactions
  Services::MastercardTransactionsService.new(@api_service)
end

#meStarling::Services::MeService

Provides access to the Who Am I (Me) API


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

def me
  Services::MeService.new(@api_service)
end

#merchant_locationsStarling::Services::MerchantLocationsService

Provides access to the Merchants Locations API


71
72
73
# File 'lib/starling/client.rb', line 71

def merchant_locations
  Services::MerchantLocationsService.new(@api_service)
end

#merchantsStarling::Services::MerchantsService

Provides access to the Merchants API


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

def merchants
  Services::MerchantsService.new(@api_service)
end

#outbound_faster_payments_transactionsStarling::Services::OutboundFasterPaymentsTransactionsService

Provides access to the Transaction Faster Payment Out API


158
159
160
# File 'lib/starling/client.rb', line 158

def outbound_faster_payments_transactions
  Services::OutboundFasterPaymentsTransactionsService.new(@api_service)
end

#paymentsStarling::Services::PaymentsService

Provides access to the Payment API


176
177
178
# File 'lib/starling/client.rb', line 176

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

#transactionsStarling::Services::TransactionsService

Provides access to the Transactions API


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

def transactions
  Services::TransactionsService.new(@api_service)
end