lago_ruby 0.49.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.
Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +16 -6
  4. data/docs/CreditNoteCreateInputCreditNote.md +1 -1
  5. data/docs/CreditNoteEstimateInput.md +18 -0
  6. data/docs/CreditNoteEstimateInputCreditNote.md +20 -0
  7. data/docs/CreditNoteEstimateInputCreditNoteItemsInner.md +20 -0
  8. data/docs/CreditNoteEstimated.md +18 -0
  9. data/docs/CreditNoteEstimatedEstimatedCreditNote.md +38 -0
  10. data/docs/CreditNoteEstimatedEstimatedCreditNoteAppliedTaxesInner.md +32 -0
  11. data/docs/CreditNoteEstimatedEstimatedCreditNoteItemsInner.md +20 -0
  12. data/docs/CreditNoteItemObjectFee.md +2 -0
  13. data/docs/CreditNoteObject.md +2 -2
  14. data/docs/CreditNotesApi.md +72 -0
  15. data/docs/EventsApi.md +7 -6
  16. data/docs/FeeObject.md +2 -0
  17. data/docs/FeeObjectItem.md +2 -0
  18. data/docs/PlanOverridesObject.md +32 -0
  19. data/docs/PlanOverridesObjectChargesInner.md +28 -0
  20. data/docs/Subscription.md +1 -1
  21. data/docs/SubscriptionCreateInputSubscription.md +3 -1
  22. data/docs/SubscriptionObjectExtended.md +52 -0
  23. data/docs/SubscriptionUpdateInputSubscription.md +3 -1
  24. data/lago_ruby.gemspec +1 -1
  25. data/lib/lago_ruby/api/add_ons_api.rb +1 -1
  26. data/lib/lago_ruby/api/billable_metrics_api.rb +1 -1
  27. data/lib/lago_ruby/api/coupons_api.rb +1 -1
  28. data/lib/lago_ruby/api/credit_notes_api.rb +65 -1
  29. data/lib/lago_ruby/api/customers_api.rb +1 -1
  30. data/lib/lago_ruby/api/events_api.rb +6 -6
  31. data/lib/lago_ruby/api/fees_api.rb +1 -1
  32. data/lib/lago_ruby/api/invoices_api.rb +1 -1
  33. data/lib/lago_ruby/api/organizations_api.rb +1 -1
  34. data/lib/lago_ruby/api/plans_api.rb +1 -1
  35. data/lib/lago_ruby/api/subscriptions_api.rb +1 -1
  36. data/lib/lago_ruby/api/taxes_api.rb +1 -1
  37. data/lib/lago_ruby/api/wallets_api.rb +1 -1
  38. data/lib/lago_ruby/api/webhook_endpoints_api.rb +1 -1
  39. data/lib/lago_ruby/api/webhooks_api.rb +1 -1
  40. data/lib/lago_ruby/api_client.rb +11 -12
  41. data/lib/lago_ruby/api_error.rb +1 -1
  42. data/lib/lago_ruby/configuration.rb +1 -1
  43. data/lib/lago_ruby/models/add_on.rb +2 -2
  44. data/lib/lago_ruby/models/add_on_base_input.rb +2 -2
  45. data/lib/lago_ruby/models/add_on_create_input.rb +2 -2
  46. data/lib/lago_ruby/models/add_on_create_input_add_on.rb +2 -2
  47. data/lib/lago_ruby/models/add_on_object.rb +2 -2
  48. data/lib/lago_ruby/models/add_on_update_input.rb +2 -2
  49. data/lib/lago_ruby/models/add_ons_paginated.rb +2 -2
  50. data/lib/lago_ruby/models/api_error_bad_request.rb +2 -2
  51. data/lib/lago_ruby/models/api_error_forbidden.rb +2 -2
  52. data/lib/lago_ruby/models/api_error_not_allowed.rb +2 -2
  53. data/lib/lago_ruby/models/api_error_not_found.rb +2 -2
  54. data/lib/lago_ruby/models/api_error_unauthorized.rb +2 -2
  55. data/lib/lago_ruby/models/api_error_unprocessable_entity.rb +2 -2
  56. data/lib/lago_ruby/models/applied_coupon.rb +2 -2
  57. data/lib/lago_ruby/models/applied_coupon_input.rb +2 -2
  58. data/lib/lago_ruby/models/applied_coupon_input_applied_coupon.rb +2 -2
  59. data/lib/lago_ruby/models/applied_coupon_object.rb +2 -2
  60. data/lib/lago_ruby/models/applied_coupon_object_extended.rb +2 -2
  61. data/lib/lago_ruby/models/applied_coupons_paginated.rb +2 -2
  62. data/lib/lago_ruby/models/base_applied_tax.rb +2 -2
  63. data/lib/lago_ruby/models/billable_metric.rb +2 -2
  64. data/lib/lago_ruby/models/billable_metric_base_input.rb +2 -2
  65. data/lib/lago_ruby/models/billable_metric_create_input.rb +2 -2
  66. data/lib/lago_ruby/models/billable_metric_create_input_billable_metric.rb +2 -2
  67. data/lib/lago_ruby/models/billable_metric_group.rb +2 -2
  68. data/lib/lago_ruby/models/billable_metric_group_values_inner.rb +1 -1
  69. data/lib/lago_ruby/models/billable_metric_group_values_inner_one_of.rb +2 -2
  70. data/lib/lago_ruby/models/billable_metric_object.rb +2 -2
  71. data/lib/lago_ruby/models/billable_metric_update_input.rb +2 -2
  72. data/lib/lago_ruby/models/billable_metrics_paginated.rb +2 -2
  73. data/lib/lago_ruby/models/charge_object.rb +2 -2
  74. data/lib/lago_ruby/models/charge_object_properties.rb +2 -2
  75. data/lib/lago_ruby/models/charge_properties.rb +2 -2
  76. data/lib/lago_ruby/models/charge_properties_graduated_percentage_ranges_inner.rb +2 -2
  77. data/lib/lago_ruby/models/charge_properties_graduated_ranges_inner.rb +2 -2
  78. data/lib/lago_ruby/models/charge_properties_volume_ranges_inner.rb +2 -2
  79. data/lib/lago_ruby/models/country.rb +1 -1
  80. data/lib/lago_ruby/models/coupon.rb +2 -2
  81. data/lib/lago_ruby/models/coupon_base_input.rb +2 -2
  82. data/lib/lago_ruby/models/coupon_base_input_applies_to.rb +2 -2
  83. data/lib/lago_ruby/models/coupon_create_input.rb +2 -2
  84. data/lib/lago_ruby/models/coupon_create_input_coupon.rb +2 -2
  85. data/lib/lago_ruby/models/coupon_object.rb +2 -2
  86. data/lib/lago_ruby/models/coupon_update_input.rb +2 -2
  87. data/lib/lago_ruby/models/coupons_paginated.rb +2 -2
  88. data/lib/lago_ruby/models/credit_note.rb +2 -2
  89. data/lib/lago_ruby/models/credit_note_applied_tax_object.rb +2 -2
  90. data/lib/lago_ruby/models/credit_note_create_input.rb +2 -2
  91. data/lib/lago_ruby/models/credit_note_create_input_credit_note.rb +3 -3
  92. data/lib/lago_ruby/models/credit_note_estimate_input.rb +221 -0
  93. data/lib/lago_ruby/models/credit_note_estimate_input_credit_note.rb +241 -0
  94. data/lib/lago_ruby/models/credit_note_estimate_input_credit_note_items_inner.rb +239 -0
  95. data/lib/lago_ruby/models/credit_note_estimated.rb +221 -0
  96. data/lib/lago_ruby/models/credit_note_estimated_estimated_credit_note.rb +387 -0
  97. data/lib/lago_ruby/models/credit_note_estimated_estimated_credit_note_applied_taxes_inner.rb +283 -0
  98. data/lib/lago_ruby/models/credit_note_estimated_estimated_credit_note_items_inner.rb +235 -0
  99. data/lib/lago_ruby/models/credit_note_item_object.rb +2 -2
  100. data/lib/lago_ruby/models/credit_note_item_object_fee.rb +20 -3
  101. data/lib/lago_ruby/models/credit_note_object.rb +13 -13
  102. data/lib/lago_ruby/models/credit_note_update_input.rb +2 -2
  103. data/lib/lago_ruby/models/credit_note_update_input_credit_note.rb +2 -2
  104. data/lib/lago_ruby/models/credit_notes.rb +2 -2
  105. data/lib/lago_ruby/models/credit_object.rb +2 -2
  106. data/lib/lago_ruby/models/credit_object_invoice.rb +2 -2
  107. data/lib/lago_ruby/models/credit_object_item.rb +2 -2
  108. data/lib/lago_ruby/models/currency.rb +1 -1
  109. data/lib/lago_ruby/models/customer.rb +2 -2
  110. data/lib/lago_ruby/models/customer_billing_configuration.rb +2 -2
  111. data/lib/lago_ruby/models/customer_charge_usage_object.rb +2 -2
  112. data/lib/lago_ruby/models/customer_charge_usage_object_billable_metric.rb +2 -2
  113. data/lib/lago_ruby/models/customer_charge_usage_object_charge.rb +2 -2
  114. data/lib/lago_ruby/models/customer_charge_usage_object_groups_inner.rb +2 -2
  115. data/lib/lago_ruby/models/customer_create_input.rb +2 -2
  116. data/lib/lago_ruby/models/customer_create_input_customer.rb +2 -2
  117. data/lib/lago_ruby/models/customer_create_input_customer_metadata_inner.rb +2 -2
  118. data/lib/lago_ruby/models/customer_metadata.rb +2 -2
  119. data/lib/lago_ruby/models/customer_object.rb +2 -2
  120. data/lib/lago_ruby/models/customer_object_extended.rb +2 -2
  121. data/lib/lago_ruby/models/customer_past_usage.rb +2 -2
  122. data/lib/lago_ruby/models/customer_usage.rb +2 -2
  123. data/lib/lago_ruby/models/customer_usage_object.rb +2 -2
  124. data/lib/lago_ruby/models/customers_paginated.rb +2 -2
  125. data/lib/lago_ruby/models/event.rb +2 -2
  126. data/lib/lago_ruby/models/event_batch_input.rb +2 -2
  127. data/lib/lago_ruby/models/event_batch_input_event.rb +2 -2
  128. data/lib/lago_ruby/models/event_batch_input_event_properties.rb +2 -2
  129. data/lib/lago_ruby/models/event_estimate_fees_input.rb +2 -2
  130. data/lib/lago_ruby/models/event_estimate_fees_input_event.rb +2 -2
  131. data/lib/lago_ruby/models/event_input.rb +2 -2
  132. data/lib/lago_ruby/models/event_input_event.rb +2 -2
  133. data/lib/lago_ruby/models/event_input_event_timestamp.rb +1 -1
  134. data/lib/lago_ruby/models/event_object.rb +6 -22
  135. data/lib/lago_ruby/models/event_object_properties.rb +2 -2
  136. data/lib/lago_ruby/models/fee.rb +2 -2
  137. data/lib/lago_ruby/models/fee_applied_tax_object.rb +2 -2
  138. data/lib/lago_ruby/models/fee_object.rb +20 -3
  139. data/lib/lago_ruby/models/fee_object_item.rb +13 -3
  140. data/lib/lago_ruby/models/fee_update_input.rb +2 -2
  141. data/lib/lago_ruby/models/fee_update_input_fee.rb +2 -2
  142. data/lib/lago_ruby/models/fees.rb +2 -2
  143. data/lib/lago_ruby/models/fees_paginated.rb +2 -2
  144. data/lib/lago_ruby/models/get_customer_portal_url200_response.rb +2 -2
  145. data/lib/lago_ruby/models/get_customer_portal_url200_response_customer.rb +2 -2
  146. data/lib/lago_ruby/models/group_object.rb +2 -2
  147. data/lib/lago_ruby/models/group_properties_object.rb +2 -2
  148. data/lib/lago_ruby/models/group_properties_object_values.rb +2 -2
  149. data/lib/lago_ruby/models/groups_paginated.rb +2 -2
  150. data/lib/lago_ruby/models/invoice.rb +2 -2
  151. data/lib/lago_ruby/models/invoice_applied_tax_object.rb +2 -2
  152. data/lib/lago_ruby/models/invoice_metadata_object.rb +2 -2
  153. data/lib/lago_ruby/models/invoice_object.rb +2 -2
  154. data/lib/lago_ruby/models/invoice_object_customer.rb +2 -2
  155. data/lib/lago_ruby/models/invoice_object_extended.rb +2 -2
  156. data/lib/lago_ruby/models/invoice_one_off_create_input.rb +2 -2
  157. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice.rb +2 -2
  158. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice_fees_inner.rb +2 -2
  159. data/lib/lago_ruby/models/invoice_update_input.rb +2 -2
  160. data/lib/lago_ruby/models/invoice_update_input_invoice.rb +2 -2
  161. data/lib/lago_ruby/models/invoice_update_input_invoice_metadata_inner.rb +2 -2
  162. data/lib/lago_ruby/models/invoices_paginated.rb +2 -2
  163. data/lib/lago_ruby/models/organization.rb +2 -2
  164. data/lib/lago_ruby/models/organization_billing_configuration.rb +2 -2
  165. data/lib/lago_ruby/models/organization_object.rb +2 -2
  166. data/lib/lago_ruby/models/organization_update_input.rb +2 -2
  167. data/lib/lago_ruby/models/organization_update_input_organization.rb +2 -2
  168. data/lib/lago_ruby/models/pagination_meta.rb +2 -2
  169. data/lib/lago_ruby/models/plan.rb +2 -2
  170. data/lib/lago_ruby/models/plan_create_input.rb +2 -2
  171. data/lib/lago_ruby/models/plan_create_input_plan.rb +2 -2
  172. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner.rb +2 -2
  173. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner_group_properties_inner.rb +2 -2
  174. data/lib/lago_ruby/models/plan_object.rb +2 -2
  175. data/lib/lago_ruby/models/plan_overrides_object.rb +289 -0
  176. data/lib/lago_ruby/models/plan_overrides_object_charges_inner.rb +268 -0
  177. data/lib/lago_ruby/models/plan_update_input.rb +2 -2
  178. data/lib/lago_ruby/models/plan_update_input_plan.rb +2 -2
  179. data/lib/lago_ruby/models/plan_update_input_plan_charges_inner.rb +2 -2
  180. data/lib/lago_ruby/models/plans_paginated.rb +2 -2
  181. data/lib/lago_ruby/models/subscription.rb +3 -3
  182. data/lib/lago_ruby/models/subscription_create_input.rb +2 -2
  183. data/lib/lago_ruby/models/subscription_create_input_subscription.rb +15 -6
  184. data/lib/lago_ruby/models/subscription_object.rb +2 -2
  185. data/lib/lago_ruby/models/subscription_object_extended.rb +507 -0
  186. data/lib/lago_ruby/models/subscription_update_input.rb +2 -2
  187. data/lib/lago_ruby/models/subscription_update_input_subscription.rb +15 -6
  188. data/lib/lago_ruby/models/subscriptions_paginated.rb +2 -2
  189. data/lib/lago_ruby/models/tax.rb +2 -2
  190. data/lib/lago_ruby/models/tax_base_input.rb +2 -2
  191. data/lib/lago_ruby/models/tax_create_input.rb +2 -2
  192. data/lib/lago_ruby/models/tax_create_input_tax.rb +2 -2
  193. data/lib/lago_ruby/models/tax_object.rb +2 -2
  194. data/lib/lago_ruby/models/tax_update_input.rb +2 -2
  195. data/lib/lago_ruby/models/taxes_paginated.rb +2 -2
  196. data/lib/lago_ruby/models/timezone.rb +1 -1
  197. data/lib/lago_ruby/models/wallet.rb +2 -2
  198. data/lib/lago_ruby/models/wallet_create_input.rb +2 -2
  199. data/lib/lago_ruby/models/wallet_create_input_wallet.rb +2 -2
  200. data/lib/lago_ruby/models/wallet_object.rb +2 -2
  201. data/lib/lago_ruby/models/wallet_transaction_create_input.rb +2 -2
  202. data/lib/lago_ruby/models/wallet_transaction_create_input_wallet_transaction.rb +2 -2
  203. data/lib/lago_ruby/models/wallet_transaction_object.rb +2 -2
  204. data/lib/lago_ruby/models/wallet_transactions.rb +2 -2
  205. data/lib/lago_ruby/models/wallet_transactions_paginated.rb +2 -2
  206. data/lib/lago_ruby/models/wallet_update_input.rb +2 -2
  207. data/lib/lago_ruby/models/wallet_update_input_wallet.rb +2 -2
  208. data/lib/lago_ruby/models/wallets_paginated.rb +2 -2
  209. data/lib/lago_ruby/models/webhook_endpoint.rb +2 -2
  210. data/lib/lago_ruby/models/webhook_endpoint_create_input.rb +2 -2
  211. data/lib/lago_ruby/models/webhook_endpoint_create_input_webhook_endpoint.rb +2 -2
  212. data/lib/lago_ruby/models/webhook_endpoint_object.rb +2 -2
  213. data/lib/lago_ruby/models/webhook_endpoint_update_input.rb +2 -2
  214. data/lib/lago_ruby/models/webhook_endpoints_paginated.rb +2 -2
  215. data/lib/lago_ruby/version.rb +2 -2
  216. data/lib/lago_ruby.rb +11 -2
  217. data/spec/api_client_spec.rb +1 -1
  218. data/spec/configuration_spec.rb +1 -1
  219. 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
  220. data/spec/models/credit_note_estimate_input_credit_note_spec.rb +42 -0
  221. data/spec/models/credit_note_estimate_input_spec.rb +36 -0
  222. data/spec/models/credit_note_estimated_estimated_credit_note_applied_taxes_inner_spec.rb +78 -0
  223. data/spec/models/credit_note_estimated_estimated_credit_note_items_inner_spec.rb +42 -0
  224. data/spec/models/credit_note_estimated_estimated_credit_note_spec.rb +96 -0
  225. data/spec/models/credit_note_estimated_spec.rb +36 -0
  226. data/spec/models/plan_overrides_object_charges_inner_spec.rb +66 -0
  227. data/spec/models/plan_overrides_object_spec.rb +78 -0
  228. data/spec/models/subscription_object_extended_spec.rb +146 -0
  229. data/spec/spec_helper.rb +1 -1
  230. metadata +197 -159
