Class: Lago::Api::Client
- Inherits:
-
Object
- Object
- Lago::Api::Client
- Defined in:
- lib/lago/api/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#ingest_api_url ⇒ Object
readonly
Returns the value of attribute ingest_api_url.
-
#max_retries ⇒ Object
readonly
Returns the value of attribute max_retries.
-
#on_rate_limit_info ⇒ Object
readonly
Returns the value of attribute on_rate_limit_info.
-
#retry_on_rate_limit ⇒ Object
readonly
Returns the value of attribute retry_on_rate_limit.
-
#use_ingest_service ⇒ Object
readonly
Returns the value of attribute use_ingest_service.
Instance Method Summary collapse
-
#activity_logs ⇒ Object
Resources.
- #add_ons ⇒ Object
- #api_logs ⇒ Object
- #applied_coupons ⇒ Object
- #base_api_url ⇒ Object
- #base_ingest_api_url ⇒ Object
- #billable_metrics ⇒ Object
- #billing_entities ⇒ Object
- #coupons ⇒ Object
- #credit_notes ⇒ Object
- #customer_applied_coupons(resource_id) ⇒ Object
- #customer_credit_notes(resource_id) ⇒ Object
- #customer_invoices(resource_id) ⇒ Object
- #customer_payment_methods(resource_id) ⇒ Object
- #customer_payment_requests(resource_id) ⇒ Object
- #customer_payments(resource_id) ⇒ Object
- #customer_subscriptions(resource_id) ⇒ Object
- #customer_wallets(resource_id) ⇒ Object
- #customers ⇒ Object
- #events ⇒ Object
- #features ⇒ Object
- #fees ⇒ Object
- #gross_revenues ⇒ Object
-
#initialize(api_key: nil, api_url: nil, use_ingest_service: false, ingest_api_url: nil, **options) ⇒ Client
constructor
A new instance of Client.
- #invoice_collections ⇒ Object
- #invoiced_usages ⇒ Object
- #invoices ⇒ Object
- #mrrs ⇒ Object
- #organizations ⇒ Object
- #overdue_balances ⇒ Object
- #payment_receipts ⇒ Object
- #payment_requests ⇒ Object
- #payments ⇒ Object
- #plans ⇒ Object
- #subscriptions ⇒ Object
- #taxes ⇒ Object
- #wallet_transactions ⇒ Object
- #wallets ⇒ Object
- #webhook_endpoints ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(api_key: nil, api_url: nil, use_ingest_service: false, ingest_api_url: nil, **options) ⇒ Client
Returns a new instance of Client.
64 65 66 67 68 69 70 71 72 |
# File 'lib/lago/api/client.rb', line 64 def initialize(api_key: nil, api_url: nil, use_ingest_service: false, ingest_api_url: nil, **) @api_key = api_key @api_url = api_url @use_ingest_service = use_ingest_service @ingest_api_url = ingest_api_url @max_retries = .fetch(:max_retries, 3) @retry_on_rate_limit = .fetch(:retry_on_rate_limit, true) @on_rate_limit_info = [:on_rate_limit_info] end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
56 57 58 |
# File 'lib/lago/api/client.rb', line 56 def api_key @api_key end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
56 57 58 |
# File 'lib/lago/api/client.rb', line 56 def api_url @api_url end |
#ingest_api_url ⇒ Object (readonly)
Returns the value of attribute ingest_api_url.
56 57 58 |
# File 'lib/lago/api/client.rb', line 56 def ingest_api_url @ingest_api_url end |
#max_retries ⇒ Object (readonly)
Returns the value of attribute max_retries.
56 57 58 |
# File 'lib/lago/api/client.rb', line 56 def max_retries @max_retries end |
#on_rate_limit_info ⇒ Object (readonly)
Returns the value of attribute on_rate_limit_info.
56 57 58 |
# File 'lib/lago/api/client.rb', line 56 def on_rate_limit_info @on_rate_limit_info end |
#retry_on_rate_limit ⇒ Object (readonly)
Returns the value of attribute retry_on_rate_limit.
56 57 58 |
# File 'lib/lago/api/client.rb', line 56 def retry_on_rate_limit @retry_on_rate_limit end |
#use_ingest_service ⇒ Object (readonly)
Returns the value of attribute use_ingest_service.
56 57 58 |
# File 'lib/lago/api/client.rb', line 56 def use_ingest_service @use_ingest_service end |
Instance Method Details
#activity_logs ⇒ Object
Resources
88 89 90 |
# File 'lib/lago/api/client.rb', line 88 def activity_logs Resources::ActivityLog.new(self) end |
#add_ons ⇒ Object
92 93 94 |
# File 'lib/lago/api/client.rb', line 92 def add_ons Resources::AddOn.new(self) end |
#api_logs ⇒ Object
96 97 98 |
# File 'lib/lago/api/client.rb', line 96 def api_logs Resources::ApiLog.new(self) end |
#applied_coupons ⇒ Object
100 101 102 |
# File 'lib/lago/api/client.rb', line 100 def applied_coupons Resources::AppliedCoupon.new(self) end |
#base_api_url ⇒ Object
74 75 76 77 78 |
# File 'lib/lago/api/client.rb', line 74 def base_api_url base_url = api_url.nil? ? Lago::Api::BASE_URL : api_url URI.join(base_url, Lago::Api::API_PATH) end |
#base_ingest_api_url ⇒ Object
80 81 82 83 84 85 |
# File 'lib/lago/api/client.rb', line 80 def base_ingest_api_url return base_api_url unless use_ingest_service ingest_url = ingest_api_url.nil? ? Lago::Api::BASE_INGEST_URL : ingest_api_url URI.join(ingest_url, Lago::Api::API_PATH) end |
#billable_metrics ⇒ Object
104 105 106 |
# File 'lib/lago/api/client.rb', line 104 def billable_metrics Resources::BillableMetric.new(self) end |
#billing_entities ⇒ Object
108 109 110 |
# File 'lib/lago/api/client.rb', line 108 def billing_entities Resources::BillingEntity.new(self) end |
#coupons ⇒ Object
112 113 114 |
# File 'lib/lago/api/client.rb', line 112 def coupons Resources::Coupon.new(self) end |
#credit_notes ⇒ Object
116 117 118 |
# File 'lib/lago/api/client.rb', line 116 def credit_notes Resources::CreditNote.new(self) end |
#customer_applied_coupons(resource_id) ⇒ Object
124 125 126 |
# File 'lib/lago/api/client.rb', line 124 def customer_applied_coupons(resource_id) Resources::Customers::AppliedCoupon.new(self, resource_id) end |
#customer_credit_notes(resource_id) ⇒ Object
128 129 130 |
# File 'lib/lago/api/client.rb', line 128 def customer_credit_notes(resource_id) Resources::Customers::CreditNote.new(self, resource_id) end |
#customer_invoices(resource_id) ⇒ Object
132 133 134 |
# File 'lib/lago/api/client.rb', line 132 def customer_invoices(resource_id) Resources::Customers::Invoice.new(self, resource_id) end |
#customer_payment_methods(resource_id) ⇒ Object
140 141 142 |
# File 'lib/lago/api/client.rb', line 140 def customer_payment_methods(resource_id) Resources::Customers::PaymentMethod.new(self, resource_id) end |
#customer_payment_requests(resource_id) ⇒ Object
144 145 146 |
# File 'lib/lago/api/client.rb', line 144 def customer_payment_requests(resource_id) Resources::Customers::PaymentRequest.new(self, resource_id) end |
#customer_payments(resource_id) ⇒ Object
136 137 138 |
# File 'lib/lago/api/client.rb', line 136 def customer_payments(resource_id) Resources::Customers::Payment.new(self, resource_id) end |
#customer_subscriptions(resource_id) ⇒ Object
148 149 150 |
# File 'lib/lago/api/client.rb', line 148 def customer_subscriptions(resource_id) Resources::Customers::Subscription.new(self, resource_id) end |
#customer_wallets(resource_id) ⇒ Object
152 153 154 |
# File 'lib/lago/api/client.rb', line 152 def customer_wallets(resource_id) Resources::Customers::Wallet.new(self, resource_id) end |
#customers ⇒ Object
120 121 122 |
# File 'lib/lago/api/client.rb', line 120 def customers Resources::Customer.new(self) end |
#events ⇒ Object
156 157 158 |
# File 'lib/lago/api/client.rb', line 156 def events Resources::Event.new(self) end |
#features ⇒ Object
160 161 162 |
# File 'lib/lago/api/client.rb', line 160 def features Resources::Feature.new(self) end |
#fees ⇒ Object
164 165 166 |
# File 'lib/lago/api/client.rb', line 164 def fees Resources::Fee.new(self) end |
#gross_revenues ⇒ Object
168 169 170 |
# File 'lib/lago/api/client.rb', line 168 def gross_revenues Resources::GrossRevenue.new(self) end |
#invoice_collections ⇒ Object
172 173 174 |
# File 'lib/lago/api/client.rb', line 172 def invoice_collections Resources::InvoiceCollection.new(self) end |
#invoiced_usages ⇒ Object
176 177 178 |
# File 'lib/lago/api/client.rb', line 176 def invoiced_usages Resources::InvoicedUsage.new(self) end |
#invoices ⇒ Object
180 181 182 |
# File 'lib/lago/api/client.rb', line 180 def invoices Resources::Invoice.new(self) end |
#mrrs ⇒ Object
184 185 186 |
# File 'lib/lago/api/client.rb', line 184 def mrrs Resources::Mrr.new(self) end |
#organizations ⇒ Object
188 189 190 |
# File 'lib/lago/api/client.rb', line 188 def organizations Resources::Organization.new(self) end |
#overdue_balances ⇒ Object
192 193 194 |
# File 'lib/lago/api/client.rb', line 192 def overdue_balances Resources::OverdueBalance.new(self) end |
#payment_receipts ⇒ Object
196 197 198 |
# File 'lib/lago/api/client.rb', line 196 def payment_receipts Resources::PaymentReceipt.new(self) end |
#payment_requests ⇒ Object
200 201 202 |
# File 'lib/lago/api/client.rb', line 200 def payment_requests Resources::PaymentRequest.new(self) end |
#payments ⇒ Object
204 205 206 |
# File 'lib/lago/api/client.rb', line 204 def payments Resources::Payment.new(self) end |
#plans ⇒ Object
208 209 210 |
# File 'lib/lago/api/client.rb', line 208 def plans Resources::Plan.new(self) end |
#subscriptions ⇒ Object
212 213 214 |
# File 'lib/lago/api/client.rb', line 212 def subscriptions Resources::Subscription.new(self) end |
#taxes ⇒ Object
216 217 218 |
# File 'lib/lago/api/client.rb', line 216 def taxes Resources::Tax.new(self) end |
#wallet_transactions ⇒ Object
220 221 222 |
# File 'lib/lago/api/client.rb', line 220 def wallet_transactions Resources::WalletTransaction.new(self) end |
#wallets ⇒ Object
224 225 226 |
# File 'lib/lago/api/client.rb', line 224 def wallets Resources::Wallet.new(self) end |
#webhook_endpoints ⇒ Object
228 229 230 |
# File 'lib/lago/api/client.rb', line 228 def webhook_endpoints Resources::WebhookEndpoint.new(self) end |