Class: EasyLabs::Client
- Inherits:
-
Object
- Object
- EasyLabs::Client
- Defined in:
- lib/easylabs/client.rb
Overview
Entry point for the SDK. Construct one and access resources through the namespace methods (e.g. ‘client.customers.create(…)`).
Instance Attribute Summary collapse
-
#api_url ⇒ String
readonly
Resolved API base URL.
-
#basis_theory_public_api_key ⇒ String
readonly
BasisTheory public api key returned by /validate-key.
- #http ⇒ Object readonly private
Instance Method Summary collapse
- #analytics ⇒ Object
- #authorizations ⇒ Object
- #checkout ⇒ Object
- #compliance_forms ⇒ Object
- #coupons ⇒ Object
- #customers ⇒ Object
- #disputes ⇒ Object
- #dunning_config ⇒ Object
- #embedded_checkout ⇒ Object
-
#initialize(api_key:, dev: false, internal_api_url: nil) ⇒ Client
constructor
A new instance of Client.
- #invoices ⇒ Object
- #orders ⇒ Object
- #payment_instruments ⇒ Object
- #payment_links ⇒ Object
- #product_prices ⇒ Object
- #products ⇒ Object
- #promotion_codes ⇒ Object
- #revenue_recovery_automations ⇒ Object
- #settlements ⇒ Object
- #subscriptions ⇒ Object
- #transfers ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(api_key:, dev: false, internal_api_url: nil) ⇒ Client
Returns a new instance of Client.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/easylabs/client.rb', line 47 def initialize(api_key:, dev: false, internal_api_url: nil) raise ArgumentError, "api_key is required" if api_key.nil? || api_key.empty? @api_key = api_key @api_url = internal_api_url || ApiUrl.resolve(api_key: api_key, dev: dev) raise ArgumentError, "Invalid API URL. Please check your configuration." if @api_url.nil? || @api_url.empty? @http = HTTP.new(api_url: @api_url, api_key: @api_key) @basis_theory_public_api_key = Util.validate_api_key(api_key: @api_key, api_url: @api_url) end |
Instance Attribute Details
#api_url ⇒ String (readonly)
Returns resolved API base URL.
40 41 42 |
# File 'lib/easylabs/client.rb', line 40 def api_url @api_url end |
#basis_theory_public_api_key ⇒ String (readonly)
Returns BasisTheory public api key returned by /validate-key.
42 43 44 |
# File 'lib/easylabs/client.rb', line 42 def basis_theory_public_api_key @basis_theory_public_api_key end |
#http ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
59 60 61 |
# File 'lib/easylabs/client.rb', line 59 def http @http end |
Instance Method Details
#analytics ⇒ Object
129 130 131 |
# File 'lib/easylabs/client.rb', line 129 def analytics @analytics ||= Resources::Analytics.new(@http) end |
#authorizations ⇒ Object
125 126 127 |
# File 'lib/easylabs/client.rb', line 125 def @authorizations ||= Resources::Authorizations.new(@http) end |
#checkout ⇒ Object
97 98 99 |
# File 'lib/easylabs/client.rb', line 97 def checkout @checkout ||= Resources::Checkout.new(@http) end |
#compliance_forms ⇒ Object
133 134 135 |
# File 'lib/easylabs/client.rb', line 133 def compliance_forms @compliance_forms ||= Resources::ComplianceForms.new(@http) end |
#coupons ⇒ Object
117 118 119 |
# File 'lib/easylabs/client.rb', line 117 def coupons @coupons ||= Resources::Coupons.new(@http) end |
#customers ⇒ Object
61 62 63 |
# File 'lib/easylabs/client.rb', line 61 def customers @customers ||= Resources::Customers.new(@http) end |
#disputes ⇒ Object
73 74 75 |
# File 'lib/easylabs/client.rb', line 73 def disputes @disputes ||= Resources::Disputes.new(@http) end |
#dunning_config ⇒ Object
137 138 139 |
# File 'lib/easylabs/client.rb', line 137 def dunning_config @dunning_config ||= Resources::DunningConfig.new(@http) end |
#embedded_checkout ⇒ Object
105 106 107 |
# File 'lib/easylabs/client.rb', line 105 def @embedded_checkout ||= Resources::EmbeddedCheckout.new(@http) end |
#invoices ⇒ Object
113 114 115 |
# File 'lib/easylabs/client.rb', line 113 def invoices @invoices ||= Resources::Invoices.new(@http) end |
#orders ⇒ Object
89 90 91 |
# File 'lib/easylabs/client.rb', line 89 def orders @orders ||= Resources::Orders.new(@http) end |
#payment_instruments ⇒ Object
65 66 67 |
# File 'lib/easylabs/client.rb', line 65 def payment_instruments @payment_instruments ||= Resources::PaymentInstruments.new(@http) end |
#payment_links ⇒ Object
101 102 103 |
# File 'lib/easylabs/client.rb', line 101 def payment_links @payment_links ||= Resources::PaymentLinks.new(@http) end |
#product_prices ⇒ Object
85 86 87 |
# File 'lib/easylabs/client.rb', line 85 def product_prices @product_prices ||= Resources::ProductPrices.new(@http) end |
#products ⇒ Object
81 82 83 |
# File 'lib/easylabs/client.rb', line 81 def products @products ||= Resources::Products.new(@http) end |
#promotion_codes ⇒ Object
121 122 123 |
# File 'lib/easylabs/client.rb', line 121 def promotion_codes @promotion_codes ||= Resources::PromotionCodes.new(@http) end |
#revenue_recovery_automations ⇒ Object
141 142 143 |
# File 'lib/easylabs/client.rb', line 141 def revenue_recovery_automations @revenue_recovery_automations ||= Resources::RevenueRecoveryAutomations.new(@http) end |
#settlements ⇒ Object
77 78 79 |
# File 'lib/easylabs/client.rb', line 77 def settlements @settlements ||= Resources::Settlements.new(@http) end |
#subscriptions ⇒ Object
93 94 95 |
# File 'lib/easylabs/client.rb', line 93 def subscriptions @subscriptions ||= Resources::Subscriptions.new(@http) end |
#transfers ⇒ Object
69 70 71 |
# File 'lib/easylabs/client.rb', line 69 def transfers @transfers ||= Resources::Transfers.new(@http) end |
#webhooks ⇒ Object
109 110 111 |
# File 'lib/easylabs/client.rb', line 109 def webhooks @webhooks ||= Resources::WebhooksManagement.new(@http) end |