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.
-
#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.
58 59 60 61 62 63 64 65 |
# File 'lib/lago/api/client.rb', line 58 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) 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 |
#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
81 82 83 |
# File 'lib/lago/api/client.rb', line 81 def activity_logs Resources::ActivityLog.new(self) end |
#add_ons ⇒ Object
85 86 87 |
# File 'lib/lago/api/client.rb', line 85 def add_ons Resources::AddOn.new(self) end |
#api_logs ⇒ Object
89 90 91 |
# File 'lib/lago/api/client.rb', line 89 def api_logs Resources::ApiLog.new(self) end |
#applied_coupons ⇒ Object
93 94 95 |
# File 'lib/lago/api/client.rb', line 93 def applied_coupons Resources::AppliedCoupon.new(self) end |
#base_api_url ⇒ Object
67 68 69 70 71 |
# File 'lib/lago/api/client.rb', line 67 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
73 74 75 76 77 78 |
# File 'lib/lago/api/client.rb', line 73 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
97 98 99 |
# File 'lib/lago/api/client.rb', line 97 def billable_metrics Resources::BillableMetric.new(self) end |
#billing_entities ⇒ Object
101 102 103 |
# File 'lib/lago/api/client.rb', line 101 def billing_entities Resources::BillingEntity.new(self) end |
#coupons ⇒ Object
105 106 107 |
# File 'lib/lago/api/client.rb', line 105 def coupons Resources::Coupon.new(self) end |
#credit_notes ⇒ Object
109 110 111 |
# File 'lib/lago/api/client.rb', line 109 def credit_notes Resources::CreditNote.new(self) end |
#customer_applied_coupons(resource_id) ⇒ Object
117 118 119 |
# File 'lib/lago/api/client.rb', line 117 def customer_applied_coupons(resource_id) Resources::Customers::AppliedCoupon.new(self, resource_id) end |
#customer_credit_notes(resource_id) ⇒ Object
121 122 123 |
# File 'lib/lago/api/client.rb', line 121 def customer_credit_notes(resource_id) Resources::Customers::CreditNote.new(self, resource_id) end |
#customer_invoices(resource_id) ⇒ Object
125 126 127 |
# File 'lib/lago/api/client.rb', line 125 def customer_invoices(resource_id) Resources::Customers::Invoice.new(self, resource_id) end |
#customer_payment_methods(resource_id) ⇒ Object
133 134 135 |
# File 'lib/lago/api/client.rb', line 133 def customer_payment_methods(resource_id) Resources::Customers::PaymentMethod.new(self, resource_id) end |
#customer_payment_requests(resource_id) ⇒ Object
137 138 139 |
# File 'lib/lago/api/client.rb', line 137 def customer_payment_requests(resource_id) Resources::Customers::PaymentRequest.new(self, resource_id) end |
#customer_payments(resource_id) ⇒ Object
129 130 131 |
# File 'lib/lago/api/client.rb', line 129 def customer_payments(resource_id) Resources::Customers::Payment.new(self, resource_id) end |
#customer_subscriptions(resource_id) ⇒ Object
141 142 143 |
# File 'lib/lago/api/client.rb', line 141 def customer_subscriptions(resource_id) Resources::Customers::Subscription.new(self, resource_id) end |
#customer_wallets(resource_id) ⇒ Object
145 146 147 |
# File 'lib/lago/api/client.rb', line 145 def customer_wallets(resource_id) Resources::Customers::Wallet.new(self, resource_id) end |
#customers ⇒ Object
113 114 115 |
# File 'lib/lago/api/client.rb', line 113 def customers Resources::Customer.new(self) end |
#events ⇒ Object
149 150 151 |
# File 'lib/lago/api/client.rb', line 149 def events Resources::Event.new(self) end |
#features ⇒ Object
153 154 155 |
# File 'lib/lago/api/client.rb', line 153 def features Resources::Feature.new(self) end |
#fees ⇒ Object
157 158 159 |
# File 'lib/lago/api/client.rb', line 157 def fees Resources::Fee.new(self) end |
#gross_revenues ⇒ Object
161 162 163 |
# File 'lib/lago/api/client.rb', line 161 def gross_revenues Resources::GrossRevenue.new(self) end |
#invoice_collections ⇒ Object
165 166 167 |
# File 'lib/lago/api/client.rb', line 165 def invoice_collections Resources::InvoiceCollection.new(self) end |
#invoiced_usages ⇒ Object
169 170 171 |
# File 'lib/lago/api/client.rb', line 169 def invoiced_usages Resources::InvoicedUsage.new(self) end |
#invoices ⇒ Object
173 174 175 |
# File 'lib/lago/api/client.rb', line 173 def invoices Resources::Invoice.new(self) end |
#mrrs ⇒ Object
177 178 179 |
# File 'lib/lago/api/client.rb', line 177 def mrrs Resources::Mrr.new(self) end |
#organizations ⇒ Object
181 182 183 |
# File 'lib/lago/api/client.rb', line 181 def organizations Resources::Organization.new(self) end |
#overdue_balances ⇒ Object
185 186 187 |
# File 'lib/lago/api/client.rb', line 185 def overdue_balances Resources::OverdueBalance.new(self) end |
#payment_receipts ⇒ Object
189 190 191 |
# File 'lib/lago/api/client.rb', line 189 def payment_receipts Resources::PaymentReceipt.new(self) end |
#payment_requests ⇒ Object
193 194 195 |
# File 'lib/lago/api/client.rb', line 193 def payment_requests Resources::PaymentRequest.new(self) end |
#payments ⇒ Object
197 198 199 |
# File 'lib/lago/api/client.rb', line 197 def payments Resources::Payment.new(self) end |
#plans ⇒ Object
201 202 203 |
# File 'lib/lago/api/client.rb', line 201 def plans Resources::Plan.new(self) end |
#subscriptions ⇒ Object
205 206 207 |
# File 'lib/lago/api/client.rb', line 205 def subscriptions Resources::Subscription.new(self) end |
#taxes ⇒ Object
209 210 211 |
# File 'lib/lago/api/client.rb', line 209 def taxes Resources::Tax.new(self) end |
#wallet_transactions ⇒ Object
213 214 215 |
# File 'lib/lago/api/client.rb', line 213 def wallet_transactions Resources::WalletTransaction.new(self) end |
#wallets ⇒ Object
217 218 219 |
# File 'lib/lago/api/client.rb', line 217 def wallets Resources::Wallet.new(self) end |
#webhook_endpoints ⇒ Object
221 222 223 |
# File 'lib/lago/api/client.rb', line 221 def webhook_endpoints Resources::WebhookEndpoint.new(self) end |