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.
Files changed (252) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +19 -6
  4. data/docs/AddOnBaseInput.md +2 -0
  5. data/docs/AddOnCreateInputAddOn.md +2 -0
  6. data/docs/AddOnObject.md +2 -0
  7. data/docs/BillableMetricBaseInput.md +1 -1
  8. data/docs/BillableMetricCreateInputBillableMetric.md +1 -1
  9. data/docs/BillableMetricObject.md +1 -1
  10. data/docs/ChargeObject.md +2 -0
  11. data/docs/CreditNoteCreateInputCreditNote.md +1 -1
  12. data/docs/CreditNoteEstimateInput.md +18 -0
  13. data/docs/CreditNoteEstimateInputCreditNote.md +20 -0
  14. data/docs/CreditNoteEstimateInputCreditNoteItemsInner.md +20 -0
  15. data/docs/CreditNoteEstimated.md +18 -0
  16. data/docs/CreditNoteEstimatedEstimatedCreditNote.md +38 -0
  17. data/docs/CreditNoteEstimatedEstimatedCreditNoteAppliedTaxesInner.md +32 -0
  18. data/docs/CreditNoteEstimatedEstimatedCreditNoteItemsInner.md +20 -0
  19. data/docs/CreditNoteItemObjectFee.md +4 -0
  20. data/docs/CreditNoteObject.md +2 -2
  21. data/docs/CreditNotesApi.md +72 -0
  22. data/docs/CustomerChargeUsageObject.md +2 -0
  23. data/docs/CustomerChargeUsageObjectGroupsInner.md +2 -0
  24. data/docs/CustomerPastUsage.md +20 -0
  25. data/docs/CustomerUsageObject.md +2 -0
  26. data/docs/CustomersApi.md +82 -0
  27. data/docs/EventsApi.md +7 -6
  28. data/docs/FeeObject.md +4 -0
  29. data/docs/FeeObjectItem.md +4 -0
  30. data/docs/GroupPropertiesObject.md +2 -0
  31. data/docs/InvoiceOneOffCreateInputInvoiceFeesInner.md +2 -0
  32. data/docs/PlanCreateInputPlan.md +3 -1
  33. data/docs/PlanCreateInputPlanChargesInner.md +2 -0
  34. data/docs/PlanObject.md +3 -1
  35. data/docs/PlanOverridesObject.md +32 -0
  36. data/docs/PlanOverridesObjectChargesInner.md +28 -0
  37. data/docs/PlanUpdateInputPlan.md +3 -1
  38. data/docs/PlanUpdateInputPlanChargesInner.md +2 -0
  39. data/docs/Subscription.md +1 -1
  40. data/docs/SubscriptionCreateInputSubscription.md +3 -1
  41. data/docs/SubscriptionObjectExtended.md +52 -0
  42. data/docs/SubscriptionUpdateInputSubscription.md +3 -1
  43. data/docs/SubscriptionsApi.md +70 -0
  44. data/lago_ruby.gemspec +1 -1
  45. data/lib/lago_ruby/api/add_ons_api.rb +1 -1
  46. data/lib/lago_ruby/api/billable_metrics_api.rb +1 -1
  47. data/lib/lago_ruby/api/coupons_api.rb +1 -1
  48. data/lib/lago_ruby/api/credit_notes_api.rb +65 -1
  49. data/lib/lago_ruby/api/customers_api.rb +83 -1
  50. data/lib/lago_ruby/api/events_api.rb +6 -6
  51. data/lib/lago_ruby/api/fees_api.rb +1 -1
  52. data/lib/lago_ruby/api/invoices_api.rb +1 -1
  53. data/lib/lago_ruby/api/organizations_api.rb +1 -1
  54. data/lib/lago_ruby/api/plans_api.rb +1 -1
  55. data/lib/lago_ruby/api/subscriptions_api.rb +64 -1
  56. data/lib/lago_ruby/api/taxes_api.rb +1 -1
  57. data/lib/lago_ruby/api/wallets_api.rb +1 -1
  58. data/lib/lago_ruby/api/webhook_endpoints_api.rb +1 -1
  59. data/lib/lago_ruby/api/webhooks_api.rb +1 -1
  60. data/lib/lago_ruby/api_client.rb +13 -13
  61. data/lib/lago_ruby/api_error.rb +1 -1
  62. data/lib/lago_ruby/configuration.rb +2 -1
  63. data/lib/lago_ruby/models/add_on.rb +2 -2
  64. data/lib/lago_ruby/models/add_on_base_input.rb +13 -3
  65. data/lib/lago_ruby/models/add_on_create_input.rb +2 -2
  66. data/lib/lago_ruby/models/add_on_create_input_add_on.rb +13 -3
  67. data/lib/lago_ruby/models/add_on_object.rb +13 -3
  68. data/lib/lago_ruby/models/add_on_update_input.rb +2 -2
  69. data/lib/lago_ruby/models/add_ons_paginated.rb +2 -2
  70. data/lib/lago_ruby/models/api_error_bad_request.rb +2 -2
  71. data/lib/lago_ruby/models/api_error_forbidden.rb +2 -2
  72. data/lib/lago_ruby/models/api_error_not_allowed.rb +2 -2
  73. data/lib/lago_ruby/models/api_error_not_found.rb +2 -2
  74. data/lib/lago_ruby/models/api_error_unauthorized.rb +2 -2
  75. data/lib/lago_ruby/models/api_error_unprocessable_entity.rb +2 -2
  76. data/lib/lago_ruby/models/applied_coupon.rb +2 -2
  77. data/lib/lago_ruby/models/applied_coupon_input.rb +2 -2
  78. data/lib/lago_ruby/models/applied_coupon_input_applied_coupon.rb +2 -2
  79. data/lib/lago_ruby/models/applied_coupon_object.rb +2 -2
  80. data/lib/lago_ruby/models/applied_coupon_object_extended.rb +2 -2
  81. data/lib/lago_ruby/models/applied_coupons_paginated.rb +2 -2
  82. data/lib/lago_ruby/models/base_applied_tax.rb +2 -2
  83. data/lib/lago_ruby/models/billable_metric.rb +2 -2
  84. data/lib/lago_ruby/models/billable_metric_base_input.rb +5 -5
  85. data/lib/lago_ruby/models/billable_metric_create_input.rb +2 -2
  86. data/lib/lago_ruby/models/billable_metric_create_input_billable_metric.rb +5 -5
  87. data/lib/lago_ruby/models/billable_metric_group.rb +2 -2
  88. data/lib/lago_ruby/models/billable_metric_group_values_inner.rb +1 -1
  89. data/lib/lago_ruby/models/billable_metric_group_values_inner_one_of.rb +2 -2
  90. data/lib/lago_ruby/models/billable_metric_object.rb +5 -5
  91. data/lib/lago_ruby/models/billable_metric_update_input.rb +2 -2
  92. data/lib/lago_ruby/models/billable_metrics_paginated.rb +2 -2
  93. data/lib/lago_ruby/models/charge_object.rb +13 -3
  94. data/lib/lago_ruby/models/charge_object_properties.rb +2 -2
  95. data/lib/lago_ruby/models/charge_properties.rb +2 -2
  96. data/lib/lago_ruby/models/charge_properties_graduated_percentage_ranges_inner.rb +2 -2
  97. data/lib/lago_ruby/models/charge_properties_graduated_ranges_inner.rb +2 -2
  98. data/lib/lago_ruby/models/charge_properties_volume_ranges_inner.rb +2 -2
  99. data/lib/lago_ruby/models/country.rb +1 -1
  100. data/lib/lago_ruby/models/coupon.rb +2 -2
  101. data/lib/lago_ruby/models/coupon_base_input.rb +2 -2
  102. data/lib/lago_ruby/models/coupon_base_input_applies_to.rb +2 -2
  103. data/lib/lago_ruby/models/coupon_create_input.rb +2 -2
  104. data/lib/lago_ruby/models/coupon_create_input_coupon.rb +2 -2
  105. data/lib/lago_ruby/models/coupon_object.rb +2 -2
  106. data/lib/lago_ruby/models/coupon_update_input.rb +2 -2
  107. data/lib/lago_ruby/models/coupons_paginated.rb +2 -2
  108. data/lib/lago_ruby/models/credit_note.rb +2 -2
  109. data/lib/lago_ruby/models/credit_note_applied_tax_object.rb +2 -2
  110. data/lib/lago_ruby/models/credit_note_create_input.rb +2 -2
  111. data/lib/lago_ruby/models/credit_note_create_input_credit_note.rb +3 -3
  112. data/lib/lago_ruby/models/credit_note_create_input_credit_note_items_inner.rb +1 -1
  113. data/lib/lago_ruby/models/credit_note_estimate_input.rb +221 -0
  114. data/lib/lago_ruby/models/credit_note_estimate_input_credit_note.rb +241 -0
  115. data/lib/lago_ruby/models/credit_note_estimate_input_credit_note_items_inner.rb +239 -0
  116. data/lib/lago_ruby/models/credit_note_estimated.rb +221 -0
  117. data/lib/lago_ruby/models/credit_note_estimated_estimated_credit_note.rb +387 -0
  118. data/lib/lago_ruby/models/credit_note_estimated_estimated_credit_note_applied_taxes_inner.rb +283 -0
  119. data/lib/lago_ruby/models/credit_note_estimated_estimated_credit_note_items_inner.rb +235 -0
  120. data/lib/lago_ruby/models/credit_note_item_object.rb +2 -2
  121. data/lib/lago_ruby/models/credit_note_item_object_fee.rb +30 -3
  122. data/lib/lago_ruby/models/credit_note_object.rb +13 -13
  123. data/lib/lago_ruby/models/credit_note_update_input.rb +2 -2
  124. data/lib/lago_ruby/models/credit_note_update_input_credit_note.rb +2 -2
  125. data/lib/lago_ruby/models/credit_notes.rb +2 -2
  126. data/lib/lago_ruby/models/credit_object.rb +2 -2
  127. data/lib/lago_ruby/models/credit_object_invoice.rb +2 -2
  128. data/lib/lago_ruby/models/credit_object_item.rb +2 -2
  129. data/lib/lago_ruby/models/currency.rb +1 -1
  130. data/lib/lago_ruby/models/customer.rb +2 -2
  131. data/lib/lago_ruby/models/customer_billing_configuration.rb +2 -2
  132. data/lib/lago_ruby/models/customer_charge_usage_object.rb +20 -3
  133. data/lib/lago_ruby/models/customer_charge_usage_object_billable_metric.rb +2 -2
  134. data/lib/lago_ruby/models/customer_charge_usage_object_charge.rb +2 -2
  135. data/lib/lago_ruby/models/customer_charge_usage_object_groups_inner.rb +13 -3
  136. data/lib/lago_ruby/models/customer_create_input.rb +2 -2
  137. data/lib/lago_ruby/models/customer_create_input_customer.rb +2 -2
  138. data/lib/lago_ruby/models/customer_create_input_customer_metadata_inner.rb +2 -2
  139. data/lib/lago_ruby/models/customer_metadata.rb +2 -2
  140. data/lib/lago_ruby/models/customer_object.rb +2 -2
  141. data/lib/lago_ruby/models/customer_object_extended.rb +2 -2
  142. data/lib/lago_ruby/models/customer_past_usage.rb +239 -0
  143. data/lib/lago_ruby/models/customer_usage.rb +2 -2
  144. data/lib/lago_ruby/models/customer_usage_object.rb +14 -3
  145. data/lib/lago_ruby/models/customers_paginated.rb +2 -2
  146. data/lib/lago_ruby/models/event.rb +2 -2
  147. data/lib/lago_ruby/models/event_batch_input.rb +2 -2
  148. data/lib/lago_ruby/models/event_batch_input_event.rb +2 -2
  149. data/lib/lago_ruby/models/event_batch_input_event_properties.rb +2 -2
  150. data/lib/lago_ruby/models/event_estimate_fees_input.rb +2 -2
  151. data/lib/lago_ruby/models/event_estimate_fees_input_event.rb +2 -2
  152. data/lib/lago_ruby/models/event_input.rb +2 -2
  153. data/lib/lago_ruby/models/event_input_event.rb +2 -2
  154. data/lib/lago_ruby/models/event_input_event_timestamp.rb +1 -1
  155. data/lib/lago_ruby/models/event_object.rb +6 -22
  156. data/lib/lago_ruby/models/event_object_properties.rb +2 -2
  157. data/lib/lago_ruby/models/fee.rb +2 -2
  158. data/lib/lago_ruby/models/fee_applied_tax_object.rb +2 -2
  159. data/lib/lago_ruby/models/fee_object.rb +30 -3
  160. data/lib/lago_ruby/models/fee_object_item.rb +23 -3
  161. data/lib/lago_ruby/models/fee_update_input.rb +2 -2
  162. data/lib/lago_ruby/models/fee_update_input_fee.rb +2 -2
  163. data/lib/lago_ruby/models/fees.rb +2 -2
  164. data/lib/lago_ruby/models/fees_paginated.rb +2 -2
  165. data/lib/lago_ruby/models/get_customer_portal_url200_response.rb +2 -2
  166. data/lib/lago_ruby/models/get_customer_portal_url200_response_customer.rb +2 -2
  167. data/lib/lago_ruby/models/group_object.rb +2 -2
  168. data/lib/lago_ruby/models/group_properties_object.rb +13 -3
  169. data/lib/lago_ruby/models/group_properties_object_values.rb +2 -2
  170. data/lib/lago_ruby/models/groups_paginated.rb +2 -2
  171. data/lib/lago_ruby/models/invoice.rb +2 -2
  172. data/lib/lago_ruby/models/invoice_applied_tax_object.rb +2 -2
  173. data/lib/lago_ruby/models/invoice_metadata_object.rb +2 -2
  174. data/lib/lago_ruby/models/invoice_object.rb +2 -2
  175. data/lib/lago_ruby/models/invoice_object_customer.rb +2 -2
  176. data/lib/lago_ruby/models/invoice_object_extended.rb +2 -2
  177. data/lib/lago_ruby/models/invoice_one_off_create_input.rb +2 -2
  178. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice.rb +2 -2
  179. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice_fees_inner.rb +13 -3
  180. data/lib/lago_ruby/models/invoice_update_input.rb +2 -2
  181. data/lib/lago_ruby/models/invoice_update_input_invoice.rb +2 -2
  182. data/lib/lago_ruby/models/invoice_update_input_invoice_metadata_inner.rb +2 -2
  183. data/lib/lago_ruby/models/invoices_paginated.rb +2 -2
  184. data/lib/lago_ruby/models/organization.rb +2 -2
  185. data/lib/lago_ruby/models/organization_billing_configuration.rb +2 -2
  186. data/lib/lago_ruby/models/organization_object.rb +2 -2
  187. data/lib/lago_ruby/models/organization_update_input.rb +2 -2
  188. data/lib/lago_ruby/models/organization_update_input_organization.rb +2 -2
  189. data/lib/lago_ruby/models/pagination_meta.rb +2 -2
  190. data/lib/lago_ruby/models/plan.rb +2 -2
  191. data/lib/lago_ruby/models/plan_create_input.rb +2 -2
  192. data/lib/lago_ruby/models/plan_create_input_plan.rb +13 -3
  193. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner.rb +13 -3
  194. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner_group_properties_inner.rb +2 -2
  195. data/lib/lago_ruby/models/plan_object.rb +13 -3
  196. data/lib/lago_ruby/models/plan_overrides_object.rb +289 -0
  197. data/lib/lago_ruby/models/plan_overrides_object_charges_inner.rb +268 -0
  198. data/lib/lago_ruby/models/plan_update_input.rb +2 -2
  199. data/lib/lago_ruby/models/plan_update_input_plan.rb +13 -3
  200. data/lib/lago_ruby/models/plan_update_input_plan_charges_inner.rb +13 -3
  201. data/lib/lago_ruby/models/plans_paginated.rb +2 -2
  202. data/lib/lago_ruby/models/subscription.rb +3 -3
  203. data/lib/lago_ruby/models/subscription_create_input.rb +2 -2
  204. data/lib/lago_ruby/models/subscription_create_input_subscription.rb +15 -6
  205. data/lib/lago_ruby/models/subscription_object.rb +2 -2
  206. data/lib/lago_ruby/models/subscription_object_extended.rb +507 -0
  207. data/lib/lago_ruby/models/subscription_update_input.rb +2 -2
  208. data/lib/lago_ruby/models/subscription_update_input_subscription.rb +15 -6
  209. data/lib/lago_ruby/models/subscriptions_paginated.rb +2 -2
  210. data/lib/lago_ruby/models/tax.rb +2 -2
  211. data/lib/lago_ruby/models/tax_base_input.rb +2 -2
  212. data/lib/lago_ruby/models/tax_create_input.rb +2 -2
  213. data/lib/lago_ruby/models/tax_create_input_tax.rb +2 -2
  214. data/lib/lago_ruby/models/tax_object.rb +2 -2
  215. data/lib/lago_ruby/models/tax_update_input.rb +2 -2
  216. data/lib/lago_ruby/models/taxes_paginated.rb +2 -2
  217. data/lib/lago_ruby/models/timezone.rb +1 -1
  218. data/lib/lago_ruby/models/wallet.rb +2 -2
  219. data/lib/lago_ruby/models/wallet_create_input.rb +2 -2
  220. data/lib/lago_ruby/models/wallet_create_input_wallet.rb +2 -2
  221. data/lib/lago_ruby/models/wallet_object.rb +2 -2
  222. data/lib/lago_ruby/models/wallet_transaction_create_input.rb +2 -2
  223. data/lib/lago_ruby/models/wallet_transaction_create_input_wallet_transaction.rb +2 -2
  224. data/lib/lago_ruby/models/wallet_transaction_object.rb +2 -2
  225. data/lib/lago_ruby/models/wallet_transactions.rb +2 -2
  226. data/lib/lago_ruby/models/wallet_transactions_paginated.rb +2 -2
  227. data/lib/lago_ruby/models/wallet_update_input.rb +2 -2
  228. data/lib/lago_ruby/models/wallet_update_input_wallet.rb +2 -2
  229. data/lib/lago_ruby/models/wallets_paginated.rb +2 -2
  230. data/lib/lago_ruby/models/webhook_endpoint.rb +2 -2
  231. data/lib/lago_ruby/models/webhook_endpoint_create_input.rb +2 -2
  232. data/lib/lago_ruby/models/webhook_endpoint_create_input_webhook_endpoint.rb +2 -2
  233. data/lib/lago_ruby/models/webhook_endpoint_object.rb +2 -2
  234. data/lib/lago_ruby/models/webhook_endpoint_update_input.rb +2 -2
  235. data/lib/lago_ruby/models/webhook_endpoints_paginated.rb +2 -2
  236. data/lib/lago_ruby/version.rb +2 -2
  237. data/lib/lago_ruby.rb +12 -2
  238. data/spec/api_client_spec.rb +1 -1
  239. data/spec/configuration_spec.rb +1 -1
  240. 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
  241. data/spec/models/credit_note_estimate_input_credit_note_spec.rb +42 -0
  242. data/spec/models/credit_note_estimate_input_spec.rb +36 -0
  243. data/spec/models/credit_note_estimated_estimated_credit_note_applied_taxes_inner_spec.rb +78 -0
  244. data/spec/models/credit_note_estimated_estimated_credit_note_items_inner_spec.rb +42 -0
  245. data/spec/models/credit_note_estimated_estimated_credit_note_spec.rb +96 -0
  246. data/spec/models/credit_note_estimated_spec.rb +36 -0
  247. data/spec/models/customer_past_usage_spec.rb +42 -0
  248. data/spec/models/plan_overrides_object_charges_inner_spec.rb +66 -0
  249. data/spec/models/plan_overrides_object_spec.rb +78 -0
  250. data/spec/models/subscription_object_extended_spec.rb +146 -0
  251. data/spec/spec_helper.rb +1 -1
  252. metadata +194 -152