@@ -0,0 +1,283 @@
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 CreditNoteEstimatedEstimatedCreditNoteAppliedTaxesInner
18
+ # Unique identifier of the tax, created by Lago.
19
+ attr_accessor :lago_tax_id
20
+
21
+ # Name of the tax.
22
+ attr_accessor :tax_name
23
+
24
+ # Unique code used to identify the tax associated with the API request.
25
+ attr_accessor :tax_code
26
+
27
+ # The percentage rate of the tax
28
+ attr_accessor :tax_rate
29
+
30
+ # Internal description of the taxe
31
+ attr_accessor :tax_description
32
+
33
+ attr_accessor :base_amount_cents
34
+
35
+ # Amount of the tax
36
+ attr_accessor :amount_cents
37
+
38
+ attr_accessor :amount_currency
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'lago_tax_id' => :'lago_tax_id',
44
+ :'tax_name' => :'tax_name',
45
+ :'tax_code' => :'tax_code',
46
+ :'tax_rate' => :'tax_rate',
47
+ :'tax_description' => :'tax_description',
48
+ :'base_amount_cents' => :'base_amount_cents',
49
+ :'amount_cents' => :'amount_cents',
50
+ :'amount_currency' => :'amount_currency'
51
+ }
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'lago_tax_id' => :'String',
63
+ :'tax_name' => :'String',
64
+ :'tax_code' => :'String',
65
+ :'tax_rate' => :'Float',
66
+ :'tax_description' => :'String',
67
+ :'base_amount_cents' => :'Integer',
68
+ :'amount_cents' => :'Integer',
69
+ :'amount_currency' => :'Currency'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CreditNoteEstimatedEstimatedCreditNoteAppliedTaxesInner` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CreditNoteEstimatedEstimatedCreditNoteAppliedTaxesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'lago_tax_id')
95
+ self.lago_tax_id = attributes[:'lago_tax_id']
96
+ end
97
+
98
+ if attributes.key?(:'tax_name')
99
+ self.tax_name = attributes[:'tax_name']
100
+ end
101
+
102
+ if attributes.key?(:'tax_code')
103
+ self.tax_code = attributes[:'tax_code']
104
+ end
105
+
106
+ if attributes.key?(:'tax_rate')
107
+ self.tax_rate = attributes[:'tax_rate']
108
+ end
109
+
110
+ if attributes.key?(:'tax_description')
111
+ self.tax_description = attributes[:'tax_description']
112
+ end
113
+
114
+ if attributes.key?(:'base_amount_cents')
115
+ self.base_amount_cents = attributes[:'base_amount_cents']
116
+ end
117
+
118
+ if attributes.key?(:'amount_cents')
119
+ self.amount_cents = attributes[:'amount_cents']
120
+ end
121
+
122
+ if attributes.key?(:'amount_currency')
123
+ self.amount_currency = attributes[:'amount_currency']
124
+ end
125
+ end
126
+
127
+ # Show invalid properties with the reasons. Usually used together with valid?
128
+ # @return Array for valid properties with the reasons
129
+ def list_invalid_properties
130
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
131
+ invalid_properties = Array.new
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ warn '[DEPRECATED] the `valid?` method is obsolete'
139
+ true
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ lago_tax_id == o.lago_tax_id &&
148
+ tax_name == o.tax_name &&
149
+ tax_code == o.tax_code &&
150
+ tax_rate == o.tax_rate &&
151
+ tax_description == o.tax_description &&
152
+ base_amount_cents == o.base_amount_cents &&
153
+ amount_cents == o.amount_cents &&
154
+ amount_currency == o.amount_currency
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [lago_tax_id, tax_name, tax_code, tax_rate, tax_description, base_amount_cents, amount_cents, amount_currency].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ attributes = attributes.transform_keys(&:to_sym)
175
+ transformed_hash = {}
176
+ openapi_types.each_pair do |key, type|
177
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = nil
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[attribute_map[key]].is_a?(Array)
183
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
184
+ end
185
+ elsif !attributes[attribute_map[key]].nil?
186
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
187
+ end
188
+ end
189
+ new(transformed_hash)
190
+ end
191
+
192
+ # Deserializes the data based on type
193
+ # @param string type Data type
194
+ # @param string value Value to be deserialized
195
+ # @return [Object] Deserialized data
196
+ def self._deserialize(type, value)
197
+ case type.to_sym
198
+ when :Time
199
+ Time.parse(value)
200
+ when :Date
201
+ Date.parse(value)
202
+ when :String
203
+ value.to_s
204
+ when :Integer
205
+ value.to_i
206
+ when :Float
207
+ value.to_f
208
+ when :Boolean
209
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
+ true
211
+ else
212
+ false
213
+ end
214
+ when :Object
215
+ # generic object (usually a Hash), return directly
216
+ value
217
+ when /\AArray<(?<inner_type>.+)>\z/
218
+ inner_type = Regexp.last_match[:inner_type]
219
+ value.map { |v| _deserialize(inner_type, v) }
220
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
+ k_type = Regexp.last_match[:k_type]
222
+ v_type = Regexp.last_match[:v_type]
223
+ {}.tap do |hash|
224
+ value.each do |k, v|
225
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
+ end
227
+ end
228
+ else # model
229
+ # models (e.g. Pet) or oneOf
230
+ klass = LagoAPI.const_get(type)
231
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # to_body is an alias to to_hash (backward compatibility)
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_body
244
+ to_hash
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ if value.nil?
254
+ is_nullable = self.class.openapi_nullable.include?(attr)
255
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
256
+ end
257
+
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map { |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+
281
+ end
282
+
283
+ end
@@ -0,0 +1,235 @@
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 CreditNoteEstimatedEstimatedCreditNoteItemsInner
18
+ # The credit note’s item amount, expressed in cents.
19
+ attr_accessor :amount_cents
20
+
21
+ # Unique identifier assigned to the fee within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the fee’s record within the Lago system.
22
+ attr_accessor :lago_fee_id
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'amount_cents' => :'amount_cents',
28
+ :'lago_fee_id' => :'lago_fee_id'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'amount_cents' => :'Integer',
41
+ :'lago_fee_id' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ :'lago_fee_id'
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CreditNoteEstimatedEstimatedCreditNoteItemsInner` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CreditNoteEstimatedEstimatedCreditNoteItemsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'amount_cents')
68
+ self.amount_cents = attributes[:'amount_cents']
69
+ else
70
+ self.amount_cents = nil
71
+ end
72
+
73
+ if attributes.key?(:'lago_fee_id')
74
+ self.lago_fee_id = attributes[:'lago_fee_id']
75
+ else
76
+ self.lago_fee_id = nil
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
+ invalid_properties = Array.new
85
+ if @amount_cents.nil?
86
+ invalid_properties.push('invalid value for "amount_cents", amount_cents cannot be nil.')
87
+ end
88
+
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ warn '[DEPRECATED] the `valid?` method is obsolete'
96
+ return false if @amount_cents.nil?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ amount_cents == o.amount_cents &&
106
+ lago_fee_id == o.lago_fee_id
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(o)
112
+ self == o
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Integer] Hash code
117
+ def hash
118
+ [amount_cents, lago_fee_id].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def self.build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ attributes = attributes.transform_keys(&:to_sym)
127
+ transformed_hash = {}
128
+ openapi_types.each_pair do |key, type|
129
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
130
+ transformed_hash["#{key}"] = nil
131
+ elsif type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[attribute_map[key]].is_a?(Array)
135
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
136
+ end
137
+ elsif !attributes[attribute_map[key]].nil?
138
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
139
+ end
140
+ end
141
+ new(transformed_hash)
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def self._deserialize(type, value)
149
+ case type.to_sym
150
+ when :Time
151
+ Time.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :Boolean
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ # models (e.g. Pet) or oneOf
182
+ klass = LagoAPI.const_get(type)
183
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
184
+ end
185
+ end
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ 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.49.0-beta
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
@@ -216,7 +216,7 @@ module LagoAPI
216
216
  else # model
