lago_ruby 0.48.0.pre.beta → 0.51.0.pre.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +19 -6
- data/docs/AddOnBaseInput.md +2 -0
- data/docs/AddOnCreateInputAddOn.md +2 -0
- data/docs/AddOnObject.md +2 -0
- data/docs/BillableMetricBaseInput.md +1 -1
- data/docs/BillableMetricCreateInputBillableMetric.md +1 -1
- data/docs/BillableMetricObject.md +1 -1
- data/docs/ChargeObject.md +2 -0
- data/docs/CreditNoteCreateInputCreditNote.md +1 -1
- data/docs/CreditNoteEstimateInput.md +18 -0
- data/docs/CreditNoteEstimateInputCreditNote.md +20 -0
- data/docs/CreditNoteEstimateInputCreditNoteItemsInner.md +20 -0
- data/docs/CreditNoteEstimated.md +18 -0
- data/docs/CreditNoteEstimatedEstimatedCreditNote.md +38 -0
- data/docs/CreditNoteEstimatedEstimatedCreditNoteAppliedTaxesInner.md +32 -0
- data/docs/CreditNoteEstimatedEstimatedCreditNoteItemsInner.md +20 -0
- data/docs/CreditNoteItemObjectFee.md +4 -0
- data/docs/CreditNoteObject.md +2 -2
- data/docs/CreditNotesApi.md +72 -0
- data/docs/CustomerChargeUsageObject.md +2 -0
- data/docs/CustomerChargeUsageObjectGroupsInner.md +2 -0
- data/docs/CustomerPastUsage.md +20 -0
- data/docs/CustomerUsageObject.md +2 -0
- data/docs/CustomersApi.md +82 -0
- data/docs/EventsApi.md +7 -6
- data/docs/FeeObject.md +4 -0
- data/docs/FeeObjectItem.md +4 -0
- data/docs/GroupPropertiesObject.md +2 -0
- data/docs/InvoiceOneOffCreateInputInvoiceFeesInner.md +2 -0
- data/docs/PlanCreateInputPlan.md +3 -1
- data/docs/PlanCreateInputPlanChargesInner.md +2 -0
- data/docs/PlanObject.md +3 -1
- data/docs/PlanOverridesObject.md +32 -0
- data/docs/PlanOverridesObjectChargesInner.md +28 -0
- data/docs/PlanUpdateInputPlan.md +3 -1
- data/docs/PlanUpdateInputPlanChargesInner.md +2 -0
- data/docs/Subscription.md +1 -1
- data/docs/SubscriptionCreateInputSubscription.md +3 -1
- data/docs/SubscriptionObjectExtended.md +52 -0
- data/docs/SubscriptionUpdateInputSubscription.md +3 -1
- data/docs/SubscriptionsApi.md +70 -0
- data/lago_ruby.gemspec +1 -1
- data/lib/lago_ruby/api/add_ons_api.rb +1 -1
- data/lib/lago_ruby/api/billable_metrics_api.rb +1 -1
- data/lib/lago_ruby/api/coupons_api.rb +1 -1
- data/lib/lago_ruby/api/credit_notes_api.rb +65 -1
- data/lib/lago_ruby/api/customers_api.rb +83 -1
- data/lib/lago_ruby/api/events_api.rb +6 -6
- data/lib/lago_ruby/api/fees_api.rb +1 -1
- data/lib/lago_ruby/api/invoices_api.rb +1 -1
- data/lib/lago_ruby/api/organizations_api.rb +1 -1
- data/lib/lago_ruby/api/plans_api.rb +1 -1
- data/lib/lago_ruby/api/subscriptions_api.rb +64 -1
- data/lib/lago_ruby/api/taxes_api.rb +1 -1
- data/lib/lago_ruby/api/wallets_api.rb +1 -1
- data/lib/lago_ruby/api/webhook_endpoints_api.rb +1 -1
- data/lib/lago_ruby/api/webhooks_api.rb +1 -1
- data/lib/lago_ruby/api_client.rb +13 -13
- data/lib/lago_ruby/api_error.rb +1 -1
- data/lib/lago_ruby/configuration.rb +2 -1
- data/lib/lago_ruby/models/add_on.rb +2 -2
- data/lib/lago_ruby/models/add_on_base_input.rb +13 -3
- data/lib/lago_ruby/models/add_on_create_input.rb +2 -2
- data/lib/lago_ruby/models/add_on_create_input_add_on.rb +13 -3
- data/lib/lago_ruby/models/add_on_object.rb +13 -3
- data/lib/lago_ruby/models/add_on_update_input.rb +2 -2
- data/lib/lago_ruby/models/add_ons_paginated.rb +2 -2
- data/lib/lago_ruby/models/api_error_bad_request.rb +2 -2
- data/lib/lago_ruby/models/api_error_forbidden.rb +2 -2
- data/lib/lago_ruby/models/api_error_not_allowed.rb +2 -2
- data/lib/lago_ruby/models/api_error_not_found.rb +2 -2
- data/lib/lago_ruby/models/api_error_unauthorized.rb +2 -2
- data/lib/lago_ruby/models/api_error_unprocessable_entity.rb +2 -2
- data/lib/lago_ruby/models/applied_coupon.rb +2 -2
- data/lib/lago_ruby/models/applied_coupon_input.rb +2 -2
- data/lib/lago_ruby/models/applied_coupon_input_applied_coupon.rb +2 -2
- data/lib/lago_ruby/models/applied_coupon_object.rb +2 -2
- data/lib/lago_ruby/models/applied_coupon_object_extended.rb +2 -2
- data/lib/lago_ruby/models/applied_coupons_paginated.rb +2 -2
- data/lib/lago_ruby/models/base_applied_tax.rb +2 -2
- data/lib/lago_ruby/models/billable_metric.rb +2 -2
- data/lib/lago_ruby/models/billable_metric_base_input.rb +5 -5
- data/lib/lago_ruby/models/billable_metric_create_input.rb +2 -2
- data/lib/lago_ruby/models/billable_metric_create_input_billable_metric.rb +5 -5
- data/lib/lago_ruby/models/billable_metric_group.rb +2 -2
- data/lib/lago_ruby/models/billable_metric_group_values_inner.rb +1 -1
- data/lib/lago_ruby/models/billable_metric_group_values_inner_one_of.rb +2 -2
- data/lib/lago_ruby/models/billable_metric_object.rb +5 -5
- data/lib/lago_ruby/models/billable_metric_update_input.rb +2 -2
- data/lib/lago_ruby/models/billable_metrics_paginated.rb +2 -2
- data/lib/lago_ruby/models/charge_object.rb +13 -3
- data/lib/lago_ruby/models/charge_object_properties.rb +2 -2
- data/lib/lago_ruby/models/charge_properties.rb +2 -2
- data/lib/lago_ruby/models/charge_properties_graduated_percentage_ranges_inner.rb +2 -2
- data/lib/lago_ruby/models/charge_properties_graduated_ranges_inner.rb +2 -2
- data/lib/lago_ruby/models/charge_properties_volume_ranges_inner.rb +2 -2
- data/lib/lago_ruby/models/country.rb +1 -1
- data/lib/lago_ruby/models/coupon.rb +2 -2
- data/lib/lago_ruby/models/coupon_base_input.rb +2 -2
- data/lib/lago_ruby/models/coupon_base_input_applies_to.rb +2 -2
- data/lib/lago_ruby/models/coupon_create_input.rb +2 -2
- data/lib/lago_ruby/models/coupon_create_input_coupon.rb +2 -2
- data/lib/lago_ruby/models/coupon_object.rb +2 -2
- data/lib/lago_ruby/models/coupon_update_input.rb +2 -2
- data/lib/lago_ruby/models/coupons_paginated.rb +2 -2
- data/lib/lago_ruby/models/credit_note.rb +2 -2
- data/lib/lago_ruby/models/credit_note_applied_tax_object.rb +2 -2
- data/lib/lago_ruby/models/credit_note_create_input.rb +2 -2
- data/lib/lago_ruby/models/credit_note_create_input_credit_note.rb +3 -3
- data/lib/lago_ruby/models/credit_note_create_input_credit_note_items_inner.rb +1 -1
- data/lib/lago_ruby/models/credit_note_estimate_input.rb +221 -0
- data/lib/lago_ruby/models/credit_note_estimate_input_credit_note.rb +241 -0
- data/lib/lago_ruby/models/credit_note_estimate_input_credit_note_items_inner.rb +239 -0
- data/lib/lago_ruby/models/credit_note_estimated.rb +221 -0
- data/lib/lago_ruby/models/credit_note_estimated_estimated_credit_note.rb +387 -0
- data/lib/lago_ruby/models/credit_note_estimated_estimated_credit_note_applied_taxes_inner.rb +283 -0
- data/lib/lago_ruby/models/credit_note_estimated_estimated_credit_note_items_inner.rb +235 -0
- data/lib/lago_ruby/models/credit_note_item_object.rb +2 -2
- data/lib/lago_ruby/models/credit_note_item_object_fee.rb +30 -3
- data/lib/lago_ruby/models/credit_note_object.rb +13 -13
- data/lib/lago_ruby/models/credit_note_update_input.rb +2 -2
- data/lib/lago_ruby/models/credit_note_update_input_credit_note.rb +2 -2
- data/lib/lago_ruby/models/credit_notes.rb +2 -2
- data/lib/lago_ruby/models/credit_object.rb +2 -2
- data/lib/lago_ruby/models/credit_object_invoice.rb +2 -2
- data/lib/lago_ruby/models/credit_object_item.rb +2 -2
- data/lib/lago_ruby/models/currency.rb +1 -1
- data/lib/lago_ruby/models/customer.rb +2 -2
- data/lib/lago_ruby/models/customer_billing_configuration.rb +2 -2
- data/lib/lago_ruby/models/customer_charge_usage_object.rb +20 -3
- data/lib/lago_ruby/models/customer_charge_usage_object_billable_metric.rb +2 -2
- data/lib/lago_ruby/models/customer_charge_usage_object_charge.rb +2 -2
- data/lib/lago_ruby/models/customer_charge_usage_object_groups_inner.rb +13 -3
- data/lib/lago_ruby/models/customer_create_input.rb +2 -2
- data/lib/lago_ruby/models/customer_create_input_customer.rb +2 -2
- data/lib/lago_ruby/models/customer_create_input_customer_metadata_inner.rb +2 -2
- data/lib/lago_ruby/models/customer_metadata.rb +2 -2
- data/lib/lago_ruby/models/customer_object.rb +2 -2
- data/lib/lago_ruby/models/customer_object_extended.rb +2 -2
- data/lib/lago_ruby/models/customer_past_usage.rb +239 -0
- data/lib/lago_ruby/models/customer_usage.rb +2 -2
- data/lib/lago_ruby/models/customer_usage_object.rb +14 -3
- data/lib/lago_ruby/models/customers_paginated.rb +2 -2
- data/lib/lago_ruby/models/event.rb +2 -2
- data/lib/lago_ruby/models/event_batch_input.rb +2 -2
- data/lib/lago_ruby/models/event_batch_input_event.rb +2 -2
- data/lib/lago_ruby/models/event_batch_input_event_properties.rb +2 -2
- data/lib/lago_ruby/models/event_estimate_fees_input.rb +2 -2
- data/lib/lago_ruby/models/event_estimate_fees_input_event.rb +2 -2
- data/lib/lago_ruby/models/event_input.rb +2 -2
- data/lib/lago_ruby/models/event_input_event.rb +2 -2
- data/lib/lago_ruby/models/event_input_event_timestamp.rb +1 -1
- data/lib/lago_ruby/models/event_object.rb +6 -22
- data/lib/lago_ruby/models/event_object_properties.rb +2 -2
- data/lib/lago_ruby/models/fee.rb +2 -2
- data/lib/lago_ruby/models/fee_applied_tax_object.rb +2 -2
- data/lib/lago_ruby/models/fee_object.rb +30 -3
- data/lib/lago_ruby/models/fee_object_item.rb +23 -3
- data/lib/lago_ruby/models/fee_update_input.rb +2 -2
- data/lib/lago_ruby/models/fee_update_input_fee.rb +2 -2
- data/lib/lago_ruby/models/fees.rb +2 -2
- data/lib/lago_ruby/models/fees_paginated.rb +2 -2
- data/lib/lago_ruby/models/get_customer_portal_url200_response.rb +2 -2
- data/lib/lago_ruby/models/get_customer_portal_url200_response_customer.rb +2 -2
- data/lib/lago_ruby/models/group_object.rb +2 -2
- data/lib/lago_ruby/models/group_properties_object.rb +13 -3
- data/lib/lago_ruby/models/group_properties_object_values.rb +2 -2
- data/lib/lago_ruby/models/groups_paginated.rb +2 -2
- data/lib/lago_ruby/models/invoice.rb +2 -2
- data/lib/lago_ruby/models/invoice_applied_tax_object.rb +2 -2
- data/lib/lago_ruby/models/invoice_metadata_object.rb +2 -2
- data/lib/lago_ruby/models/invoice_object.rb +2 -2
- data/lib/lago_ruby/models/invoice_object_customer.rb +2 -2
- data/lib/lago_ruby/models/invoice_object_extended.rb +2 -2
- data/lib/lago_ruby/models/invoice_one_off_create_input.rb +2 -2
- data/lib/lago_ruby/models/invoice_one_off_create_input_invoice.rb +2 -2
- data/lib/lago_ruby/models/invoice_one_off_create_input_invoice_fees_inner.rb +13 -3
- data/lib/lago_ruby/models/invoice_update_input.rb +2 -2
- data/lib/lago_ruby/models/invoice_update_input_invoice.rb +2 -2
- data/lib/lago_ruby/models/invoice_update_input_invoice_metadata_inner.rb +2 -2
- data/lib/lago_ruby/models/invoices_paginated.rb +2 -2
- data/lib/lago_ruby/models/organization.rb +2 -2
- data/lib/lago_ruby/models/organization_billing_configuration.rb +2 -2
- data/lib/lago_ruby/models/organization_object.rb +2 -2
- data/lib/lago_ruby/models/organization_update_input.rb +2 -2
- data/lib/lago_ruby/models/organization_update_input_organization.rb +2 -2
- data/lib/lago_ruby/models/pagination_meta.rb +2 -2
- data/lib/lago_ruby/models/plan.rb +2 -2
- data/lib/lago_ruby/models/plan_create_input.rb +2 -2
- data/lib/lago_ruby/models/plan_create_input_plan.rb +13 -3
- data/lib/lago_ruby/models/plan_create_input_plan_charges_inner.rb +13 -3
- data/lib/lago_ruby/models/plan_create_input_plan_charges_inner_group_properties_inner.rb +2 -2
- data/lib/lago_ruby/models/plan_object.rb +13 -3
- data/lib/lago_ruby/models/plan_overrides_object.rb +289 -0
- data/lib/lago_ruby/models/plan_overrides_object_charges_inner.rb +268 -0
- data/lib/lago_ruby/models/plan_update_input.rb +2 -2
- data/lib/lago_ruby/models/plan_update_input_plan.rb +13 -3
- data/lib/lago_ruby/models/plan_update_input_plan_charges_inner.rb +13 -3
- data/lib/lago_ruby/models/plans_paginated.rb +2 -2
- data/lib/lago_ruby/models/subscription.rb +3 -3
- data/lib/lago_ruby/models/subscription_create_input.rb +2 -2
- data/lib/lago_ruby/models/subscription_create_input_subscription.rb +15 -6
- data/lib/lago_ruby/models/subscription_object.rb +2 -2
- data/lib/lago_ruby/models/subscription_object_extended.rb +507 -0
- data/lib/lago_ruby/models/subscription_update_input.rb +2 -2
- data/lib/lago_ruby/models/subscription_update_input_subscription.rb +15 -6
- data/lib/lago_ruby/models/subscriptions_paginated.rb +2 -2
- data/lib/lago_ruby/models/tax.rb +2 -2
- data/lib/lago_ruby/models/tax_base_input.rb +2 -2
- data/lib/lago_ruby/models/tax_create_input.rb +2 -2
- data/lib/lago_ruby/models/tax_create_input_tax.rb +2 -2
- data/lib/lago_ruby/models/tax_object.rb +2 -2
- data/lib/lago_ruby/models/tax_update_input.rb +2 -2
- data/lib/lago_ruby/models/taxes_paginated.rb +2 -2
- data/lib/lago_ruby/models/timezone.rb +1 -1
- data/lib/lago_ruby/models/wallet.rb +2 -2
- data/lib/lago_ruby/models/wallet_create_input.rb +2 -2
- data/lib/lago_ruby/models/wallet_create_input_wallet.rb +2 -2
- data/lib/lago_ruby/models/wallet_object.rb +2 -2
- data/lib/lago_ruby/models/wallet_transaction_create_input.rb +2 -2
- data/lib/lago_ruby/models/wallet_transaction_create_input_wallet_transaction.rb +2 -2
- data/lib/lago_ruby/models/wallet_transaction_object.rb +2 -2
- data/lib/lago_ruby/models/wallet_transactions.rb +2 -2
- data/lib/lago_ruby/models/wallet_transactions_paginated.rb +2 -2
- data/lib/lago_ruby/models/wallet_update_input.rb +2 -2
- data/lib/lago_ruby/models/wallet_update_input_wallet.rb +2 -2
- data/lib/lago_ruby/models/wallets_paginated.rb +2 -2
- data/lib/lago_ruby/models/webhook_endpoint.rb +2 -2
- data/lib/lago_ruby/models/webhook_endpoint_create_input.rb +2 -2
- data/lib/lago_ruby/models/webhook_endpoint_create_input_webhook_endpoint.rb +2 -2
- data/lib/lago_ruby/models/webhook_endpoint_object.rb +2 -2
- data/lib/lago_ruby/models/webhook_endpoint_update_input.rb +2 -2
- data/lib/lago_ruby/models/webhook_endpoints_paginated.rb +2 -2
- data/lib/lago_ruby/version.rb +2 -2
- data/lib/lago_ruby.rb +12 -2
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/{credit_note_create_input_credit_note_items_inner_spec.rb → credit_note_estimate_input_credit_note_items_inner_spec.rb} +10 -8
- data/spec/models/credit_note_estimate_input_credit_note_spec.rb +42 -0
- data/spec/models/credit_note_estimate_input_spec.rb +36 -0
- data/spec/models/credit_note_estimated_estimated_credit_note_applied_taxes_inner_spec.rb +78 -0
- data/spec/models/credit_note_estimated_estimated_credit_note_items_inner_spec.rb +42 -0
- data/spec/models/credit_note_estimated_estimated_credit_note_spec.rb +96 -0
- data/spec/models/credit_note_estimated_spec.rb +36 -0
- data/spec/models/customer_past_usage_spec.rb +42 -0
- data/spec/models/plan_overrides_object_charges_inner_spec.rb +66 -0
- data/spec/models/plan_overrides_object_spec.rb +78 -0
- data/spec/models/subscription_object_extended_spec.rb +146 -0
- data/spec/spec_helper.rb +1 -1
- metadata +194 -152
data/docs/SubscriptionsApi.md
CHANGED
|
@@ -7,6 +7,7 @@ All URIs are relative to *https://api.getlago.com/api/v1*
|
|
|
7
7
|
| [**create_subscription**](SubscriptionsApi.md#create_subscription) | **POST** /subscriptions | Assign a plan to a customer |
|
|
8
8
|
| [**destroy_subscription**](SubscriptionsApi.md#destroy_subscription) | **DELETE** /subscriptions/{external_id} | Terminate a subscription |
|
|
9
9
|
| [**find_all_subscriptions**](SubscriptionsApi.md#find_all_subscriptions) | **GET** /subscriptions | List all subscriptions |
|
|
10
|
+
| [**find_subscription**](SubscriptionsApi.md#find_subscription) | **GET** /subscriptions/{external_id} | Retrieve a subscription |
|
|
10
11
|
| [**update_subscription**](SubscriptionsApi.md#update_subscription) | **PUT** /subscriptions/{external_id} | Update a subscription |
|
|
11
12
|
|
|
12
13
|
|
|
@@ -231,6 +232,75 @@ end
|
|
|
231
232
|
- **Accept**: application/json
|
|
232
233
|
|
|
233
234
|
|
|
235
|
+
## find_subscription
|
|
236
|
+
|
|
237
|
+
> <Subscription> find_subscription(external_id)
|
|
238
|
+
|
|
239
|
+
Retrieve a subscription
|
|
240
|
+
|
|
241
|
+
This endpoint retrieves a specific subscription.
|
|
242
|
+
|
|
243
|
+
### Examples
|
|
244
|
+
|
|
245
|
+
```ruby
|
|
246
|
+
require 'time'
|
|
247
|
+
require 'lago_ruby'
|
|
248
|
+
# setup authorization
|
|
249
|
+
LagoAPI.configure do |config|
|
|
250
|
+
# Configure Bearer authorization: bearerAuth
|
|
251
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
api_instance = LagoAPI::SubscriptionsApi.new
|
|
255
|
+
external_id = '5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba' # String | External ID of the existing subscription
|
|
256
|
+
|
|
257
|
+
begin
|
|
258
|
+
# Retrieve a subscription
|
|
259
|
+
result = api_instance.find_subscription(external_id)
|
|
260
|
+
p result
|
|
261
|
+
rescue LagoAPI::ApiError => e
|
|
262
|
+
puts "Error when calling SubscriptionsApi->find_subscription: #{e}"
|
|
263
|
+
end
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
#### Using the find_subscription_with_http_info variant
|
|
267
|
+
|
|
268
|
+
This returns an Array which contains the response data, status code and headers.
|
|
269
|
+
|
|
270
|
+
> <Array(<Subscription>, Integer, Hash)> find_subscription_with_http_info(external_id)
|
|
271
|
+
|
|
272
|
+
```ruby
|
|
273
|
+
begin
|
|
274
|
+
# Retrieve a subscription
|
|
275
|
+
data, status_code, headers = api_instance.find_subscription_with_http_info(external_id)
|
|
276
|
+
p status_code # => 2xx
|
|
277
|
+
p headers # => { ... }
|
|
278
|
+
p data # => <Subscription>
|
|
279
|
+
rescue LagoAPI::ApiError => e
|
|
280
|
+
puts "Error when calling SubscriptionsApi->find_subscription_with_http_info: #{e}"
|
|
281
|
+
end
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Parameters
|
|
285
|
+
|
|
286
|
+
| Name | Type | Description | Notes |
|
|
287
|
+
| ---- | ---- | ----------- | ----- |
|
|
288
|
+
| **external_id** | **String** | External ID of the existing subscription | |
|
|
289
|
+
|
|
290
|
+
### Return type
|
|
291
|
+
|
|
292
|
+
[**Subscription**](Subscription.md)
|
|
293
|
+
|
|
294
|
+
### Authorization
|
|
295
|
+
|
|
296
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
297
|
+
|
|
298
|
+
### HTTP request headers
|
|
299
|
+
|
|
300
|
+
- **Content-Type**: Not defined
|
|
301
|
+
- **Accept**: application/json
|
|
302
|
+
|
|
303
|
+
|
|
234
304
|
## update_subscription
|
|
235
305
|
|
|
236
306
|
> <Subscription> update_subscription(external_id, subscription_update_input)
|
data/lago_ruby.gemspec
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
7
7
|
|
|
8
|
-
The version of the OpenAPI document: 0.
|
|
8
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
9
9
|
Contact: tech@getlago.com
|
|
10
10
|
Generated by: https://openapi-generator.tech
|
|
11
11
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -150,6 +150,70 @@ module LagoAPI
|
|
|
150
150
|
return data, status_code, headers
|
|
151
151
|
end
|
|
152
152
|
|
|
153
|
+
# Estimate amounts for a new credit note
|
|
154
|
+
# This endpoint allows you to retrieve amounts for a new credit note creation.
|
|
155
|
+
# @param [Hash] opts the optional parameters
|
|
156
|
+
# @option opts [CreditNoteEstimateInput] :credit_note_estimate_input Credit note estimate payload
|
|
157
|
+
# @return [CreditNoteEstimated]
|
|
158
|
+
def estimate_credit_note(opts = {})
|
|
159
|
+
data, _status_code, _headers = estimate_credit_note_with_http_info(opts)
|
|
160
|
+
data
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Estimate amounts for a new credit note
|
|
164
|
+
# This endpoint allows you to retrieve amounts for a new credit note creation.
|
|
165
|
+
# @param [Hash] opts the optional parameters
|
|
166
|
+
# @option opts [CreditNoteEstimateInput] :credit_note_estimate_input Credit note estimate payload
|
|
167
|
+
# @return [Array<(CreditNoteEstimated, Integer, Hash)>] CreditNoteEstimated data, response status code and response headers
|
|
168
|
+
def estimate_credit_note_with_http_info(opts = {})
|
|
169
|
+
if @api_client.config.debugging
|
|
170
|
+
@api_client.config.logger.debug 'Calling API: CreditNotesApi.estimate_credit_note ...'
|
|
171
|
+
end
|
|
172
|
+
# resource path
|
|
173
|
+
local_var_path = '/credit_notes/estimate'
|
|
174
|
+
|
|
175
|
+
# query parameters
|
|
176
|
+
query_params = opts[:query_params] || {}
|
|
177
|
+
|
|
178
|
+
# header parameters
|
|
179
|
+
header_params = opts[:header_params] || {}
|
|
180
|
+
# HTTP header 'Accept' (if needed)
|
|
181
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
182
|
+
# HTTP header 'Content-Type'
|
|
183
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
184
|
+
if !content_type.nil?
|
|
185
|
+
header_params['Content-Type'] = content_type
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# form parameters
|
|
189
|
+
form_params = opts[:form_params] || {}
|
|
190
|
+
|
|
191
|
+
# http body (model)
|
|
192
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'credit_note_estimate_input'])
|
|
193
|
+
|
|
194
|
+
# return_type
|
|
195
|
+
return_type = opts[:debug_return_type] || 'CreditNoteEstimated'
|
|
196
|
+
|
|
197
|
+
# auth_names
|
|
198
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
199
|
+
|
|
200
|
+
new_options = opts.merge(
|
|
201
|
+
:operation => :"CreditNotesApi.estimate_credit_note",
|
|
202
|
+
:header_params => header_params,
|
|
203
|
+
:query_params => query_params,
|
|
204
|
+
:form_params => form_params,
|
|
205
|
+
:body => post_body,
|
|
206
|
+
:auth_names => auth_names,
|
|
207
|
+
:return_type => return_type
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
211
|
+
if @api_client.config.debugging
|
|
212
|
+
@api_client.config.logger.debug "API called: CreditNotesApi#estimate_credit_note\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
213
|
+
end
|
|
214
|
+
return data, status_code, headers
|
|
215
|
+
end
|
|
216
|
+
|
|
153
217
|
# List all credit notes
|
|
154
218
|
# This endpoint list all existing credit notes.
|
|
155
219
|
# @param [Hash] opts the optional parameters
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -219,6 +219,88 @@ module LagoAPI
|
|
|
219
219
|
return data, status_code, headers
|
|
220
220
|
end
|
|
221
221
|
|
|
222
|
+
# Retrieve customer past usage
|
|
223
|
+
# This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
|
|
224
|
+
# @param external_customer_id [String] The customer external unique identifier (provided by your own application).
|
|
225
|
+
# @param external_subscription_id [String] The unique identifier of the subscription within your application.
|
|
226
|
+
# @param [Hash] opts the optional parameters
|
|
227
|
+
# @option opts [Integer] :page Page number.
|
|
228
|
+
# @option opts [Integer] :per_page Number of records per page.
|
|
229
|
+
# @option opts [String] :billable_metric_code Billable metric code filter to apply to the charge usage
|
|
230
|
+
# @option opts [Integer] :periods_count Number of past billing period to returns in the result
|
|
231
|
+
# @return [CustomerPastUsage]
|
|
232
|
+
def find_all_customer_past_usage(external_customer_id, external_subscription_id, opts = {})
|
|
233
|
+
data, _status_code, _headers = find_all_customer_past_usage_with_http_info(external_customer_id, external_subscription_id, opts)
|
|
234
|
+
data
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Retrieve customer past usage
|
|
238
|
+
# This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
|
|
239
|
+
# @param external_customer_id [String] The customer external unique identifier (provided by your own application).
|
|
240
|
+
# @param external_subscription_id [String] The unique identifier of the subscription within your application.
|
|
241
|
+
# @param [Hash] opts the optional parameters
|
|
242
|
+
# @option opts [Integer] :page Page number.
|
|
243
|
+
# @option opts [Integer] :per_page Number of records per page.
|
|
244
|
+
# @option opts [String] :billable_metric_code Billable metric code filter to apply to the charge usage
|
|
245
|
+
# @option opts [Integer] :periods_count Number of past billing period to returns in the result
|
|
246
|
+
# @return [Array<(CustomerPastUsage, Integer, Hash)>] CustomerPastUsage data, response status code and response headers
|
|
247
|
+
def find_all_customer_past_usage_with_http_info(external_customer_id, external_subscription_id, opts = {})
|
|
248
|
+
if @api_client.config.debugging
|
|
249
|
+
@api_client.config.logger.debug 'Calling API: CustomersApi.find_all_customer_past_usage ...'
|
|
250
|
+
end
|
|
251
|
+
# verify the required parameter 'external_customer_id' is set
|
|
252
|
+
if @api_client.config.client_side_validation && external_customer_id.nil?
|
|
253
|
+
fail ArgumentError, "Missing the required parameter 'external_customer_id' when calling CustomersApi.find_all_customer_past_usage"
|
|
254
|
+
end
|
|
255
|
+
# verify the required parameter 'external_subscription_id' is set
|
|
256
|
+
if @api_client.config.client_side_validation && external_subscription_id.nil?
|
|
257
|
+
fail ArgumentError, "Missing the required parameter 'external_subscription_id' when calling CustomersApi.find_all_customer_past_usage"
|
|
258
|
+
end
|
|
259
|
+
# resource path
|
|
260
|
+
local_var_path = '/customers/{external_customer_id}/past_usage'.sub('{' + 'external_customer_id' + '}', CGI.escape(external_customer_id.to_s))
|
|
261
|
+
|
|
262
|
+
# query parameters
|
|
263
|
+
query_params = opts[:query_params] || {}
|
|
264
|
+
query_params[:'external_subscription_id'] = external_subscription_id
|
|
265
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
266
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
|
267
|
+
query_params[:'billable_metric_code'] = opts[:'billable_metric_code'] if !opts[:'billable_metric_code'].nil?
|
|
268
|
+
query_params[:'periods_count'] = opts[:'periods_count'] if !opts[:'periods_count'].nil?
|
|
269
|
+
|
|
270
|
+
# header parameters
|
|
271
|
+
header_params = opts[:header_params] || {}
|
|
272
|
+
# HTTP header 'Accept' (if needed)
|
|
273
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
274
|
+
|
|
275
|
+
# form parameters
|
|
276
|
+
form_params = opts[:form_params] || {}
|
|
277
|
+
|
|
278
|
+
# http body (model)
|
|
279
|
+
post_body = opts[:debug_body]
|
|
280
|
+
|
|
281
|
+
# return_type
|
|
282
|
+
return_type = opts[:debug_return_type] || 'CustomerPastUsage'
|
|
283
|
+
|
|
284
|
+
# auth_names
|
|
285
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
286
|
+
|
|
287
|
+
new_options = opts.merge(
|
|
288
|
+
:operation => :"CustomersApi.find_all_customer_past_usage",
|
|
289
|
+
:header_params => header_params,
|
|
290
|
+
:query_params => query_params,
|
|
291
|
+
:form_params => form_params,
|
|
292
|
+
:body => post_body,
|
|
293
|
+
:auth_names => auth_names,
|
|
294
|
+
:return_type => return_type
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
298
|
+
if @api_client.config.debugging
|
|
299
|
+
@api_client.config.logger.debug "API called: CustomersApi#find_all_customer_past_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
300
|
+
end
|
|
301
|
+
return data, status_code, headers
|
|
302
|
+
end
|
|
303
|
+
|
|
222
304
|
# List all customers
|
|
223
305
|
# This endpoint retrieves all existing customers.
|
|
224
306
|
# @param [Hash] opts the optional parameters
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -91,17 +91,17 @@ module LagoAPI
|
|
|
91
91
|
# This endpoint is used for transmitting usage measurement events to either a designated customer or a specific subscription.
|
|
92
92
|
# @param event_input [EventInput] Event payload
|
|
93
93
|
# @param [Hash] opts the optional parameters
|
|
94
|
-
# @return [
|
|
94
|
+
# @return [Event]
|
|
95
95
|
def create_event(event_input, opts = {})
|
|
96
|
-
create_event_with_http_info(event_input, opts)
|
|
97
|
-
|
|
96
|
+
data, _status_code, _headers = create_event_with_http_info(event_input, opts)
|
|
97
|
+
data
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
# Send usage events
|
|
101
101
|
# This endpoint is used for transmitting usage measurement events to either a designated customer or a specific subscription.
|
|
102
102
|
# @param event_input [EventInput] Event payload
|
|
103
103
|
# @param [Hash] opts the optional parameters
|
|
104
|
-
# @return [Array<(
|
|
104
|
+
# @return [Array<(Event, Integer, Hash)>] Event data, response status code and response headers
|
|
105
105
|
def create_event_with_http_info(event_input, opts = {})
|
|
106
106
|
if @api_client.config.debugging
|
|
107
107
|
@api_client.config.logger.debug 'Calling API: EventsApi.create_event ...'
|
|
@@ -133,7 +133,7 @@ module LagoAPI
|
|
|
133
133
|
post_body = opts[:debug_body] || @api_client.object_to_http_body(event_input)
|
|
134
134
|
|
|
135
135
|
# return_type
|
|
136
|
-
return_type = opts[:debug_return_type]
|
|
136
|
+
return_type = opts[:debug_return_type] || 'Event'
|
|
137
137
|
|
|
138
138
|
# auth_names
|
|
139
139
|
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -229,6 +229,69 @@ module LagoAPI
|
|
|
229
229
|
return data, status_code, headers
|
|
230
230
|
end
|
|
231
231
|
|
|
232
|
+
# Retrieve a subscription
|
|
233
|
+
# This endpoint retrieves a specific subscription.
|
|
234
|
+
# @param external_id [String] External ID of the existing subscription
|
|
235
|
+
# @param [Hash] opts the optional parameters
|
|
236
|
+
# @return [Subscription]
|
|
237
|
+
def find_subscription(external_id, opts = {})
|
|
238
|
+
data, _status_code, _headers = find_subscription_with_http_info(external_id, opts)
|
|
239
|
+
data
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# Retrieve a subscription
|
|
243
|
+
# This endpoint retrieves a specific subscription.
|
|
244
|
+
# @param external_id [String] External ID of the existing subscription
|
|
245
|
+
# @param [Hash] opts the optional parameters
|
|
246
|
+
# @return [Array<(Subscription, Integer, Hash)>] Subscription data, response status code and response headers
|
|
247
|
+
def find_subscription_with_http_info(external_id, opts = {})
|
|
248
|
+
if @api_client.config.debugging
|
|
249
|
+
@api_client.config.logger.debug 'Calling API: SubscriptionsApi.find_subscription ...'
|
|
250
|
+
end
|
|
251
|
+
# verify the required parameter 'external_id' is set
|
|
252
|
+
if @api_client.config.client_side_validation && external_id.nil?
|
|
253
|
+
fail ArgumentError, "Missing the required parameter 'external_id' when calling SubscriptionsApi.find_subscription"
|
|
254
|
+
end
|
|
255
|
+
# resource path
|
|
256
|
+
local_var_path = '/subscriptions/{external_id}'.sub('{' + 'external_id' + '}', CGI.escape(external_id.to_s))
|
|
257
|
+
|
|
258
|
+
# query parameters
|
|
259
|
+
query_params = opts[:query_params] || {}
|
|
260
|
+
|
|
261
|
+
# header parameters
|
|
262
|
+
header_params = opts[:header_params] || {}
|
|
263
|
+
# HTTP header 'Accept' (if needed)
|
|
264
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
265
|
+
|
|
266
|
+
# form parameters
|
|
267
|
+
form_params = opts[:form_params] || {}
|
|
268
|
+
|
|
269
|
+
# http body (model)
|
|
270
|
+
post_body = opts[:debug_body]
|
|
271
|
+
|
|
272
|
+
# return_type
|
|
273
|
+
return_type = opts[:debug_return_type] || 'Subscription'
|
|
274
|
+
|
|
275
|
+
# auth_names
|
|
276
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
277
|
+
|
|
278
|
+
new_options = opts.merge(
|
|
279
|
+
:operation => :"SubscriptionsApi.find_subscription",
|
|
280
|
+
:header_params => header_params,
|
|
281
|
+
:query_params => query_params,
|
|
282
|
+
:form_params => form_params,
|
|
283
|
+
:body => post_body,
|
|
284
|
+
:auth_names => auth_names,
|
|
285
|
+
:return_type => return_type
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
289
|
+
if @api_client.config.debugging
|
|
290
|
+
@api_client.config.logger.debug "API called: SubscriptionsApi#find_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
291
|
+
end
|
|
292
|
+
return data, status_code, headers
|
|
293
|
+
end
|
|
294
|
+
|
|
232
295
|
# Update a subscription
|
|
233
296
|
# This endpoint allows you to update a subscription.
|
|
234
297
|
# @param external_id [String] External ID of the existing subscription
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
data/lib/lago_ruby/api_client.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -17,6 +17,7 @@ require 'tempfile'
|
|
|
17
17
|
require 'time'
|
|
18
18
|
require 'typhoeus'
|
|
19
19
|
|
|
20
|
+
|
|
20
21
|
module LagoAPI
|
|
21
22
|
class ApiClient
|
|
22
23
|
# The Configuration object holding settings to be used in the API client.
|
|
@@ -45,9 +46,10 @@ module LagoAPI
|
|
|
45
46
|
# Call an API with given options.
|
|
46
47
|
#
|
|
47
48
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
|
48
|
-
# the data deserialized from response body (
|
|
49
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
|
49
50
|
def call_api(http_method, path, opts = {})
|
|
50
51
|
request = build_request(http_method, path, opts)
|
|
52
|
+
tempfile = download_file(request) if opts[:return_type] == 'File'
|
|
51
53
|
response = request.run
|
|
52
54
|
|
|
53
55
|
if @config.debugging
|
|
@@ -69,7 +71,9 @@ module LagoAPI
|
|
|
69
71
|
end
|
|
70
72
|
end
|
|
71
73
|
|
|
72
|
-
if opts[:return_type]
|
|
74
|
+
if opts[:return_type] == 'File'
|
|
75
|
+
data = tempfile
|
|
76
|
+
elsif opts[:return_type]
|
|
73
77
|
data = deserialize(response, opts[:return_type])
|
|
74
78
|
else
|
|
75
79
|
data = nil
|
|
@@ -125,9 +129,7 @@ module LagoAPI
|
|
|
125
129
|
end
|
|
126
130
|
end
|
|
127
131
|
|
|
128
|
-
|
|
129
|
-
download_file(request) if opts[:return_type] == 'File'
|
|
130
|
-
request
|
|
132
|
+
Typhoeus::Request.new(url, req_opts)
|
|
131
133
|
end
|
|
132
134
|
|
|
133
135
|
# Builds the HTTP request body
|
|
@@ -165,6 +167,8 @@ module LagoAPI
|
|
|
165
167
|
# process can use.
|
|
166
168
|
#
|
|
167
169
|
# @see Configuration#temp_folder_path
|
|
170
|
+
#
|
|
171
|
+
# @return [Tempfile] the tempfile generated
|
|
168
172
|
def download_file(request)
|
|
169
173
|
tempfile = nil
|
|
170
174
|
encoding = nil
|
|
@@ -179,7 +183,6 @@ module LagoAPI
|
|
|
179
183
|
prefix = prefix + '-' unless prefix.end_with?('-')
|
|
180
184
|
encoding = response.body.encoding
|
|
181
185
|
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
|
182
|
-
@tempfile = tempfile
|
|
183
186
|
end
|
|
184
187
|
request.on_body do |chunk|
|
|
185
188
|
chunk.force_encoding(encoding)
|
|
@@ -194,6 +197,8 @@ module LagoAPI
|
|
|
194
197
|
"explicitly with `tempfile.delete`"
|
|
195
198
|
end
|
|
196
199
|
end
|
|
200
|
+
|
|
201
|
+
tempfile
|
|
197
202
|
end
|
|
198
203
|
|
|
199
204
|
# Check if the given MIME is a JSON MIME.
|
|
@@ -214,15 +219,10 @@ module LagoAPI
|
|
|
214
219
|
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
|
215
220
|
def deserialize(response, return_type)
|
|
216
221
|
body = response.body
|
|
217
|
-
|
|
218
|
-
# handle file downloading - return the File instance processed in request callbacks
|
|
219
|
-
# note that response body is empty when the file is written in chunks in request on_body callback
|
|
220
|
-
return @tempfile if return_type == 'File'
|
|
221
|
-
|
|
222
222
|
return nil if body.nil? || body.empty?
|
|
223
223
|
|
|
224
224
|
# return response body directly for String return type
|
|
225
|
-
return body if return_type == 'String'
|
|
225
|
+
return body.to_s if return_type == 'String'
|
|
226
226
|
|
|
227
227
|
# ensuring a default content type
|
|
228
228
|
content_type = response.headers['Content-Type'] || 'application/json'
|
data/lib/lago_ruby/api_error.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -293,5 +293,6 @@ module LagoAPI
|
|
|
293
293
|
url
|
|
294
294
|
end
|
|
295
295
|
|
|
296
|
+
|
|
296
297
|
end
|
|
297
298
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 0.
|
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
|
7
7
|
Contact: tech@getlago.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
|
@@ -166,7 +166,7 @@ module LagoAPI
|
|
|
166
166
|
else # model
|
|
167
167
|
# models (e.g. Pet) or oneOf
|
|
168
168
|
klass = LagoAPI.const_get(type)
|
|
169
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
169
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
170
170
|
end
|
|
171
171
|
end
|
|
172
172
|
|