lago_ruby 0.51.0.pre.beta → 0.52.0.pre.beta

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