217
217
  # models (e.g. Pet) or oneOf
218
218
  klass = LagoAPI.const_get(type)
219
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
219
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
220
  end
221
221
  end
222
222
 
@@ -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.49.0-beta
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
@@ -59,6 +59,9 @@ module LagoAPI
59
59
  # The number of units used to charge the customer. This field indicates the quantity or count of units consumed or utilized in the context of the charge. It helps in determining the basis for calculating the fee or cost associated with the usage of the service or product provided to the customer.
60
60
  attr_accessor :units
61
61
 
62
+ # The unit amount of the fee per unit, with precision.
63
+ attr_accessor :precise_unit_amount
64
+
62
65
  # The cost of this specific fee, including any applicable taxes.
63
66
  attr_accessor :total_amount_cents
64
67
 
@@ -142,6 +145,7 @@ module LagoAPI
142
145
  :'taxes_amount_cents' => :'taxes_amount_cents',
143
146
  :'taxes_rate' => :'taxes_rate',
144
147
  :'units' => :'units',
148
+ :'precise_unit_amount' => :'precise_unit_amount',
145
149
  :'total_amount_cents' => :'total_amount_cents',
146
150
  :'total_amount_currency' => :'total_amount_currency',
147
151
  :'events_count' => :'events_count',
@@ -183,6 +187,7 @@ module LagoAPI
183
187
  :'taxes_amount_cents' => :'Integer',
