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,507 @@
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 SubscriptionObjectExtended
18
+ # Unique identifier assigned to the subscription within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription’s record within the Lago system
19
+ attr_accessor :lago_id
20
+
21
+ # The subscription external unique identifier (provided by your own application).
22
+ attr_accessor :external_id
23
+
24
+ # Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
25
+ attr_accessor :lago_customer_id
26
+
27
+ # The customer external unique identifier (provided by your own application).
28
+ attr_accessor :external_customer_id
29
+
30
+ # The billing time for the subscription, which can be set as either `anniversary` or `calendar`. If not explicitly provided, it will default to `calendar`. The billing time determines the timing of recurring billing cycles for the subscription. By specifying `anniversary`, the billing cycle will be based on the specific date the subscription started (billed fully), while `calendar` sets the billing cycle at the first day of the week/month/year (billed with proration).
31
+ attr_accessor :billing_time
32
+
33
+ # The display name of the subscription on an invoice. This field allows for customization of the subscription's name for billing purposes, especially useful when a single customer has multiple subscriptions using the same plan.
34
+ attr_accessor :name
35
+
36
+ # The unique code representing the plan to be attached to the customer. This code must correspond to the `code` property of one of the active plans.
37
+ attr_accessor :plan_code
38
+
39
+ # The status of the subscription, which can have the following values: - `pending`: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period. - `active`: the subscription is currently active and applied to the customer. - `terminated`: the subscription is no longer active. - `canceled`: the subscription has been stopped before its activation. This can occur when two consecutive downgrades have been applied to a customer or when a subscription with a pending status is terminated.
40
+ attr_accessor :status
41
+
42
+ # The creation date of the subscription, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). This date provides a timestamp indicating when the subscription was initially created.
43
+ attr_accessor :created_at
44
+
45
+ # The cancellation date of the subscription. This field is not null when the subscription is `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
46
+ attr_accessor :canceled_at
47
+
48
+ # The effective start date of the subscription. This field can be null if the subscription is `pending` or `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
49
+ attr_accessor :started_at
50
+
51
+ # The effective end date of the subscription. If this field is set to null, the subscription will automatically renew. This date should be provided in ISO 8601 datetime format, and use Coordinated Universal Time (UTC).
52
+ attr_accessor :ending_at
53
+
54
+ # The anniversary date and time of the initial subscription. This date serves as the basis for billing subscriptions with `anniversary` billing time. The `anniversary_date` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
55
+ attr_accessor :subscription_at
56
+
57
+ # The termination date of the subscription. This field is not null when the subscription is `terminated`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC)
58
+ attr_accessor :terminated_at
59
+
60
+ # The code identifying the previous plan associated with this subscription.
61
+ attr_accessor :previous_plan_code
62
+
63
+ # The code identifying the next plan in the case of a downgrade.
64
+ attr_accessor :next_plan_code
65
+
66
+ # The date when the plan will be downgraded, represented in ISO 8601 date format.
67
+ attr_accessor :downgrade_plan_date
68
+
69
+ attr_accessor :plan
70
+
71
+ class EnumAttributeValidator
72
+ attr_reader :datatype
73
+ attr_reader :allowable_values
74
+
75
+ def initialize(datatype, allowable_values)
76
+ @allowable_values = allowable_values.map do |value|
77
+ case datatype.to_s
78
+ when /Integer/i
79
+ value.to_i
80
+ when /Float/i
81
+ value.to_f
82
+ else
83
+ value
84
+ end
85
+ end
86
+ end
87
+
88
+ def valid?(value)
89
+ !value || allowable_values.include?(value)
90
+ end
91
+ end
92
+
93
+ # Attribute mapping from ruby-style variable name to JSON key.
94
+ def self.attribute_map
95
+ {
96
+ :'lago_id' => :'lago_id',
97
+ :'external_id' => :'external_id',
98
+ :'lago_customer_id' => :'lago_customer_id',
99
+ :'external_customer_id' => :'external_customer_id',
100
+ :'billing_time' => :'billing_time',
101
+ :'name' => :'name',
102
+ :'plan_code' => :'plan_code',
103
+ :'status' => :'status',
104
+ :'created_at' => :'created_at',
105
+ :'canceled_at' => :'canceled_at',
106
+ :'started_at' => :'started_at',
107
+ :'ending_at' => :'ending_at',
108
+ :'subscription_at' => :'subscription_at',
109
+ :'terminated_at' => :'terminated_at',
110
+ :'previous_plan_code' => :'previous_plan_code',
111
+ :'next_plan_code' => :'next_plan_code',
112
+ :'downgrade_plan_date' => :'downgrade_plan_date',
113
+ :'plan' => :'plan'
114
+ }
115
+ end
116
+
117
+ # Returns all the JSON keys this model knows about
118
+ def self.acceptable_attributes
119
+ attribute_map.values
120
+ end
121
+
122
+ # Attribute type mapping.
123
+ def self.openapi_types
124
+ {
125
+ :'lago_id' => :'String',
126
+ :'external_id' => :'String',
127
+ :'lago_customer_id' => :'String',
128
+ :'external_customer_id' => :'String',
129
+ :'billing_time' => :'String',
130
+ :'name' => :'String',
131
+ :'plan_code' => :'String',
132
+ :'status' => :'String',
133
+ :'created_at' => :'Time',
134
+ :'canceled_at' => :'Time',
135
+ :'started_at' => :'Time',
136
+ :'ending_at' => :'Time',
137
+ :'subscription_at' => :'Time',
138
+ :'terminated_at' => :'Time',
139
+ :'previous_plan_code' => :'String',
140
+ :'next_plan_code' => :'String',
141
+ :'downgrade_plan_date' => :'Time',
142
+ :'plan' => :'PlanObject'
143
+ }
144
+ end
145
+
146
+ # List of attributes with nullable: true
147
+ def self.openapi_nullable
148
+ Set.new([
149
+ :'name',
150
+ :'canceled_at',
151
+ :'started_at',
152
+ :'terminated_at',
153
+ :'previous_plan_code',
154
+ :'next_plan_code',
155
+ :'downgrade_plan_date',
156
+ ])
157
+ end
158
+
159
+ # List of class defined in allOf (OpenAPI v3)
160
+ def self.openapi_all_of
161
+ [
162
+ :'SubscriptionObject'
163
+ ]
164
+ end
165
+
166
+ # Initializes the object
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ def initialize(attributes = {})
169
+ if (!attributes.is_a?(Hash))
170
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::SubscriptionObjectExtended` initialize method"
171
+ end
172
+
173
+ # check to see if the attribute exists and convert string to symbol for hash key
174
+ attributes = attributes.each_with_object({}) { |(k, v), h|
175
+ if (!self.class.attribute_map.key?(k.to_sym))
176
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::SubscriptionObjectExtended`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
177
+ end
178
+ h[k.to_sym] = v
179
+ }
180
+
181
+ if attributes.key?(:'lago_id')
182
+ self.lago_id = attributes[:'lago_id']
183
+ else
184
+ self.lago_id = nil
185
+ end
186
+
187
+ if attributes.key?(:'external_id')
188
+ self.external_id = attributes[:'external_id']
189
+ else
190
+ self.external_id = nil
191
+ end
192
+
193
+ if attributes.key?(:'lago_customer_id')
194
+ self.lago_customer_id = attributes[:'lago_customer_id']
195
+ else
196
+ self.lago_customer_id = nil
197
+ end
198
+
199
+ if attributes.key?(:'external_customer_id')
200
+ self.external_customer_id = attributes[:'external_customer_id']
201
+ else
202
+ self.external_customer_id = nil
203
+ end
204
+
205
+ if attributes.key?(:'billing_time')
206
+ self.billing_time = attributes[:'billing_time']
207
+ else
208
+ self.billing_time = nil
209
+ end
210
+
211
+ if attributes.key?(:'name')
212
+ self.name = attributes[:'name']
213
+ end
214
+
215
+ if attributes.key?(:'plan_code')
216
+ self.plan_code = attributes[:'plan_code']
217
+ else
218
+ self.plan_code = nil
219
+ end
220
+
221
+ if attributes.key?(:'status')
222
+ self.status = attributes[:'status']
223
+ else
224
+ self.status = nil
225
+ end
226
+
227
+ if attributes.key?(:'created_at')
228
+ self.created_at = attributes[:'created_at']
229
+ else
230
+ self.created_at = nil
231
+ end
232
+
233
+ if attributes.key?(:'canceled_at')
234
+ self.canceled_at = attributes[:'canceled_at']
235
+ end
236
+
237
+ if attributes.key?(:'started_at')
238
+ self.started_at = attributes[:'started_at']
239
+ end
240
+
241
+ if attributes.key?(:'ending_at')
242
+ self.ending_at = attributes[:'ending_at']
243
+ end
244
+
245
+ if attributes.key?(:'subscription_at')
246
+ self.subscription_at = attributes[:'subscription_at']
247
+ else
248
+ self.subscription_at = nil
249
+ end
250
+
251
+ if attributes.key?(:'terminated_at')
252
+ self.terminated_at = attributes[:'terminated_at']
253
+ end
254
+
255
+ if attributes.key?(:'previous_plan_code')
256
+ self.previous_plan_code = attributes[:'previous_plan_code']
257
+ end
258
+
259
+ if attributes.key?(:'next_plan_code')
260
+ self.next_plan_code = attributes[:'next_plan_code']
261
+ end
262
+
263
+ if attributes.key?(:'downgrade_plan_date')
264
+ self.downgrade_plan_date = attributes[:'downgrade_plan_date']
265
+ end
266
+
267
+ if attributes.key?(:'plan')
268
+ self.plan = attributes[:'plan']
269
+ end
270
+ end
271
+
272
+ # Show invalid properties with the reasons. Usually used together with valid?
273
+ # @return Array for valid properties with the reasons
274
+ def list_invalid_properties
275
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
276
+ invalid_properties = Array.new
277
+ if @lago_id.nil?
278
+ invalid_properties.push('invalid value for "lago_id", lago_id cannot be nil.')
279
+ end
280
+
281
+ if @external_id.nil?
282
+ invalid_properties.push('invalid value for "external_id", external_id cannot be nil.')
283
+ end
284
+
285
+ if @lago_customer_id.nil?
286
+ invalid_properties.push('invalid value for "lago_customer_id", lago_customer_id cannot be nil.')
287
+ end
288
+
289
+ if @external_customer_id.nil?
290
+ invalid_properties.push('invalid value for "external_customer_id", external_customer_id cannot be nil.')
291
+ end
292
+
293
+ if @billing_time.nil?
294
+ invalid_properties.push('invalid value for "billing_time", billing_time cannot be nil.')
295
+ end
296
+
297
+ if @plan_code.nil?
298
+ invalid_properties.push('invalid value for "plan_code", plan_code cannot be nil.')
299
+ end
300
+
301
+ if @status.nil?
302
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
303
+ end
304
+
305
+ if @created_at.nil?
306
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
307
+ end
308
+
309
+ if @subscription_at.nil?
310
+ invalid_properties.push('invalid value for "subscription_at", subscription_at cannot be nil.')
311
+ end
312
+
313
+ invalid_properties
314
+ end
315
+
316
+ # Check to see if the all the properties in the model are valid
317
+ # @return true if the model is valid
318
+ def valid?
319
+ warn '[DEPRECATED] the `valid?` method is obsolete'
320
+ return false if @lago_id.nil?
321
+ return false if @external_id.nil?
322
+ return false if @lago_customer_id.nil?
323
+ return false if @external_customer_id.nil?
324
+ return false if @billing_time.nil?
325
+ billing_time_validator = EnumAttributeValidator.new('String', ["calendar", "anniversary"])
326
+ return false unless billing_time_validator.valid?(@billing_time)
327
+ return false if @plan_code.nil?
328
+ return false if @status.nil?
329
+ status_validator = EnumAttributeValidator.new('String', ["active", "pending", "terminated", "canceled"])
330
+ return false unless status_validator.valid?(@status)
331
+ return false if @created_at.nil?
332
+ return false if @subscription_at.nil?
333
+ true
334
+ end
335
+
336
+ # Custom attribute writer method checking allowed values (enum).
337
+ # @param [Object] billing_time Object to be assigned
338
+ def billing_time=(billing_time)
339
+ validator = EnumAttributeValidator.new('String', ["calendar", "anniversary"])
340
+ unless validator.valid?(billing_time)
341
+ fail ArgumentError, "invalid value for \"billing_time\", must be one of #{validator.allowable_values}."
342
+ end
343
+ @billing_time = billing_time
344
+ end
345
+
346
+ # Custom attribute writer method checking allowed values (enum).
347
+ # @param [Object] status Object to be assigned
348
+ def status=(status)
349
+ validator = EnumAttributeValidator.new('String', ["active", "pending", "terminated", "canceled"])
350
+ unless validator.valid?(status)
351
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
352
+ end
353
+ @status = status
354
+ end
355
+
356
+ # Checks equality by comparing each attribute.
357
+ # @param [Object] Object to be compared
358
+ def ==(o)
359
+ return true if self.equal?(o)
360
+ self.class == o.class &&
361
+ lago_id == o.lago_id &&
362
+ external_id == o.external_id &&
363
+ lago_customer_id == o.lago_customer_id &&
364
+ external_customer_id == o.external_customer_id &&
365
+ billing_time == o.billing_time &&
366
+ name == o.name &&
367
+ plan_code == o.plan_code &&
368
+ status == o.status &&
369
+ created_at == o.created_at &&
370
+ canceled_at == o.canceled_at &&
371
+ started_at == o.started_at &&
372
+ ending_at == o.ending_at &&
373
+ subscription_at == o.subscription_at &&
374
+ terminated_at == o.terminated_at &&
375
+ previous_plan_code == o.previous_plan_code &&
376
+ next_plan_code == o.next_plan_code &&
377
+ downgrade_plan_date == o.downgrade_plan_date &&
378
+ plan == o.plan
379
+ end
380
+
381
+ # @see the `==` method
382
+ # @param [Object] Object to be compared
383
+ def eql?(o)
384
+ self == o
385
+ end
386
+
387
+ # Calculates hash code according to all attributes.
388
+ # @return [Integer] Hash code
389
+ def hash
390
+ [lago_id, external_id, lago_customer_id, external_customer_id, billing_time, name, plan_code, status, created_at, canceled_at, started_at, ending_at, subscription_at, terminated_at, previous_plan_code, next_plan_code, downgrade_plan_date, plan].hash
391
+ end
392
+
393
+ # Builds the object from hash
394
+ # @param [Hash] attributes Model attributes in the form of hash
395
+ # @return [Object] Returns the model itself
396
+ def self.build_from_hash(attributes)
397
+ return nil unless attributes.is_a?(Hash)
398
+ attributes = attributes.transform_keys(&:to_sym)
399
+ transformed_hash = {}
400
+ openapi_types.each_pair do |key, type|
401
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
402
+ transformed_hash["#{key}"] = nil
403
+ elsif type =~ /\AArray<(.*)>/i
404
+ # check to ensure the input is an array given that the attribute
405
+ # is documented as an array but the input is not
406
+ if attributes[attribute_map[key]].is_a?(Array)
407
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
408
+ end
409
+ elsif !attributes[attribute_map[key]].nil?
410
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
411
+ end
412
+ end
413
+ new(transformed_hash)
414
+ end
415
+
416
+ # Deserializes the data based on type
417
+ # @param string type Data type
418
+ # @param string value Value to be deserialized
419
+ # @return [Object] Deserialized data
420
+ def self._deserialize(type, value)
421
+ case type.to_sym
422
+ when :Time
423
+ Time.parse(value)
424
+ when :Date
425
+ Date.parse(value)
426
+ when :String
427
+ value.to_s
428
+ when :Integer
429
+ value.to_i
430
+ when :Float
431
+ value.to_f
432
+ when :Boolean
433
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
434
+ true
435
+ else
436
+ false
437
+ end
438
+ when :Object
439
+ # generic object (usually a Hash), return directly
440
+ value
441
+ when /\AArray<(?<inner_type>.+)>\z/
442
+ inner_type = Regexp.last_match[:inner_type]
443
+ value.map { |v| _deserialize(inner_type, v) }
444
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
445
+ k_type = Regexp.last_match[:k_type]
446
+ v_type = Regexp.last_match[:v_type]
447
+ {}.tap do |hash|
448
+ value.each do |k, v|
449
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
450
+ end
451
+ end
452
+ else # model
453
+ # models (e.g. Pet) or oneOf
454
+ klass = LagoAPI.const_get(type)
455
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
456
+ end
457
+ end
458
+
459
+ # Returns the string representation of the object
460
+ # @return [String] String presentation of the object
461
+ def to_s
462
+ to_hash.to_s
463
+ end
464
+
465
+ # to_body is an alias to to_hash (backward compatibility)
466
+ # @return [Hash] Returns the object in the form of hash
467
+ def to_body
468
+ to_hash
469
+ end
470
+
471
+ # Returns the object in the form of hash
472
+ # @return [Hash] Returns the object in the form of hash
473
+ def to_hash
474
+ hash = {}
475
+ self.class.attribute_map.each_pair do |attr, param|
476
+ value = self.send(attr)
477
+ if value.nil?
478
+ is_nullable = self.class.openapi_nullable.include?(attr)
479
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
480
+ end
481
+
482
+ hash[param] = _to_hash(value)
483
+ end
484
+ hash
485
+ end
486
+
487
+ # Outputs non-array value in the form of hash
488
+ # For object, use to_hash. Otherwise, just return the value
489
+ # @param [Object] value Any valid value
490
+ # @return [Hash] Returns the value in the form of hash
491
+ def _to_hash(value)
492
+ if value.is_a?(Array)
493
+ value.compact.map { |v| _to_hash(v) }
494
+ elsif value.is_a?(Hash)
495
+ {}.tap do |hash|
496
+ value.each { |k, v| hash[k] = _to_hash(v) }
497
+ end
498
+ elsif value.respond_to? :to_hash
499
+ value.to_hash
500
+ else
501
+ value
502
+ end
503
+ end
504
+
505
+ end
506
+
507
+ 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
@@ -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.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
@@ -24,12 +24,15 @@ module LagoAPI
24
24
  # The start date and time of the subscription. This field can only be modified for pending subscriptions that have not yet started. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