@@ -0,0 +1,239 @@
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 CustomerPastUsage
18
+ attr_accessor :usage_periods
19
+
20
+ attr_accessor :meta
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'usage_periods' => :'usage_periods',
26
+ :'meta' => :'meta'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'usage_periods' => :'Array<CustomerUsage>',
39
+ :'meta' => :'PaginationMeta'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CustomerPastUsage` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CustomerPastUsage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'usage_periods')
65
+ if (value = attributes[:'usage_periods']).is_a?(Array)
66
+ self.usage_periods = value
67
+ end
68
+ else
69
+ self.usage_periods = nil
70
+ end
71
+
72
+ if attributes.key?(:'meta')
73
+ self.meta = attributes[:'meta']
74
+ else
75
+ self.meta = nil
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ if @usage_periods.nil?
85
+ invalid_properties.push('invalid value for "usage_periods", usage_periods cannot be nil.')
86
+ end
87
+
88
+ if @meta.nil?
89
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ return false if @usage_periods.nil?
100
+ return false if @meta.nil?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ usage_periods == o.usage_periods &&
110
+ meta == o.meta
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [usage_periods, meta].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def self._deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = LagoAPI.const_get(type)
187
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ 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.48.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
@@ -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
 
@@ -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.48.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
@@ -24,6 +24,9 @@ module LagoAPI
24
24
  # The date of creation of the invoice.
25
25
  attr_accessor :issuing_date
26
26
 
27
+ # A unique identifier associated with the invoice related to this particular usage record.
28
+ attr_accessor :lago_invoice_id
29
+
27
30
  attr_accessor :currency
28
31
 
29
32
  # The amount in cents, tax excluded.
@@ -44,6 +47,7 @@ module LagoAPI
44
47
  :'from_datetime' => :'from_datetime',
45
48
  :'to_datetime' => :'to_datetime',
46
49
  :'issuing_date' => :'issuing_date',
50
+ :'lago_invoice_id' => :'lago_invoice_id',
47
51
  :'currency' => :'currency',
48
52
  :'amount_cents' => :'amount_cents',
49
53
  :'taxes_amount_cents' => :'taxes_amount_cents',
@@ -63,6 +67,7 @@ module LagoAPI
63
67
  :'from_datetime' => :'Time',
64
68
  :'to_datetime' => :'Time',
65
69
  :'issuing_date' => :'Time',
70
+ :'lago_invoice_id' => :'String',
66
71
  :'currency' => :'Currency',
67
72
  :'amount_cents' => :'Integer',
68
73
  :'taxes_amount_cents' => :'Integer',
@@ -74,6 +79,7 @@ module LagoAPI
74
79
  # List of attributes with nullable: true
75
80
  def self.openapi_nullable
76
81
  Set.new([
82
+ :'lago_invoice_id',
77
83
  ])
78
84
  end
79
85
 
@@ -110,6 +116,10 @@ module LagoAPI
110
116
  self.issuing_date = nil
111
117
  end
112
118
 
119
+ if attributes.key?(:'lago_invoice_id')
120
+ self.lago_invoice_id = attributes[:'lago_invoice_id']
121
+ end
122
+
113
123
  if attributes.key?(:'currency')
114
124
  self.currency = attributes[:'currency']
115
125
  end
@@ -199,6 +209,7 @@ module LagoAPI
199
209
  from_datetime == o.from_datetime &&
200
210
  to_datetime == o.to_datetime &&
201
211
  issuing_date == o.issuing_date &&
212
+ lago_invoice_id == o.lago_invoice_id &&
202
213
  currency == o.currency &&
203
214
  amount_cents == o.amount_cents &&
204
215
  taxes_amount_cents == o.taxes_amount_cents &&
@@ -215,7 +226,7 @@ module LagoAPI
215
226
  # Calculates hash code according to all attributes.
216
227
  # @return [Integer] Hash code
217
228
  def hash
218
- [from_datetime, to_datetime, issuing_date, currency, amount_cents, taxes_amount_cents, total_amount_cents, charges_usage].hash
229
+ [from_datetime, to_datetime, issuing_date, lago_invoice_id, currency, amount_cents, taxes_amount_cents, total_amount_cents, charges_usage].hash
219
230
  end
220
231
 
221
232
  # Builds the object from hash
@@ -280,7 +291,7 @@ module LagoAPI
280
291
  else # model
281
292
  # models (e.g. Pet) or oneOf
282
293
  klass = LagoAPI.const_get(type)
283
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
294
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
284
295
  end
285
296
  end
286
297
 
@@ -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.48.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
@@ -184,7 +184,7 @@ module LagoAPI
184
184
  else # model
185
185
  # models (e.g. Pet) or oneOf
186
186
  klass = LagoAPI.const_get(type)
187
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
188
  end
189
189
  end
190
190
 
@@ -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.48.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
@@ -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
 
@@ -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.48.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
@@ -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
 
@@ -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.48.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
@@ -232,7 +232,7 @@ module LagoAPI
232
232
  else # model
233
233
  # models (e.g. Pet) or oneOf
234
234
  klass = LagoAPI.const_get(type)
235
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
235
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
236
236
  end
237
237
  end
238
238
 
@@ -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.48.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
@@ -195,7 +195,7 @@ module LagoAPI
195
195
  else # model
196
196
  # models (e.g. Pet) or oneOf
197
197
  klass = LagoAPI.const_get(type)
198
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
199
  end
200
200
  end
201
201
 
@@ -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.48.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
@@ -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
 
@@ -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.48.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
@@ -197,7 +197,7 @@ module LagoAPI
197
197
  else # model
198
198
  # models (e.g. Pet) or oneOf
199
199
  klass = LagoAPI.const_get(type)
200
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
200
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
201
201
  end
202
202
  end
203
203
 
@@ -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.48.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
@@ -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
 
@@ -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.48.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
@@ -225,7 +225,7 @@ module LagoAPI
225
225
  else # model
226
226
  # models (e.g. Pet) or oneOf
227
227
  klass = LagoAPI.const_get(type)
228
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
228
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
229
229
  end
230
230
  end
231
231
 
@@ -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.48.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
@@ -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.48.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
@@ -84,6 +84,10 @@ module LagoAPI
84
84
  # List of attributes with nullable: true
85
85
  def self.openapi_nullable
86
86
  Set.new([
87
+ :'lago_customer_id',
88
+ :'external_customer_id',
89
+ :'lago_subscription_id',
90
+ :'external_subscription_id',
87
91
  ])
88
92
  end
89
93
 
@@ -174,14 +178,6 @@ module LagoAPI
174
178
  invalid_properties.push('invalid value for "transaction_id", transaction_id cannot be nil.')
175
179
  end
176
180
 
177
- if @lago_customer_id.nil?
178
- invalid_properties.push('invalid value for "lago_customer_id", lago_customer_id cannot be nil.')
179
- end
180
-
181
- if @external_customer_id.nil?
182
- invalid_properties.push('invalid value for "external_customer_id", external_customer_id cannot be nil.')
183
- end
184
-
185
181
  if @code.nil?
186
182
  invalid_properties.push('invalid value for "code", code cannot be nil.')
187
183
  end
@@ -190,14 +186,6 @@ module LagoAPI
190
186
  invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
191
187
  end
192
188
 
193
- if @lago_subscription_id.nil?
194
- invalid_properties.push('invalid value for "lago_subscription_id", lago_subscription_id cannot be nil.')
195
- end
196
-
197
- if @external_subscription_id.nil?
198
- invalid_properties.push('invalid value for "external_subscription_id", external_subscription_id cannot be nil.')
199
- end
200
-
201
189
  if @created_at.nil?
202
190
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
203
191
  end
@@ -211,12 +199,8 @@ module LagoAPI
211
199
  warn '[DEPRECATED] the `valid?` method is obsolete'
212
200
  return false if @lago_id.nil?
213
201
  return false if @transaction_id.nil?
214
- return false if @lago_customer_id.nil?
215
- return false if @external_customer_id.nil?
216
202
  return false if @code.nil?
217
203
  return false if @timestamp.nil?
218
- return false if @lago_subscription_id.nil?
219
- return false if @external_subscription_id.nil?
220
204
  return false if @created_at.nil?
221
205
  true
222
206
  end
@@ -312,7 +296,7 @@ module LagoAPI
312
296
  else # model
313
297
  # models (e.g. Pet) or oneOf
314
298
  klass = LagoAPI.const_get(type)
315
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
299
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
316
300
  end
317
301
  end
318
302
 
@@ -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.48.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
@@ -195,7 +195,7 @@ module LagoAPI
195
195
  else # model
196
196
  # models (e.g. Pet) or oneOf
197
197
  klass = LagoAPI.const_get(type)
198
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
199
  end
200
200
  end
201
201
 
@@ -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.48.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
@@ -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
 
@@ -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.48.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
@@ -256,7 +256,7 @@ module LagoAPI
256
256
  else # model
257
257
  # models (e.g. Pet) or oneOf
258
258
  klass = LagoAPI.const_get(type)
259
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
259
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
260
260
  end
261
261
  end
262
262