lago_ruby 0.48.0.pre.beta → 0.51.0.pre.beta
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,221 @@
|
|
1
|
+
=begin
|
2
|
+
#Lago API documentation
|
3
|
+
|
4
|
+
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
7
|
+
Contact: tech@getlago.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module LagoAPI
|
17
|
+
class CreditNoteEstimated
|
18
|
+
attr_accessor :estimated_credit_note
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'estimated_credit_note' => :'estimated_credit_note'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'estimated_credit_note' => :'CreditNoteEstimatedEstimatedCreditNote'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CreditNoteEstimated` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CreditNoteEstimated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'estimated_credit_note')
|
61
|
+
self.estimated_credit_note = attributes[:'estimated_credit_note']
|
62
|
+
else
|
63
|
+
self.estimated_credit_note = nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
+
# @return Array for valid properties with the reasons
|
69
|
+
def list_invalid_properties
|
70
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
71
|
+
invalid_properties = Array.new
|
72
|
+
if @estimated_credit_note.nil?
|
73
|
+
invalid_properties.push('invalid value for "estimated_credit_note", estimated_credit_note cannot be nil.')
|
74
|
+
end
|
75
|
+
|
76
|
+
invalid_properties
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check to see if the all the properties in the model are valid
|
80
|
+
# @return true if the model is valid
|
81
|
+
def valid?
|
82
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
83
|
+
return false if @estimated_credit_note.nil?
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
# Checks equality by comparing each attribute.
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def ==(o)
|
90
|
+
return true if self.equal?(o)
|
91
|
+
self.class == o.class &&
|
92
|
+
estimated_credit_note == o.estimated_credit_note
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[estimated_credit_note].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
return nil unless attributes.is_a?(Hash)
|
112
|
+
attributes = attributes.transform_keys(&:to_sym)
|
113
|
+
transformed_hash = {}
|
114
|
+
openapi_types.each_pair do |key, type|
|
115
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
116
|
+
transformed_hash["#{key}"] = nil
|
117
|
+
elsif type =~ /\AArray<(.*)>/i
|
118
|
+
# check to ensure the input is an array given that the attribute
|
119
|
+
# is documented as an array but the input is not
|
120
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
121
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
122
|
+
end
|
123
|
+
elsif !attributes[attribute_map[key]].nil?
|
124
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
125
|
+
end
|
126
|
+
end
|
127
|
+
new(transformed_hash)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Deserializes the data based on type
|
131
|
+
# @param string type Data type
|
132
|
+
# @param string value Value to be deserialized
|
133
|
+
# @return [Object] Deserialized data
|
134
|
+
def self._deserialize(type, value)
|
135
|
+
case type.to_sym
|
136
|
+
when :Time
|
137
|
+
Time.parse(value)
|
138
|
+
when :Date
|
139
|
+
Date.parse(value)
|
140
|
+
when :String
|
141
|
+
value.to_s
|
142
|
+
when :Integer
|
143
|
+
value.to_i
|
144
|
+
when :Float
|
145
|
+
value.to_f
|
146
|
+
when :Boolean
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
148
|
+
true
|
149
|
+
else
|
150
|
+
false
|
151
|
+
end
|
152
|
+
when :Object
|
153
|
+
# generic object (usually a Hash), return directly
|
154
|
+
value
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
161
|
+
{}.tap do |hash|
|
162
|
+
value.each do |k, v|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else # model
|
167
|
+
# models (e.g. Pet) or oneOf
|
168
|
+
klass = LagoAPI.const_get(type)
|
169
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the string representation of the object
|
174
|
+
# @return [String] String presentation of the object
|
175
|
+
def to_s
|
176
|
+
to_hash.to_s
|
177
|
+
end
|
178
|
+
|
179
|
+
# to_body is an alias to to_hash (backward compatibility)
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_body
|
182
|
+
to_hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the object in the form of hash
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_hash
|
188
|
+
hash = {}
|
189
|
+
self.class.attribute_map.each_pair do |attr, param|
|
190
|
+
value = self.send(attr)
|
191
|
+
if value.nil?
|
192
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
193
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
194
|
+
end
|
195
|
+
|
196
|
+
hash[param] = _to_hash(value)
|
197
|
+
end
|
198
|
+
hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Outputs non-array value in the form of hash
|
202
|
+
# For object, use to_hash. Otherwise, just return the value
|
203
|
+
# @param [Object] value Any valid value
|
204
|
+
# @return [Hash] Returns the value in the form of hash
|
205
|
+
def _to_hash(value)
|
206
|
+
if value.is_a?(Array)
|
207
|
+
value.compact.map { |v| _to_hash(v) }
|
208
|
+
elsif value.is_a?(Hash)
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
211
|
+
end
|
212
|
+
elsif value.respond_to? :to_hash
|
213
|
+
value.to_hash
|
214
|
+
else
|
215
|
+
value
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
@@ -0,0 +1,387 @@
|
|
1
|
+
=begin
|
2
|
+
#Lago API documentation
|
3
|
+
|
4
|
+
#Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.51.0-beta
|
7
|
+
Contact: tech@getlago.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module LagoAPI
|
17
|
+
class CreditNoteEstimatedEstimatedCreditNote
|
18
|
+
# Unique identifier assigned to the invoice that the credit note belongs to
|
19
|
+
attr_accessor :lago_invoice_id
|
20
|
+
|
21
|
+
# The invoice unique number, related to the credit note.
|
22
|
+
attr_accessor :invoice_number
|
23
|
+
|
24
|
+
attr_accessor :currency
|
25
|
+
|
26
|
+
# The tax amount of the credit note, expressed in cents.
|
27
|
+
attr_accessor :taxes_amount_cents
|
28
|
+
|
29
|
+
# The tax rate associated with this specific credit note.
|
30
|
+
attr_accessor :taxes_rate
|
31
|
+
|
32
|
+
# The subtotal of the credit note excluding any applicable taxes, expressed in cents.
|
33
|
+
attr_accessor :sub_total_excluding_taxes_amount_cents
|
34
|
+
|
35
|
+
# The credited amount of the credit note, expressed in cents.
|
36
|
+
attr_accessor :max_creditable_amount_cents
|
37
|
+
|
38
|
+
# The refunded amount of the credit note, expressed in cents.
|
39
|
+
attr_accessor :max_refundable_amount_cents
|
40
|
+
|
41
|
+
# The pro-rated amount of the coupons applied to the source invoice.
|
42
|
+
attr_accessor :coupons_adjustment_amount_cents
|
43
|
+
|
44
|
+
# Array of credit note’s items.
|
45
|
+
attr_accessor :items
|
46
|
+
|
47
|
+
attr_accessor :applied_taxes
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:'lago_invoice_id' => :'lago_invoice_id',
|
53
|
+
:'invoice_number' => :'invoice_number',
|
54
|
+
:'currency' => :'currency',
|
55
|
+
:'taxes_amount_cents' => :'taxes_amount_cents',
|
56
|
+
:'taxes_rate' => :'taxes_rate',
|
57
|
+
:'sub_total_excluding_taxes_amount_cents' => :'sub_total_excluding_taxes_amount_cents',
|
58
|
+
:'max_creditable_amount_cents' => :'max_creditable_amount_cents',
|
59
|
+
:'max_refundable_amount_cents' => :'max_refundable_amount_cents',
|
60
|
+
:'coupons_adjustment_amount_cents' => :'coupons_adjustment_amount_cents',
|
61
|
+
:'items' => :'items',
|
62
|
+
:'applied_taxes' => :'applied_taxes'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns all the JSON keys this model knows about
|
67
|
+
def self.acceptable_attributes
|
68
|
+
attribute_map.values
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute type mapping.
|
72
|
+
def self.openapi_types
|
73
|
+
{
|
74
|
+
:'lago_invoice_id' => :'String',
|
75
|
+
:'invoice_number' => :'String',
|
76
|
+
:'currency' => :'Currency',
|
77
|
+
:'taxes_amount_cents' => :'Integer',
|
78
|
+
:'taxes_rate' => :'Float',
|
79
|
+
:'sub_total_excluding_taxes_amount_cents' => :'Integer',
|
80
|
+
:'max_creditable_amount_cents' => :'Integer',
|
81
|
+
:'max_refundable_amount_cents' => :'Integer',
|
82
|
+
:'coupons_adjustment_amount_cents' => :'Integer',
|
83
|
+
:'items' => :'Array<CreditNoteEstimatedEstimatedCreditNoteItemsInner>',
|
84
|
+
:'applied_taxes' => :'Array<CreditNoteEstimatedEstimatedCreditNoteAppliedTaxesInner>'
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
# List of attributes with nullable: true
|
89
|
+
def self.openapi_nullable
|
90
|
+
Set.new([
|
91
|
+
])
|
92
|
+
end
|
93
|
+
|
94
|
+
# Initializes the object
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
def initialize(attributes = {})
|
97
|
+
if (!attributes.is_a?(Hash))
|
98
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CreditNoteEstimatedEstimatedCreditNote` initialize method"
|
99
|
+
end
|
100
|
+
|
101
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
102
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
103
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
104
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CreditNoteEstimatedEstimatedCreditNote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
105
|
+
end
|
106
|
+
h[k.to_sym] = v
|
107
|
+
}
|
108
|
+
|
109
|
+
if attributes.key?(:'lago_invoice_id')
|
110
|
+
self.lago_invoice_id = attributes[:'lago_invoice_id']
|
111
|
+
else
|
112
|
+
self.lago_invoice_id = nil
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'invoice_number')
|
116
|
+
self.invoice_number = attributes[:'invoice_number']
|
117
|
+
else
|
118
|
+
self.invoice_number = nil
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'currency')
|
122
|
+
self.currency = attributes[:'currency']
|
123
|
+
else
|
124
|
+
self.currency = nil
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'taxes_amount_cents')
|
128
|
+
self.taxes_amount_cents = attributes[:'taxes_amount_cents']
|
129
|
+
else
|
130
|
+
self.taxes_amount_cents = nil
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.key?(:'taxes_rate')
|
134
|
+
self.taxes_rate = attributes[:'taxes_rate']
|
135
|
+
else
|
136
|
+
self.taxes_rate = nil
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'sub_total_excluding_taxes_amount_cents')
|
140
|
+
self.sub_total_excluding_taxes_amount_cents = attributes[:'sub_total_excluding_taxes_amount_cents']
|
141
|
+
else
|
142
|
+
self.sub_total_excluding_taxes_amount_cents = nil
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.key?(:'max_creditable_amount_cents')
|
146
|
+
self.max_creditable_amount_cents = attributes[:'max_creditable_amount_cents']
|
147
|
+
else
|
148
|
+
self.max_creditable_amount_cents = nil
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.key?(:'max_refundable_amount_cents')
|
152
|
+
self.max_refundable_amount_cents = attributes[:'max_refundable_amount_cents']
|
153
|
+
else
|
154
|
+
self.max_refundable_amount_cents = nil
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.key?(:'coupons_adjustment_amount_cents')
|
158
|
+
self.coupons_adjustment_amount_cents = attributes[:'coupons_adjustment_amount_cents']
|
159
|
+
else
|
160
|
+
self.coupons_adjustment_amount_cents = nil
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'items')
|
164
|
+
if (value = attributes[:'items']).is_a?(Array)
|
165
|
+
self.items = value
|
166
|
+
end
|
167
|
+
else
|
168
|
+
self.items = nil
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.key?(:'applied_taxes')
|
172
|
+
if (value = attributes[:'applied_taxes']).is_a?(Array)
|
173
|
+
self.applied_taxes = value
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
179
|
+
# @return Array for valid properties with the reasons
|
180
|
+
def list_invalid_properties
|
181
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
182
|
+
invalid_properties = Array.new
|
183
|
+
if @lago_invoice_id.nil?
|
184
|
+
invalid_properties.push('invalid value for "lago_invoice_id", lago_invoice_id cannot be nil.')
|
185
|
+
end
|
186
|
+
|
187
|
+
if @invoice_number.nil?
|
188
|
+
invalid_properties.push('invalid value for "invoice_number", invoice_number cannot be nil.')
|
189
|
+
end
|
190
|
+
|
191
|
+
if @currency.nil?
|
192
|
+
invalid_properties.push('invalid value for "currency", currency cannot be nil.')
|
193
|
+
end
|
194
|
+
|
195
|
+
if @taxes_amount_cents.nil?
|
196
|
+
invalid_properties.push('invalid value for "taxes_amount_cents", taxes_amount_cents cannot be nil.')
|
197
|
+
end
|
198
|
+
|
199
|
+
if @taxes_rate.nil?
|
200
|
+
invalid_properties.push('invalid value for "taxes_rate", taxes_rate cannot be nil.')
|
201
|
+
end
|
202
|
+
|
203
|
+
if @sub_total_excluding_taxes_amount_cents.nil?
|
204
|
+
invalid_properties.push('invalid value for "sub_total_excluding_taxes_amount_cents", sub_total_excluding_taxes_amount_cents cannot be nil.')
|
205
|
+
end
|
206
|
+
|
207
|
+
if @max_creditable_amount_cents.nil?
|
208
|
+
invalid_properties.push('invalid value for "max_creditable_amount_cents", max_creditable_amount_cents cannot be nil.')
|
209
|
+
end
|
210
|
+
|
211
|
+
if @max_refundable_amount_cents.nil?
|
212
|
+
invalid_properties.push('invalid value for "max_refundable_amount_cents", max_refundable_amount_cents cannot be nil.')
|
213
|
+
end
|
214
|
+
|
215
|
+
if @coupons_adjustment_amount_cents.nil?
|
216
|
+
invalid_properties.push('invalid value for "coupons_adjustment_amount_cents", coupons_adjustment_amount_cents cannot be nil.')
|
217
|
+
end
|
218
|
+
|
219
|
+
if @items.nil?
|
220
|
+
invalid_properties.push('invalid value for "items", items cannot be nil.')
|
221
|
+
end
|
222
|
+
|
223
|
+
invalid_properties
|
224
|
+
end
|
225
|
+
|
226
|
+
# Check to see if the all the properties in the model are valid
|
227
|
+
# @return true if the model is valid
|
228
|
+
def valid?
|
229
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
230
|
+
return false if @lago_invoice_id.nil?
|
231
|
+
return false if @invoice_number.nil?
|
232
|
+
return false if @currency.nil?
|
233
|
+
return false if @taxes_amount_cents.nil?
|
234
|
+
return false if @taxes_rate.nil?
|
235
|
+
return false if @sub_total_excluding_taxes_amount_cents.nil?
|
236
|
+
return false if @max_creditable_amount_cents.nil?
|
237
|
+
return false if @max_refundable_amount_cents.nil?
|
238
|
+
return false if @coupons_adjustment_amount_cents.nil?
|
239
|
+
return false if @items.nil?
|
240
|
+
true
|
241
|
+
end
|
242
|
+
|
243
|
+
# Checks equality by comparing each attribute.
|
244
|
+
# @param [Object] Object to be compared
|
245
|
+
def ==(o)
|
246
|
+
return true if self.equal?(o)
|
247
|
+
self.class == o.class &&
|
248
|
+
lago_invoice_id == o.lago_invoice_id &&
|
249
|
+
invoice_number == o.invoice_number &&
|
250
|
+
currency == o.currency &&
|
251
|
+
taxes_amount_cents == o.taxes_amount_cents &&
|
252
|
+
taxes_rate == o.taxes_rate &&
|
253
|
+
sub_total_excluding_taxes_amount_cents == o.sub_total_excluding_taxes_amount_cents &&
|
254
|
+
max_creditable_amount_cents == o.max_creditable_amount_cents &&
|
255
|
+
max_refundable_amount_cents == o.max_refundable_amount_cents &&
|
256
|
+
coupons_adjustment_amount_cents == o.coupons_adjustment_amount_cents &&
|
257
|
+
items == o.items &&
|
258
|
+
applied_taxes == o.applied_taxes
|
259
|
+
end
|
260
|
+
|
261
|
+
# @see the `==` method
|
262
|
+
# @param [Object] Object to be compared
|
263
|
+
def eql?(o)
|
264
|
+
self == o
|
265
|
+
end
|
266
|
+
|
267
|
+
# Calculates hash code according to all attributes.
|
268
|
+
# @return [Integer] Hash code
|
269
|
+
def hash
|
270
|
+
[lago_invoice_id, invoice_number, currency, taxes_amount_cents, taxes_rate, sub_total_excluding_taxes_amount_cents, max_creditable_amount_cents, max_refundable_amount_cents, coupons_adjustment_amount_cents, items, applied_taxes].hash
|
271
|
+
end
|
272
|
+
|
273
|
+
# Builds the object from hash
|
274
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
275
|
+
# @return [Object] Returns the model itself
|
276
|
+
def self.build_from_hash(attributes)
|
277
|
+
return nil unless attributes.is_a?(Hash)
|
278
|
+
attributes = attributes.transform_keys(&:to_sym)
|
279
|
+
transformed_hash = {}
|
280
|
+
openapi_types.each_pair do |key, type|
|
281
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
282
|
+
transformed_hash["#{key}"] = nil
|
283
|
+
elsif type =~ /\AArray<(.*)>/i
|
284
|
+
# check to ensure the input is an array given that the attribute
|
285
|
+
# is documented as an array but the input is not
|
286
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
287
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
288
|
+
end
|
289
|
+
elsif !attributes[attribute_map[key]].nil?
|
290
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
291
|
+
end
|
292
|
+
end
|
293
|
+
new(transformed_hash)
|
294
|
+
end
|
295
|
+
|
296
|
+
# Deserializes the data based on type
|
297
|
+
# @param string type Data type
|
298
|
+
# @param string value Value to be deserialized
|
299
|
+
# @return [Object] Deserialized data
|
300
|
+
def self._deserialize(type, value)
|
301
|
+
case type.to_sym
|
302
|
+
when :Time
|
303
|
+
Time.parse(value)
|
304
|
+
when :Date
|
305
|
+
Date.parse(value)
|
306
|
+
when :String
|
307
|
+
value.to_s
|
308
|
+
when :Integer
|
309
|
+
value.to_i
|
310
|
+
when :Float
|
311
|
+
value.to_f
|
312
|
+
when :Boolean
|
313
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
314
|
+
true
|
315
|
+
else
|
316
|
+
false
|
317
|
+
end
|
318
|
+
when :Object
|
319
|
+
# generic object (usually a Hash), return directly
|
320
|
+
value
|
321
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
322
|
+
inner_type = Regexp.last_match[:inner_type]
|
323
|
+
value.map { |v| _deserialize(inner_type, v) }
|
324
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
325
|
+
k_type = Regexp.last_match[:k_type]
|
326
|
+
v_type = Regexp.last_match[:v_type]
|
327
|
+
{}.tap do |hash|
|
328
|
+
value.each do |k, v|
|
329
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
330
|
+
end
|
331
|
+
end
|
332
|
+
else # model
|
333
|
+
# models (e.g. Pet) or oneOf
|
334
|
+
klass = LagoAPI.const_get(type)
|
335
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
# Returns the string representation of the object
|
340
|
+
# @return [String] String presentation of the object
|
341
|
+
def to_s
|
342
|
+
to_hash.to_s
|
343
|
+
end
|
344
|
+
|
345
|
+
# to_body is an alias to to_hash (backward compatibility)
|
346
|
+
# @return [Hash] Returns the object in the form of hash
|
347
|
+
def to_body
|
348
|
+
to_hash
|
349
|
+
end
|
350
|
+
|
351
|
+
# Returns the object in the form of hash
|
352
|
+
# @return [Hash] Returns the object in the form of hash
|
353
|
+
def to_hash
|
354
|
+
hash = {}
|
355
|
+
self.class.attribute_map.each_pair do |attr, param|
|
356
|
+
value = self.send(attr)
|
357
|
+
if value.nil?
|
358
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
359
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
360
|
+
end
|
361
|
+
|
362
|
+
hash[param] = _to_hash(value)
|
363
|
+
end
|
364
|
+
hash
|
365
|
+
end
|
366
|
+
|
367
|
+
# Outputs non-array value in the form of hash
|
368
|
+
# For object, use to_hash. Otherwise, just return the value
|
369
|
+
# @param [Object] value Any valid value
|
370
|
+
# @return [Hash] Returns the value in the form of hash
|
371
|
+
def _to_hash(value)
|
372
|
+
if value.is_a?(Array)
|
373
|
+
value.compact.map { |v| _to_hash(v) }
|
374
|
+
elsif value.is_a?(Hash)
|
375
|
+
{}.tap do |hash|
|
376
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
377
|
+
end
|
378
|
+
elsif value.respond_to? :to_hash
|
379
|
+
value.to_hash
|
380
|
+
else
|
381
|
+
value
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
end
|
386
|
+
|
387
|
+
end
|