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