Class: Increase::Client

Inherits:
BaseClient
  • Object
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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment: nil, base_url: nil, api_key: nil, max_retries: nil) ⇒ Client

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



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/increase/client.rb', line 173

def initialize(environment: nil, base_url: nil, api_key: nil, max_retries: nil)
  environments = {"production" => "https://api.increase.com", "sandbox" => "https://sandbox.increase.com"}
  if environment && base_url
    raise ArgumentError, "both environment and base_url given, expected only one"
  elsif environment
    if !environments.key?(environment.to_s)
      raise ArgumentError, "environment must be one of #{environments.keys}, got #{environment}"
    end
    base_url = environments[environment.to_s]
  elsif !base_url
    base_url = "https://api.increase.com"
  end

  max_retries ||= DEFAULT_MAX_RETRIES
  idempotency_header = "Idempotency-Key"

  @api_key = [api_key, ENV["INCREASE_API_KEY"]].find { |v| !v.nil? }
  if @api_key.nil?
    raise ArgumentError, "api_key is required"
  end

  super(base_url: base_url, max_retries: max_retries, idempotency_header: idempotency_header)

  @accounts = Increase::Resources::Accounts.new(client: self)
  @account_numbers = Increase::Resources::AccountNumbers.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)
  @account_transfers = Increase::Resources::AccountTransfers.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)
  @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)
  @proof_of_authorization_requests = Increase::Resources::ProofOfAuthorizationRequests.new(client: self)
  @proof_of_authorization_request_submissions = Increase::Resources::ProofOfAuthorizationRequestSubmissions.new(client: self)
  @account_statements = Increase::Resources::AccountStatements.new(client: self)
  @files = Increase::Resources::Files.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_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)
  @real_time_payments_request_for_payments = Increase::Resources::RealTimePaymentsRequestForPayments.new(client: self)
  @simulations = Increase::Resources::Simulations.new(client: self)
end

Instance Attribute Details

#account_numbersIncrease::Resources::AccountNumbers (readonly)



15
16
17
# File 'lib/increase/client.rb', line 15

def 
  @account_numbers
end

#account_statementsIncrease::Resources::AccountStatements (readonly)



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

def 
  @account_statements
end

#account_transfersIncrease::Resources::AccountTransfers (readonly)



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

def 
  @account_transfers
end

#accountsIncrease::Resources::Accounts (readonly)



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

def accounts
  @accounts
end

#ach_prenotificationsIncrease::Resources::ACHPrenotifications (readonly)



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

def ach_prenotifications
  @ach_prenotifications
end

#ach_transfersIncrease::Resources::ACHTransfers (readonly)



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

def ach_transfers
  @ach_transfers
end

#api_keyObject (readonly)

Client options.



9
10
11
# File 'lib/increase/client.rb', line 9

def api_key
  @api_key
end

#bookkeeping_accountsIncrease::Resources::BookkeepingAccounts (readonly)



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

def bookkeeping_accounts
  @bookkeeping_accounts
end

#bookkeeping_entriesIncrease::Resources::BookkeepingEntries (readonly)



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

def bookkeeping_entries
  @bookkeeping_entries
end

#bookkeeping_entry_setsIncrease::Resources::BookkeepingEntrySets (readonly)



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

def bookkeeping_entry_sets
  @bookkeeping_entry_sets
end

#card_disputesIncrease::Resources::CardDisputes (readonly)



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

def card_disputes
  @card_disputes
end

#card_paymentsIncrease::Resources::CardPayments (readonly)



21
22
23
# File 'lib/increase/client.rb', line 21

def card_payments
  @card_payments
end

#card_purchase_supplementsIncrease::Resources::CardPurchaseSupplements (readonly)



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

def card_purchase_supplements
  @card_purchase_supplements
end

#cardsIncrease::Resources::Cards (readonly)



18
19
20
# File 'lib/increase/client.rb', line 18

def cards
  @cards
end

#check_depositsIncrease::Resources::CheckDeposits (readonly)



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

def check_deposits
  @check_deposits
end

#check_transfersIncrease::Resources::CheckTransfers (readonly)



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

def check_transfers
  @check_transfers
end

#declined_transactionsIncrease::Resources::DeclinedTransactions (readonly)



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

def declined_transactions
  @declined_transactions
end

#digital_card_profilesIncrease::Resources::DigitalCardProfiles (readonly)



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

def digital_card_profiles
  @digital_card_profiles
end

#digital_wallet_tokensIncrease::Resources::DigitalWalletTokens (readonly)



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

def digital_wallet_tokens
  @digital_wallet_tokens
end

