Class: Yoomoney::Client
- Inherits:
-
Internal::Transport::BaseClient
- Object
- Internal::Transport::BaseClient
- Yoomoney::Client
- Defined in:
- lib/yoomoney/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
Constants inherited from Internal::Transport::BaseClient
Internal::Transport::BaseClient::MAX_REDIRECTS, Internal::Transport::BaseClient::PLATFORM_HEADERS
Instance Attribute Summary collapse
- #deals ⇒ Yoomoney::Resources::Deals readonly
- #invoices ⇒ Yoomoney::Resources::Invoices readonly
- #me ⇒ Yoomoney::Resources::Me readonly
-
#password ⇒ String?
readonly
HTTP Basic аутентификация клиента ЮKassa.
- #payment_methods ⇒ Yoomoney::Resources::PaymentMethods readonly
- #payments ⇒ Yoomoney::Resources::Payments readonly
- #payouts ⇒ Yoomoney::Resources::Payouts readonly
- #personal_data ⇒ Yoomoney::Resources::PersonalData readonly
- #receipts ⇒ Yoomoney::Resources::Receipts readonly
- #refunds ⇒ Yoomoney::Resources::Refunds readonly
- #sbp_banks ⇒ Yoomoney::Resources::SbpBanks readonly
-
#username ⇒ String?
readonly
HTTP Basic аутентификация клиента ЮKassa.
- #webhooks ⇒ Yoomoney::Resources::Webhooks readonly
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
-
#initialize(username: ENV["YOOMONEY_USERNAME"], password: ENV["YOOMONEY_PASSWORD"], base_url: ENV["YOOMONEY_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
constructor
Creates and returns a new client for interacting with the API.
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(username: ENV["YOOMONEY_USERNAME"], password: ENV["YOOMONEY_PASSWORD"], base_url: ENV["YOOMONEY_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.
‘“api.example.com/v2/”`. Defaults to `ENV`
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/yoomoney/client.rb', line 75 def initialize( username: ENV["YOOMONEY_USERNAME"], password: ENV["YOOMONEY_PASSWORD"], base_url: ENV["YOOMONEY_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 ||= "https://api.yookassa.ru/v3" @username = username&.to_s @password = password&.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 ) @payments = Yoomoney::Resources::Payments.new(client: self) @payment_methods = Yoomoney::Resources::PaymentMethods.new(client: self) @invoices = Yoomoney::Resources::Invoices.new(client: self) @refunds = Yoomoney::Resources::Refunds.new(client: self) @receipts = Yoomoney::Resources::Receipts.new(client: self) @deals = Yoomoney::Resources::Deals.new(client: self) @payouts = Yoomoney::Resources::Payouts.new(client: self) @sbp_banks = Yoomoney::Resources::SbpBanks.new(client: self) @personal_data = Yoomoney::Resources::PersonalData.new(client: self) @webhooks = Yoomoney::Resources::Webhooks.new(client: self) @me = Yoomoney::Resources::Me.new(client: self) end |
Instance Attribute Details
#deals ⇒ Yoomoney::Resources::Deals (readonly)
42 43 44 |
# File 'lib/yoomoney/client.rb', line 42 def deals @deals end |
#invoices ⇒ Yoomoney::Resources::Invoices (readonly)
33 34 35 |
# File 'lib/yoomoney/client.rb', line 33 def invoices @invoices end |
#me ⇒ Yoomoney::Resources::Me (readonly)
57 58 59 |
# File 'lib/yoomoney/client.rb', line 57 def me @me end |
#password ⇒ String? (readonly)
HTTP Basic аутентификация клиента ЮKassa
24 25 26 |
# File 'lib/yoomoney/client.rb', line 24 def password @password end |
#payment_methods ⇒ Yoomoney::Resources::PaymentMethods (readonly)
30 31 32 |
# File 'lib/yoomoney/client.rb', line 30 def payment_methods @payment_methods end |
#payments ⇒ Yoomoney::Resources::Payments (readonly)
27 28 29 |
# File 'lib/yoomoney/client.rb', line 27 def payments @payments end |
#payouts ⇒ Yoomoney::Resources::Payouts (readonly)
45 46 47 |
# File 'lib/yoomoney/client.rb', line 45 def payouts @payouts end |
#personal_data ⇒ Yoomoney::Resources::PersonalData (readonly)
51 52 53 |
# File 'lib/yoomoney/client.rb', line 51 def personal_data @personal_data end |
#receipts ⇒ Yoomoney::Resources::Receipts (readonly)
39 40 41 |
# File 'lib/yoomoney/client.rb', line 39 def receipts @receipts end |
#refunds ⇒ Yoomoney::Resources::Refunds (readonly)
36 37 38 |
# File 'lib/yoomoney/client.rb', line 36 def refunds @refunds end |
#sbp_banks ⇒ Yoomoney::Resources::SbpBanks (readonly)
48 49 50 |
# File 'lib/yoomoney/client.rb', line 48 def sbp_banks @sbp_banks end |
#username ⇒ String? (readonly)
HTTP Basic аутентификация клиента ЮKassa
20 21 22 |
# File 'lib/yoomoney/client.rb', line 20 def username @username end |
#webhooks ⇒ Yoomoney::Resources::Webhooks (readonly)
54 55 56 |
# File 'lib/yoomoney/client.rb', line 54 def webhooks @webhooks end |