25
25
  attr_accessor :subscription_at
26
26
 
27
+ attr_accessor :plan_overrides
28
+
27
29
  # Attribute mapping from ruby-style variable name to JSON key.
28
30
  def self.attribute_map
29
31
  {
30
32
  :'name' => :'name',
31
33
  :'ending_at' => :'ending_at',
32
- :'subscription_at' => :'subscription_at'
34
+ :'subscription_at' => :'subscription_at',
35
+ :'plan_overrides' => :'plan_overrides'
33
36
  }
34
37
  end
35
38
 
@@ -43,7 +46,8 @@ module LagoAPI
43
46
  {
44
47
  :'name' => :'String',
45
48
  :'ending_at' => :'Time',
46
- :'subscription_at' => :'Time'
49
+ :'subscription_at' => :'Time',
50
+ :'plan_overrides' => :'PlanOverridesObject'
47
51
  }
48
52
  end
49
53
 
@@ -80,6 +84,10 @@ module LagoAPI
80
84
  if attributes.key?(:'subscription_at')
81
85
  self.subscription_at = attributes[:'subscription_at']
82
86
  end
87
+
88
+ if attributes.key?(:'plan_overrides')
89
+ self.plan_overrides = attributes[:'plan_overrides']
90
+ end
83
91
  end