#documentsIncrease::Resources::Documents (readonly)



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

def documents
  @documents
end

#entitiesIncrease::Resources::Entities (readonly)



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

def entities
  @entities
end

#event_subscriptionsIncrease::Resources::EventSubscriptions (readonly)



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

def event_subscriptions
  @event_subscriptions
end

#eventsIncrease::Resources::Events (readonly)



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

def events
  @events
end

#exportsIncrease::Resources::Exports (readonly)



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

def exports
  @exports
end

#external_accountsIncrease::Resources::ExternalAccounts (readonly)



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

def external_accounts
  @external_accounts
end

#filesIncrease::Resources::Files (readonly)



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

def files
  @files
end

#groupsIncrease::Resources::Groups (readonly)



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

def groups
  @groups
end

#inbound_ach_transfersIncrease::Resources::InboundACHTransfers (readonly)



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

def inbound_ach_transfers
  @inbound_ach_transfers
end

#inbound_check_depositsIncrease::Resources::InboundCheckDeposits (readonly)



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

def inbound_check_deposits
  @inbound_check_deposits
end

#inbound_mail_itemsIncrease::Resources::InboundMailItems (readonly)



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

def inbound_mail_items
  @inbound_mail_items
end

#inbound_wire_drawdown_requestsIncrease::Resources::InboundWireDrawdownRequests (readonly)



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

def inbound_wire_drawdown_requests
  @inbound_wire_drawdown_requests
end

#inbound_wire_transfersIncrease::Resources::InboundWireTransfers (readonly)



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

def inbound_wire_transfers
  @inbound_wire_transfers
end

#intrafi_account_enrollmentsIncrease::Resources::IntrafiAccountEnrollments (readonly)



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

def 
  @intrafi_account_enrollments
end

#intrafi_balancesIncrease::Resources::IntrafiBalances (readonly)



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

def intrafi_balances
  @intrafi_balances
end

#intrafi_exclusionsIncrease::Resources::IntrafiExclusions (readonly)



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

def intrafi_exclusions
  @intrafi_exclusions
end

#lockboxesIncrease::Resources::Lockboxes (readonly)



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

def lockboxes
  @lockboxes
end

#oauth_connectionsIncrease::Resources::OAuthConnections (readonly)



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

def oauth_connections
  @oauth_connections
end

#oauth_tokensIncrease::Resources::OAuthTokens (readonly)



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

def oauth_tokens
  @oauth_tokens
end

#pending_transactionsIncrease::Resources::PendingTransactions (readonly)



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

def pending_transactions
  @pending_transactions
end

#physical_card_profilesIncrease::Resources::PhysicalCardProfiles (readonly)



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

def physical_card_profiles
  @physical_card_profiles
end

#physical_cardsIncrease::Resources::PhysicalCards (readonly)



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

def physical_cards
  @physical_cards
end

#programsIncrease::Resources::Programs (readonly)



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

def programs
  @programs
end

#proof_of_authorization_request_submissionsIncrease::Resources::ProofOfAuthorizationRequestSubmissions (readonly)



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

def proof_of_authorization_request_submissions
  @proof_of_authorization_request_submissions
end

#proof_of_authorization_requestsIncrease::Resources::ProofOfAuthorizationRequests (readonly)



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

def proof_of_authorization_requests
  @proof_of_authorization_requests
end

#real_time_decisionsIncrease::Resources::RealTimeDecisions (readonly)



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

def real_time_decisions
  @real_time_decisions
end

#real_time_payments_request_for_paymentsIncrease::Resources::RealTimePaymentsRequestForPayments (readonly)



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

def real_time_payments_request_for_payments
  @real_time_payments_request_for_payments
end

#real_time_payments_transfersIncrease::Resources::RealTimePaymentsTransfers (readonly)



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

def real_time_payments_transfers
  @real_time_payments_transfers
end

#routing_numbersIncrease::Resources::RoutingNumbers (readonly)



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

def routing_numbers
  @routing_numbers
end

#simulationsIncrease::Resources::Simulations (readonly)



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

def simulations
  @simulations
end

#supplemental_documentsIncrease::Resources::SupplementalDocuments (readonly)



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

def supplemental_documents
  @supplemental_documents
end

#transactionsIncrease::Resources::Transactions (readonly)



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

def transactions
  @transactions
end

#wire_drawdown_requestsIncrease::Resources::WireDrawdownRequests (readonly)



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

def wire_drawdown_requests
  @wire_drawdown_requests
end

#wire_transfersIncrease::Resources::WireTransfers (readonly)



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

def wire_transfers
  @wire_transfers
end