184
188
  :'taxes_rate' => :'Float',
185
189
  :'units' => :'String',
190
+ :'precise_unit_amount' => :'String',
186
191
  :'total_amount_cents' => :'Integer',
187
192
  :'total_amount_currency' => :'Currency',
188
193
  :'events_count' => :'Integer',
@@ -315,6 +320,12 @@ module LagoAPI
315
320
  self.units = nil
316
321
  end
317
322
 
323
+ if attributes.key?(:'precise_unit_amount')
324
+ self.precise_unit_amount = attributes[:'precise_unit_amount']
325
+ else
326
+ self.precise_unit_amount = nil
327
+ end
328
+
318
329
  if attributes.key?(:'total_amount_cents')
319
330
  self.total_amount_cents = attributes[:'total_amount_cents']
320
331
  else
@@ -415,6 +426,10 @@ module LagoAPI
415
426
  invalid_properties.push('invalid value for "units", units cannot be nil.')
416
427
  end
417
428
 
429
+ if @precise_unit_amount.nil?
430
+ invalid_properties.push('invalid value for "precise_unit_amount", precise_unit_amount cannot be nil.')
431
+ end
432
+
418
433
  if @total_amount_cents.nil?
419
434
  invalid_properties.push('invalid value for "total_amount_cents", total_amount_cents cannot be nil.')
