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,221 @@
1
+ =begin
2
+ #Lago API documentation
3
+
4
+ #Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
5
+
6
+ The version of the OpenAPI document: 0.51.0-beta
7
+ Contact: tech@getlago.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LagoAPI
17
+ class CreditNoteEstimateInput
18
+ attr_accessor :credit_note
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'credit_note' => :'credit_note'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'credit_note' => :'CreditNoteEstimateInputCreditNote'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CreditNoteEstimateInput` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CreditNoteEstimateInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'credit_note')
61
+ self.credit_note = attributes[:'credit_note']
62
+ else
63
+ self.credit_note = nil
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
71
+ invalid_properties = Array.new
72
+ if @credit_note.nil?
73
+ invalid_properties.push('invalid value for "credit_note", credit_note cannot be nil.')
74
+ end
75
+
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
+ return false if @credit_note.nil?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ credit_note == o.credit_note
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [credit_note].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ openapi_types.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash["#{key}"] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
122
+ end
123
+ elsif !attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
125
+ end
126
+ end
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def self._deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = LagoAPI.const_get(type)
169
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end
@@ -0,0 +1,241 @@
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 CreditNoteEstimateInputCreditNote
18
+ # The invoice unique identifier, created by Lago.
19
+ attr_accessor :invoice_id
20
+
21
+ # The list of credit note’s items.
22
+ attr_accessor :items
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'invoice_id' => :'invoice_id',
28
+ :'items' => :'items'
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
+ :'invoice_id' => :'String',
41
+ :'items' => :'Array<CreditNoteEstimateInputCreditNoteItemsInner>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CreditNoteEstimateInputCreditNote` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CreditNoteEstimateInputCreditNote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'invoice_id')
67
+ self.invoice_id = attributes[:'invoice_id']
68
+ else
69
+ self.invoice_id = nil
70
+ end
71
+
72
+ if attributes.key?(:'items')
73
+ if (value = attributes[:'items']).is_a?(Array)
74
+ self.items = value
75
+ end
76
+ else
77
+ self.items = nil
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
+ invalid_properties = Array.new
86
+ if @invoice_id.nil?
87
+ invalid_properties.push('invalid value for "invoice_id", invoice_id cannot be nil.')
88
+ end
89
+
90
+ if @items.nil?
91
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
101
+ return false if @invoice_id.nil?
102
+ return false if @items.nil?
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ invoice_id == o.invoice_id &&
112
+ items == o.items
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [invoice_id, items].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
133
+ transformed_hash = {}
134
+ openapi_types.each_pair do |key, type|
135
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = nil
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[attribute_map[key]].is_a?(Array)
141
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
142
+ end
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
145
+ end
146
+ end
147
+ new(transformed_hash)
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def self._deserialize(type, value)
155
+ case type.to_sym
156
+ when :Time
157
+ Time.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ # models (e.g. Pet) or oneOf
188
+ klass = LagoAPI.const_get(type)
189
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+
241
+ end
@@ -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 CreditNoteEstimateInputCreditNoteItemsInner
18
+ # The fee unique identifier, created by Lago.
19
+ attr_accessor :fee_id
20
+
21
+ # The amount of the credit note item, expressed in cents.
22
+ attr_accessor :amount_cents
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'fee_id' => :'fee_id',
28
+ :'amount_cents' => :'amount_cents'
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
+ :'fee_id' => :'String',
41
+ :'amount_cents' => :'Integer'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CreditNoteEstimateInputCreditNoteItemsInner` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CreditNoteEstimateInputCreditNoteItemsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'fee_id')
67
+ self.fee_id = attributes[:'fee_id']
68
+ else
69
+ self.fee_id = nil
70
+ end
71
+
72
+ if attributes.key?(:'amount_cents')
73
+ self.amount_cents = attributes[:'amount_cents']
74
+ else
75
+ self.amount_cents = 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 @fee_id.nil?
85
+ invalid_properties.push('invalid value for "fee_id", fee_id cannot be nil.')
86
+ end
87
+
88
+ if @amount_cents.nil?
89
+ invalid_properties.push('invalid value for "amount_cents", amount_cents 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 @fee_id.nil?
100
+ return false if @amount_cents.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
+ fee_id == o.fee_id &&
110
+ amount_cents == o.amount_cents
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
+ [fee_id, amount_cents].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