Class: Lithic::Client
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.lithic.com", sandbox: "https://sandbox.lithic.com"}
Internal::Transport::BaseClient::MAX_REDIRECTS, Internal::Transport::BaseClient::PLATFORM_HEADERS
Instance Attribute Summary collapse
#base_url, #headers, #idempotency_header, #initial_retry_delay, #max_retries, #max_retry_delay, #requester, #timeout
Instance Method Summary
collapse
follow_redirect, #inspect, reap_connection!, #request, #send_request, should_retry?, validate!
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type
Constructor Details
#initialize(api_key: ENV["LITHIC_API_KEY"], environment: nil, base_url: ENV["LITHIC_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) ⇒ 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`
166
167
168
169
170
171
172
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
|
# File 'lib/lithic/client.rb', line 166
def initialize(
api_key: ENV["LITHIC_API_KEY"],
environment: nil,
base_url: ENV["LITHIC_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
)
base_url ||= Lithic::Client::ENVIRONMENTS.fetch(environment&.to_sym || :production) do
message = "environment must be one of #{Lithic::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: \"LITHIC_API_KEY\"")
end
= {
"x-lithic-pagination" => "cursor"
}
@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,
headers:
)
@accounts = Lithic::Resources::Accounts.new(client: self)
@account_holders = Lithic::Resources::AccountHolders.new(client: self)
@auth_rules = Lithic::Resources::AuthRules.new(client: self)
@auth_stream_enrollment = Lithic::Resources::AuthStreamEnrollment.new(client: self)
@tokenization_decisioning = Lithic::Resources::TokenizationDecisioning.new(client: self)
@tokenizations = Lithic::Resources::Tokenizations.new(client: self)
@cards = Lithic::Resources::Cards.new(client: self)
@card_bulk_orders = Lithic::Resources::CardBulkOrders.new(client: self)
@balances = Lithic::Resources::Balances.new(client: self)
@aggregate_balances = Lithic::Resources::AggregateBalances.new(client: self)
@disputes = Lithic::Resources::Disputes.new(client: self)
@disputes_v2 = Lithic::Resources::DisputesV2.new(client: self)
@events = Lithic::Resources::Events.new(client: self)
@transfers = Lithic::Resources::Transfers.new(client: self)
@financial_accounts = Lithic::Resources::FinancialAccounts.new(client: self)
@transactions = Lithic::Resources::Transactions.new(client: self)
@responder_endpoints = Lithic::Resources::ResponderEndpoints.new(client: self)
@external_bank_accounts = Lithic::Resources::ExternalBankAccounts.new(client: self)
@payments = Lithic::Resources::Payments.new(client: self)
@three_ds = Lithic::Resources::ThreeDS.new(client: self)
@reports = Lithic::Resources::Reports.new(client: self)
@card_programs = Lithic::Resources::CardPrograms.new(client: self)
@digital_card_art = Lithic::Resources::DigitalCardArt.new(client: self)
@book_transfers = Lithic::Resources::BookTransfers.new(client: self)
@credit_products = Lithic::Resources::CreditProducts.new(client: self)
@external_payments = Lithic::Resources::ExternalPayments.new(client: self)
@management_operations = Lithic::Resources::ManagementOperations.new(client: self)
@internal_transaction = Lithic::Resources::InternalTransaction.new(client: self)
@funding_events = Lithic::Resources::FundingEvents.new(client: self)
@fraud = Lithic::Resources::Fraud.new(client: self)
@network_programs = Lithic::Resources::NetworkPrograms.new(client: self)
@account_activity = Lithic::Resources::AccountActivity.new(client: self)
@webhooks = Lithic::Resources::Webhooks.new(client: self)
end
|
Instance Attribute Details
120
121
122
|
# File 'lib/lithic/client.rb', line 120
def account_activity
@account_activity
end
|
30
31
32
|
# File 'lib/lithic/client.rb', line 30
def account_holders
@account_holders
end
|
27
28
29
|
# File 'lib/lithic/client.rb', line 27
def accounts
@accounts
end
|
54
55
56
|
# File 'lib/lithic/client.rb', line 54
def aggregate_balances
@aggregate_balances
end
|
#api_key ⇒ String
24
25
26
|
# File 'lib/lithic/client.rb', line 24
def api_key
@api_key
end
|
33
34
35
|
# File 'lib/lithic/client.rb', line 33
def auth_rules
@auth_rules
end
|
36
37
38
|
# File 'lib/lithic/client.rb', line 36
def auth_stream_enrollment
@auth_stream_enrollment
end
|
51
52
53
|
# File 'lib/lithic/client.rb', line 51
def balances
@balances
end
|
96
97
98
|
# File 'lib/lithic/client.rb', line 96
def book_transfers
@book_transfers
end
|
48
49
50
|
# File 'lib/lithic/client.rb', line 48
def card_bulk_orders
@card_bulk_orders
end
|
90
91
92
|
# File 'lib/lithic/client.rb', line 90
def card_programs
@card_programs
end
|
45
46
47
|
# File 'lib/lithic/client.rb', line 45
def cards
@cards
end
|
99
100
101
|
# File 'lib/lithic/client.rb', line 99
def credit_products
@credit_products
end
|
93
94
95
|
# File 'lib/lithic/client.rb', line 93
def digital_card_art
@digital_card_art
end
|
57
58
59
|
# File 'lib/lithic/client.rb', line 57
def disputes
@disputes
end
|
60
61
62
|
# File 'lib/lithic/client.rb', line 60
def disputes_v2
@disputes_v2
end
|
63
64
65
|
# File 'lib/lithic/client.rb', line 63
def events
@events
end
|
78
79
80
|
# File 'lib/lithic/client.rb', line 78
def external_bank_accounts
@external_bank_accounts
end
|
102
103
104
|
# File 'lib/lithic/client.rb', line 102
def external_payments
@external_payments
end
|
69
70
71
|
# File 'lib/lithic/client.rb', line 69
def financial_accounts
@financial_accounts
end
|
114
115
116
|
# File 'lib/lithic/client.rb', line 114
def fraud
@fraud
end
|
111
112
113
|
# File 'lib/lithic/client.rb', line 111
def funding_events
@funding_events
end
|
108
109
110
|
# File 'lib/lithic/client.rb', line 108
def internal_transaction
@internal_transaction
end
|
105
106
107
|
# File 'lib/lithic/client.rb', line 105
def management_operations
@management_operations
end
|
117
118
119
|
# File 'lib/lithic/client.rb', line 117
def network_programs
@network_programs
end
|
81
82
83
|
# File 'lib/lithic/client.rb', line 81
def payments
@payments
end
|
87
88
89
|
# File 'lib/lithic/client.rb', line 87
def reports
@reports
end
|
75
76
77
|
# File 'lib/lithic/client.rb', line 75
def responder_endpoints
@responder_endpoints
end
|
84
85
86
|
# File 'lib/lithic/client.rb', line 84
def three_ds
@three_ds
end
|
39
40
41
|
# File 'lib/lithic/client.rb', line 39
def tokenization_decisioning
@tokenization_decisioning
end
|
42
43
44
|
# File 'lib/lithic/client.rb', line 42
def tokenizations
@tokenizations
end
|
72
73
74
|
# File 'lib/lithic/client.rb', line 72
def transactions
@transactions
end
|
66
67
68
|
# File 'lib/lithic/client.rb', line 66
def transfers
@transfers
end
|
123
124
125
|
# File 'lib/lithic/client.rb', line 123
def webhooks
@webhooks
end
|
Instance Method Details
134
135
136
|
# File 'lib/lithic/client.rb', line 134
def api_status(params = {})
request(method: :get, path: "v1/status", model: Lithic::APIStatus, options: params[:request_options])
end
|