420
435
  end
@@ -451,6 +466,7 @@ module LagoAPI
451
466
  return false if @taxes_amount_cents.nil?
452
467
  return false if @taxes_rate.nil?
453
468
  return false if @units.nil?
469
+ return false if @precise_unit_amount.nil?
454
470
  return false if @total_amount_cents.nil?
455
471
  return false if @total_amount_currency.nil?
456
472
  return false if @pay_in_advance.nil?
@@ -492,6 +508,7 @@ module LagoAPI
492
508
  taxes_amount_cents == o.taxes_amount_cents &&
493
509
  taxes_rate == o.taxes_rate &&
494
510
  units == o.units &&
511
+ precise_unit_amount == o.precise_unit_amount &&
495
512
  total_amount_cents == o.total_amount_cents &&
496
513
  total_amount_currency == o.total_amount_currency &&
497
514
  events_count == o.events_count &&
@@ -518,7 +535,7 @@ module LagoAPI
518
535
  # Calculates hash code according to all attributes.
519
536
  # @return [Integer] Hash code
520
537
  def hash
521
- [lago_id, lago_group_id, lago_invoice_id, lago_true_up_fee_id, lago_true_up_parent_fee_id, lago_subscription_id, lago_customer_id, external_customer_id, external_subscription_id, invoice_display_name, amount_cents, amount_currency, taxes_amount_cents, taxes_rate, units, total_amount_cents, total_amount_currency, events_count, pay_in_advance, invoiceable, from_date, to_date, payment_status, created_at, succeeded_at, failed_at, refunded_at, event_transaction_id, item, applied_taxes].hash
538
+ [lago_id, lago_group_id, lago_invoice_id, lago_true_up_fee_id, lago_true_up_parent_fee_id, lago_subscription_id, lago_customer_id, external_customer_id, external_subscription_id, invoice_display_name, amount_cents, amount_currency, taxes_amount_cents, taxes_rate, units, precise_unit_amount, total_amount_cents, total_amount_currency, events_count, pay_in_advance, invoiceable, from_date, to_date, payment_status, created_at, succeeded_at, failed_at, refunded_at, event_transaction_id, item, applied_taxes].hash
522
539
  end
523
540
 
524
541
  # Builds the object from hash
@@ -583,7 +600,7 @@ module LagoAPI
583
600
  else # model
584
601
  # models (e.g. Pet) or oneOf
585
602
  klass = LagoAPI.const_get(type)
586
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
603
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
587
604
  end
588
605
  end
589
606