Class: Increase::Client

Inherits:
Internal::Transport::BaseClient show all
Defined in:
lib/increase/client.rb

Constant Summary collapse

DEFAULT_MAX_RETRIES =

Default max number of retries to attempt after a failed retryable request.

2
DEFAULT_TIMEOUT_IN_SECONDS =

Default per-request timeout.

60.0
DEFAULT_INITIAL_RETRY_DELAY =

Default initial retry delay in seconds. Overall delay is calculated using exponential backoff + jitter.

0.5
DEFAULT_MAX_RETRY_DELAY =

Default max retry delay in seconds.

8.0
ENVIRONMENTS =

rubocop:disable Style/MutableConstant

{production: "https://api.increase.com", sandbox: "https://sandbox.increase.com"}

Constants inherited from Internal::Transport::BaseClient

Internal::Transport::BaseClient::MAX_REDIRECTS, Internal::Transport::BaseClient::PLATFORM_HEADERS

Instance Attribute Summary collapse

Attributes inherited from Internal::Transport::BaseClient

#base_url, #headers, #idempotency_header, #initial_retry_delay, #max_retries, #max_retry_delay, #requester, #timeout

Instance Method Summary collapse

Methods inherited from Internal::Transport::BaseClient

follow_redirect, #inspect, reap_connection!, #request, #send_request, should_retry?, validate!

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(api_key: ENV["INCREASE_API_KEY"], environment: nil, base_url: ENV["INCREASE_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY, idempotency_header: "Idempotency-Key") ⇒ Client

Creates and returns a new client for interacting with the API.

Each environment maps to a different base URL:

‘“api.example.com/v2/”`. Defaults to `ENV`

Parameters:

  • api_key (String, nil) (defaults to: ENV["INCREASE_API_KEY"])

    Defaults to ‘ENV`

  • environment (:production, :sandbox, nil) (defaults to: nil)

    Specifies the environment to use for the API.

  • base_url (String, nil) (defaults to: ENV["INCREASE_BASE_URL"])

    Override the default base URL for the API, e.g.,

  • max_retries (Integer) (defaults to: self.class::DEFAULT_MAX_RETRIES)

    Max number of retries to attempt after a failed retryable request.

  • timeout (Float) (defaults to: self.class::DEFAULT_TIMEOUT_IN_SECONDS)
  • initial_retry_delay (Float) (defaults to: self.class::DEFAULT_INITIAL_RETRY_DELAY)
  • max_retry_delay (Float) (defaults to: self.class::DEFAULT_MAX_RETRY_DELAY)
  • idempotency_header (String) (defaults to: "Idempotency-Key")


229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/increase/client.rb', line 229

def initialize(
  api_key: ENV["INCREASE_API_KEY"],
  environment: nil,
  base_url: ENV["INCREASE_BASE_URL"],
  max_retries: self.class::DEFAULT_MAX_RETRIES,
  timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
  initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
  max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY,
  idempotency_header: "Idempotency-Key"
)
  base_url ||= Increase::Client::ENVIRONMENTS.fetch(environment&.to_sym || :production) do
    message = "environment must be one of #{Increase::Client::ENVIRONMENTS.keys}, got #{environment}"
    raise ArgumentError.new(message)
  end

  if api_key.nil?
    raise ArgumentError.new("api_key is required, and can be set via environ: \"INCREASE_API_KEY\"")
  end

  @api_key = api_key.to_s

  super(
    base_url: base_url,
    timeout: timeout,
    max_retries: max_retries,
    initial_retry_delay: initial_retry_delay,
    max_retry_delay: max_retry_delay,
    idempotency_header: idempotency_header
  )

  @accounts = Increase::Resources::Accounts.new(client: self)
  @account_numbers = Increase::Resources::AccountNumbers.new(client: self)
  @account_transfers = Increase::Resources::AccountTransfers.new(client: self)
  @cards = Increase::Resources::Cards.new(client: self)
  @card_payments = Increase::Resources::CardPayments.new(client: self)
  @card_purchase_supplements = Increase::Resources::CardPurchaseSupplements.new(client: self)
  @card_disputes = Increase::Resources::CardDisputes.new(client: self)
  @physical_cards = Increase::Resources::PhysicalCards.new(client: self)
  @digital_card_profiles = Increase::Resources::DigitalCardProfiles.new(client: self)
  @physical_card_profiles = Increase::Resources::PhysicalCardProfiles.new(client: self)
  @digital_wallet_tokens = Increase::Resources::DigitalWalletTokens.new(client: self)
  @transactions = Increase::Resources::Transactions.new(client: self)
  @pending_transactions = Increase::Resources::PendingTransactions.new(client: self)
  @declined_transactions = Increase::Resources::DeclinedTransactions.new(client: self)
  @ach_transfers = Increase::Resources::ACHTransfers.new(client: self)
  @ach_prenotifications = Increase::Resources::ACHPrenotifications.new(client: self)
  @inbound_ach_transfers = Increase::Resources::InboundACHTransfers.new(client: self)
  @wire_transfers = Increase::Resources::WireTransfers.new(client: self)
  @inbound_wire_transfers = Increase::Resources::InboundWireTransfers.new(client: self)
  @wire_drawdown_requests = Increase::Resources::WireDrawdownRequests.new(client: self)
  @inbound_wire_drawdown_requests = Increase::Resources::InboundWireDrawdownRequests.new(client: self)
  @check_transfers = Increase::Resources::CheckTransfers.new(client: self)
  @inbound_check_deposits = Increase::Resources::InboundCheckDeposits.new(client: self)
  @real_time_payments_transfers = Increase::Resources::RealTimePaymentsTransfers.new(client: self)
  @inbound_real_time_payments_transfers =
    Increase::Resources::InboundRealTimePaymentsTransfers.new(client: self)
  @fednow_transfers = Increase::Resources::FednowTransfers.new(client: self)
  @inbound_fednow_transfers = Increase::Resources::InboundFednowTransfers.new(client: self)
  @check_deposits = Increase::Resources::CheckDeposits.new(client: self)
  @lockboxes = Increase::Resources::Lockboxes.new(client: self)
  @inbound_mail_items = Increase::Resources::InboundMailItems.new(client: self)
  @routing_numbers = Increase::Resources::RoutingNumbers.new(client: self)
  @external_accounts = Increase::Resources::ExternalAccounts.new(client: self)
  @entities = Increase::Resources::Entities.new(client: self)
  @supplemental_documents = Increase::Resources::SupplementalDocuments.new(client: self)
  @programs = Increase::Resources::Programs.new(client: self)
  @account_statements = Increase::Resources::AccountStatements.new(client: self)
  @files = Increase::Resources::Files.new(client: self)
  @file_links = Increase::Resources::FileLinks.new(client: self)
  @documents = Increase::Resources::Documents.new(client: self)
  @exports = Increase::Resources::Exports.new(client: self)
  @events = Increase::Resources::Events.new(client: self)
  @event_subscriptions = Increase::Resources::EventSubscriptions.new(client: self)
  @real_time_decisions = Increase::Resources::RealTimeDecisions.new(client: self)
  @bookkeeping_accounts = Increase::Resources::BookkeepingAccounts.new(client: self)
  @bookkeeping_entry_sets = Increase::Resources::BookkeepingEntrySets.new(client: self)
  @bookkeeping_entries = Increase::Resources::BookkeepingEntries.new(client: self)
  @groups = Increase::Resources::Groups.new(client: self)
  @oauth_applications = Increase::Resources::OAuthApplications.new(client: self)
  @oauth_connections = Increase::Resources::OAuthConnections.new(client: self)
  @oauth_tokens = Increase::Resources::OAuthTokens.new(client: self)
  @intrafi_account_enrollments = Increase::Resources::IntrafiAccountEnrollments.new(client: self)
  @intrafi_balances = Increase::Resources::IntrafiBalances.new(client: self)
  @intrafi_exclusions = Increase::Resources::IntrafiExclusions.new(client: self)
  @card_tokens = Increase::Resources::CardTokens.new(client: self)
  @card_push_transfers = Increase::Resources::CardPushTransfers.new(client: self)
  @card_validations = Increase::Resources::CardValidations.new(client: self)
  @simulations = Increase::Resources::Simulations.new(client: self)
end

Instance Attribute Details

#account_numbersIncrease::Resources::AccountNumbers (readonly)



30
31
32
# File 'lib/increase/client.rb', line 30

def 
  @account_numbers
end

#account_statementsIncrease::Resources::AccountStatements (readonly)



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

def 
  @account_statements
end

#account_transfersIncrease::Resources::AccountTransfers (readonly)



33
34
35
# File 'lib/increase/client.rb', line 33

def 
  @account_transfers
end

#accountsIncrease::Resources::Accounts (readonly)



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

def accounts
  @accounts
end

#ach_prenotificationsIncrease::Resources::ACHPrenotifications (readonly)



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

def ach_prenotifications
  @ach_prenotifications
end

#ach_transfersIncrease::Resources::ACHTransfers (readonly)



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

def ach_transfers
  @ach_transfers
end

#api_keyString (readonly)

Returns:

  • (String)


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

def api_key
  @api_key
end

#bookkeeping_accountsIncrease::Resources::BookkeepingAccounts (readonly)



156
157
158
# File 'lib/increase/client.rb', line 156

def bookkeeping_accounts
  @bookkeeping_accounts
end

#bookkeeping_entriesIncrease::Resources::BookkeepingEntries (readonly)



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

def bookkeeping_entries
  @bookkeeping_entries
end

#bookkeeping_entry_setsIncrease::Resources::BookkeepingEntrySets (readonly)



159
160
161
# File 'lib/increase/client.rb', line 159

def bookkeeping_entry_sets
  @bookkeeping_entry_sets
end

#card_disputesIncrease::Resources::CardDisputes (readonly)



45
46
47
# File 'lib/increase/client.rb', line 45

def card_disputes
  @card_disputes
end

#card_paymentsIncrease::Resources::CardPayments (readonly)



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

def card_payments
  @card_payments
end

#card_purchase_supplementsIncrease::Resources::CardPurchaseSupplements (readonly)



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

def card_purchase_supplements
  @card_purchase_supplements
end

#card_push_transfersIncrease::Resources::CardPushTransfers (readonly)



189
190
191
# File 'lib/increase/client.rb', line 189

def card_push_transfers
  @card_push_transfers
end

#card_tokensIncrease::Resources::CardTokens (readonly)



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

def card_tokens
  @card_tokens
end

#card_validationsIncrease::Resources::CardValidations (readonly)



192
193
194
# File 'lib/increase/client.rb', line 192

def card_validations
  @card_validations
end

#cardsIncrease::Resources::Cards (readonly)



36
37
38
# File 'lib/increase/client.rb', line 36

def cards
  @cards
end

#check_depositsIncrease::Resources::CheckDeposits (readonly)



108
109
110
# File 'lib/increase/client.rb', line 108

def check_deposits
  @check_deposits
end

#check_transfersIncrease::Resources::CheckTransfers (readonly)



90
91
92
# File 'lib/increase/client.rb', line 90

def check_transfers
  @check_transfers
end

#declined_transactionsIncrease::Resources::DeclinedTransactions (readonly)



66
67
68
# File 'lib/increase/client.rb', line 66

def declined_transactions
  @declined_transactions
end

#digital_card_profilesIncrease::Resources::DigitalCardProfiles (readonly)



51
52
53
# File 'lib/increase/client.rb', line 51

def digital_card_profiles
  @digital_card_profiles
end

#digital_wallet_tokensIncrease::Resources::DigitalWalletTokens (readonly)



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

def digital_wallet_tokens
  @digital_wallet_tokens
end

#documentsIncrease::Resources::Documents (readonly)



141
142
143
# File 'lib/increase/client.rb', line 141

def documents
  @documents
end

#entitiesIncrease::Resources::Entities (readonly)



123
124
125
# File 'lib/increase/client.rb', line 123

def entities
  @entities
end

#event_subscriptionsIncrease::Resources::EventSubscriptions (readonly)



150
151
152
# File 'lib/increase/client.rb', line 150

def event_subscriptions
  @event_subscriptions
end

#eventsIncrease::Resources::Events (readonly)



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

def events
  @events
end

#exportsIncrease::Resources::Exports (readonly)



144
145
146
# File 'lib/increase/client.rb', line 144

def exports
  @exports
end

#external_accountsIncrease::Resources::ExternalAccounts (readonly)



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

def external_accounts
  @external_accounts
end

#fednow_transfersIncrease::Resources::FednowTransfers (readonly)



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

def fednow_transfers
  @fednow_transfers
end


138
139
140
# File 'lib/increase/client.rb', line 138

def file_links
  @file_links
end

#filesIncrease::Resources::Files (readonly)



135
136
137
# File 'lib/increase/client.rb', line 135

def files
  @files
end

#groupsIncrease::Resources::Groups (readonly)



165
166
167
# File 'lib/increase/client.rb', line 165

def groups
  @groups
end

#inbound_ach_transfersIncrease::Resources::InboundACHTransfers (readonly)



75
76
77
# File 'lib/increase/client.rb', line 75

def inbound_ach_transfers
  @inbound_ach_transfers
end

#inbound_check_depositsIncrease::Resources::InboundCheckDeposits (readonly)



93
94
95
# File 'lib/increase/client.rb', line 93

def inbound_check_deposits
  @inbound_check_deposits
end

#inbound_fednow_transfersIncrease::Resources::InboundFednowTransfers (readonly)



105
106
107
# File 'lib/increase/client.rb', line 105

def inbound_fednow_transfers
  @inbound_fednow_transfers
end

#inbound_mail_itemsIncrease::Resources::InboundMailItems (readonly)



114
115
116
# File 'lib/increase/client.rb', line 114

def inbound_mail_items
  @inbound_mail_items
end

#inbound_real_time_payments_transfersIncrease::Resources::InboundRealTimePaymentsTransfers (readonly)



99
100
101
# File 'lib/increase/client.rb', line 99

def inbound_real_time_payments_transfers
  @inbound_real_time_payments_transfers
end

#inbound_wire_drawdown_requestsIncrease::Resources::InboundWireDrawdownRequests (readonly)



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

def inbound_wire_drawdown_requests
  @inbound_wire_drawdown_requests
end

#inbound_wire_transfersIncrease::Resources::InboundWireTransfers (readonly)



81
82
83
# File 'lib/increase/client.rb', line 81

def inbound_wire_transfers
  @inbound_wire_transfers
end

#intrafi_account_enrollmentsIncrease::Resources::IntrafiAccountEnrollments (readonly)



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

def 
  @intrafi_account_enrollments
end

#intrafi_balancesIncrease::Resources::IntrafiBalances (readonly)



180
181
182
# File 'lib/increase/client.rb', line 180

def intrafi_balances
  @intrafi_balances
end

#intrafi_exclusionsIncrease::Resources::IntrafiExclusions (readonly)



183
184
185
# File 'lib/increase/client.rb', line 183

def intrafi_exclusions
  @intrafi_exclusions
end

#lockboxesIncrease::Resources::Lockboxes (readonly)



111
112
113
# File 'lib/increase/client.rb', line 111

def lockboxes
  @lockboxes
end

#oauth_applicationsIncrease::Resources::OAuthApplications (readonly)



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

def oauth_applications
  @oauth_applications
end

#oauth_connectionsIncrease::Resources::OAuthConnections (readonly)



171
172
173
# File 'lib/increase/client.rb', line 171

def oauth_connections
  @oauth_connections
end

#oauth_tokensIncrease::Resources::OAuthTokens (readonly)



174
175
176
# File 'lib/increase/client.rb', line 174

def oauth_tokens
  @oauth_tokens
end

#pending_transactionsIncrease::Resources::PendingTransactions (readonly)



63
64
65
# File 'lib/increase/client.rb', line 63

def pending_transactions
  @pending_transactions
end

#physical_card_profilesIncrease::Resources::PhysicalCardProfiles (readonly)



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

def physical_card_profiles
  @physical_card_profiles
end

#physical_cardsIncrease::Resources::PhysicalCards (readonly)



48
49
50
# File 'lib/increase/client.rb', line 48

def physical_cards
  @physical_cards
end

#programsIncrease::Resources::Programs (readonly)



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

def programs
  @programs
end

#real_time_decisionsIncrease::Resources::RealTimeDecisions (readonly)



153
154
155
# File 'lib/increase/client.rb', line 153

def real_time_decisions
  @real_time_decisions
end

#real_time_payments_transfersIncrease::Resources::RealTimePaymentsTransfers (readonly)



96
97
98
# File 'lib/increase/client.rb', line 96

def real_time_payments_transfers
  @real_time_payments_transfers
end

#routing_numbersIncrease::Resources::RoutingNumbers (readonly)



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

def routing_numbers
  @routing_numbers
end

#simulationsIncrease::Resources::Simulations (readonly)



195
196
197
# File 'lib/increase/client.rb', line 195

def simulations
  @simulations
end

#supplemental_documentsIncrease::Resources::SupplementalDocuments (readonly)



126
127
128
# File 'lib/increase/client.rb', line 126

def supplemental_documents
  @supplemental_documents
end

#transactionsIncrease::Resources::Transactions (readonly)



60
61
62
# File 'lib/increase/client.rb', line 60

def transactions
  @transactions
end

#wire_drawdown_requestsIncrease::Resources::WireDrawdownRequests (readonly)



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

def wire_drawdown_requests
  @wire_drawdown_requests
end

#wire_transfersIncrease::Resources::WireTransfers (readonly)



78
79
80
# File 'lib/increase/client.rb', line 78

def wire_transfers
  @wire_transfers
end