84
92
 
85
93
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -104,7 +112,8 @@ module LagoAPI
104
112
  self.class == o.class &&
105
113
  name == o.name &&
106
114
  ending_at == o.ending_at &&
107
- subscription_at == o.subscription_at
115
+ subscription_at == o.subscription_at &&
116
+ plan_overrides == o.plan_overrides
108
117
  end
109
118
 
110
119
  # @see the `==` method
@@ -116,7 +125,7 @@ module LagoAPI
116
125
  # Calculates hash code according to all attributes.
117
126
  # @return [Integer] Hash code
118
127
  def hash
119
- [name, ending_at, subscription_at].hash
128
+ [name, ending_at, subscription_at, plan_overrides].hash
120
129
  end
121
130
 
122
131
  # Builds the object from hash
@@ -181,7 +190,7 @@ module LagoAPI
181
190
  else # model
182
191
  # models (e.g. Pet) or oneOf
183
192
  klass = LagoAPI.const_get(type)
184
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
193
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
194
  end
186
195
  end
187
196
 
@@ -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
@@ -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.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
@@ -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.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
@@ -222,7 +222,7 @@ module LagoAPI
222
222
  else # model
223
223
  # models (e.g. Pet) or oneOf
224
224
  klass = LagoAPI.const_get(type)
225
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
225
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
226
226
  end
227
227
  end
228
228
 
@@ -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
@@ -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.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
@@ -250,7 +250,7 @@ module LagoAPI
250
250
  else # model
251
251
  # models (e.g. Pet) or oneOf
252
252
  klass = LagoAPI.const_get(type)
253
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
253
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
254
254
  end
255
255
  end
256
256