maxio-advanced-billing-sdk 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +40 -40
  3. data/lib/advanced_billing/controllers/advance_invoice_controller.rb +6 -4
  4. data/lib/advanced_billing/controllers/base_controller.rb +1 -1
  5. data/lib/advanced_billing/controllers/components_controller.rb +9 -58
  6. data/lib/advanced_billing/controllers/coupons_controller.rb +6 -115
  7. data/lib/advanced_billing/controllers/custom_fields_controller.rb +4 -4
  8. data/lib/advanced_billing/controllers/events_based_billing_segments_controller.rb +5 -22
  9. data/lib/advanced_billing/controllers/insights_controller.rb +3 -4
  10. data/lib/advanced_billing/controllers/invoices_controller.rb +11 -0
  11. data/lib/advanced_billing/controllers/payment_profiles_controller.rb +26 -0
  12. data/lib/advanced_billing/controllers/product_families_controller.rb +5 -14
  13. data/lib/advanced_billing/controllers/product_price_points_controller.rb +3 -40
  14. data/lib/advanced_billing/controllers/products_controller.rb +5 -14
  15. data/lib/advanced_billing/controllers/subscription_components_controller.rb +16 -66
  16. data/lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb +5 -15
  17. data/lib/advanced_billing/controllers/subscription_groups_controller.rb +6 -6
  18. data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +13 -20
  19. data/lib/advanced_billing/controllers/subscriptions_controller.rb +49 -14
  20. data/lib/advanced_billing/models/ach_agreement.rb +10 -0
  21. data/lib/advanced_billing/models/address_change.rb +0 -22
  22. data/lib/advanced_billing/models/agreement_acceptance.rb +10 -0
  23. data/lib/advanced_billing/models/allocation.rb +1 -3
  24. data/lib/advanced_billing/models/applied_credit_note_data.rb +10 -0
  25. data/lib/advanced_billing/models/apply_credit_note_event.rb +139 -0
  26. data/lib/advanced_billing/models/apply_credit_note_event_data.rb +3 -1
  27. data/lib/advanced_billing/models/apply_debit_note_event.rb +139 -0
  28. data/lib/advanced_billing/models/apply_debit_note_event_data.rb +36 -2
  29. data/lib/advanced_billing/models/apply_payment_event.rb +139 -0
  30. data/lib/advanced_billing/models/apply_payment_event_data.rb +21 -7
  31. data/lib/advanced_billing/models/backport_invoice_event.rb +139 -0
  32. data/lib/advanced_billing/models/bank_account_attributes.rb +10 -0
  33. data/lib/advanced_billing/models/billing_manifest.rb +5 -1
  34. data/lib/advanced_billing/models/billing_schedule.rb +10 -0
  35. data/lib/advanced_billing/models/change_chargeback_status_event.rb +141 -0
  36. data/lib/advanced_billing/models/change_chargeback_status_event_data.rb +73 -0
  37. data/lib/advanced_billing/models/change_invoice_collection_method_event.rb +141 -0
  38. data/lib/advanced_billing/models/change_invoice_status_event.rb +141 -0
  39. data/lib/advanced_billing/models/change_invoice_status_event_data.rb +131 -0
  40. data/lib/advanced_billing/models/chargeback_status.rb +29 -0
  41. data/lib/advanced_billing/models/component.rb +3 -13
  42. data/lib/advanced_billing/models/component_cost_data.rb +10 -0
  43. data/lib/advanced_billing/models/component_cost_data_rate_tier.rb +10 -0
  44. data/lib/advanced_billing/models/component_custom_price.rb +10 -0
  45. data/lib/advanced_billing/models/component_price_point.rb +2 -13
  46. data/lib/advanced_billing/models/component_price_point_item.rb +10 -0
  47. data/lib/advanced_billing/models/coupon.rb +4 -14
  48. data/lib/advanced_billing/models/create_component_price_point.rb +6 -2
  49. data/lib/advanced_billing/models/create_component_price_point_request.rb +1 -1
  50. data/lib/advanced_billing/models/create_component_price_points_request.rb +1 -1
  51. data/lib/advanced_billing/models/create_credit_note_event.rb +139 -0
  52. data/lib/advanced_billing/models/create_debit_note_event.rb +139 -0
  53. data/lib/advanced_billing/models/create_invoice_payment_application.rb +22 -0
  54. data/lib/advanced_billing/models/create_multi_invoice_payment.rb +6 -2
  55. data/lib/advanced_billing/models/create_offer_component.rb +11 -0
  56. data/lib/advanced_billing/models/create_payment_profile.rb +4 -4
  57. data/lib/advanced_billing/models/create_prepaid_usage_component_price_point.rb +10 -4
  58. data/lib/advanced_billing/models/create_product_family.rb +14 -4
  59. data/lib/advanced_billing/models/create_subscription.rb +2 -2
  60. data/lib/advanced_billing/models/credit_card_attributes.rb +10 -0
  61. data/lib/advanced_billing/models/credit_note_application.rb +10 -0
  62. data/lib/advanced_billing/models/credit_note_line_item.rb +10 -0
  63. data/lib/advanced_billing/models/customer.rb +13 -1
  64. data/lib/advanced_billing/models/customer_attributes.rb +10 -0
  65. data/lib/advanced_billing/models/customer_change.rb +7 -22
  66. data/lib/advanced_billing/models/customer_custom_fields_change.rb +0 -22
  67. data/lib/advanced_billing/models/customer_payer_change.rb +0 -22
  68. data/lib/advanced_billing/models/debit_note.rb +351 -0
  69. data/lib/advanced_billing/models/debit_note_role.rb +23 -0
  70. data/lib/advanced_billing/models/debit_note_status.rb +29 -0
  71. data/lib/advanced_billing/models/deduct_service_credit.rb +10 -16
  72. data/lib/advanced_billing/models/dunner_data.rb +38 -0
  73. data/lib/advanced_billing/models/dunning_step_data.rb +34 -0
  74. data/lib/advanced_billing/models/dunning_step_reached.rb +12 -6
  75. data/lib/advanced_billing/models/failed_payment_event.rb +139 -0
  76. data/lib/advanced_billing/models/failed_payment_event_data.rb +132 -0
  77. data/lib/advanced_billing/models/group_billing.rb +10 -0
  78. data/lib/advanced_billing/models/group_settings.rb +4 -2
  79. data/lib/advanced_billing/models/group_target.rb +14 -0
  80. data/lib/advanced_billing/models/historic_usage.rb +109 -0
  81. data/lib/advanced_billing/models/include_null_or_not_null.rb +23 -0
  82. data/lib/advanced_billing/models/invoice.rb +18 -8
  83. data/lib/advanced_billing/models/invoice_address.rb +10 -0
  84. data/lib/advanced_billing/models/invoice_balance_item.rb +10 -0
  85. data/lib/advanced_billing/models/invoice_credit.rb +10 -0
  86. data/lib/advanced_billing/models/invoice_custom_field.rb +10 -0
  87. data/lib/advanced_billing/models/invoice_customer.rb +10 -0
  88. data/lib/advanced_billing/models/invoice_discount.rb +10 -0
  89. data/lib/advanced_billing/models/invoice_discount_breakout.rb +10 -0
  90. data/lib/advanced_billing/models/invoice_display_settings.rb +10 -0
  91. data/lib/advanced_billing/models/invoice_event_type.rb +3 -0
  92. data/lib/advanced_billing/models/invoice_issued.rb +6 -2
  93. data/lib/advanced_billing/models/invoice_line_item.rb +3 -3
  94. data/lib/advanced_billing/models/invoice_line_item_event_data.rb +10 -0
  95. data/lib/advanced_billing/models/invoice_line_item_pricing_detail.rb +10 -0
  96. data/lib/advanced_billing/models/invoice_payer.rb +10 -0
  97. data/lib/advanced_billing/models/invoice_payment.rb +10 -0
  98. data/lib/advanced_billing/models/invoice_payment_method.rb +10 -0
  99. data/lib/advanced_billing/models/invoice_pre_payment.rb +0 -10
  100. data/lib/advanced_billing/models/invoice_previous_balance.rb +10 -0
  101. data/lib/advanced_billing/models/invoice_refund.rb +10 -0
  102. data/lib/advanced_billing/models/invoice_seller.rb +10 -0
  103. data/lib/advanced_billing/models/invoice_status.rb +2 -2
  104. data/lib/advanced_billing/models/invoice_tax.rb +10 -0
  105. data/lib/advanced_billing/models/invoice_tax_breakout.rb +10 -0
  106. data/lib/advanced_billing/models/invoice_tax_component_breakout.rb +10 -0
  107. data/lib/advanced_billing/models/issue_invoice_event.rb +139 -0
  108. data/lib/advanced_billing/models/issue_invoice_event_data.rb +6 -6
  109. data/lib/advanced_billing/models/issue_service_credit.rb +10 -16
  110. data/lib/advanced_billing/models/item_price_point_changed.rb +8 -4
  111. data/lib/advanced_billing/models/item_price_point_data.rb +10 -0
  112. data/lib/advanced_billing/models/list_components_filter.rb +74 -0
  113. data/lib/advanced_billing/models/list_coupons_filter.rb +168 -0
  114. data/lib/advanced_billing/models/list_invoice_events_response.rb +14 -11
  115. data/lib/advanced_billing/models/{refund_prepayment_aggregated_error.rb → list_mrr_filter.rb} +14 -12
  116. data/lib/advanced_billing/models/{list_subscription_group_prepayment_date_field.rb → list_prepayment_date_field.rb} +4 -4
  117. data/lib/advanced_billing/models/list_prepayments_filter.rb +88 -0
  118. data/lib/advanced_billing/models/list_price_points_filter.rb +163 -0
  119. data/lib/advanced_billing/models/list_products_filter.rb +81 -0
  120. data/lib/advanced_billing/models/list_segments_filter.rb +103 -0
  121. data/lib/advanced_billing/models/list_subscription_components_filter.rb +74 -0
  122. data/lib/advanced_billing/models/list_subscription_components_for_site_filter.rb +84 -0
  123. data/lib/advanced_billing/models/list_subscription_components_include.rb +4 -1
  124. data/lib/advanced_billing/models/metafield_scope.rb +10 -0
  125. data/lib/advanced_billing/models/nested_subscription_group.rb +0 -10
  126. data/lib/advanced_billing/models/origin_invoice.rb +10 -0
  127. data/lib/advanced_billing/models/overage_pricing.rb +14 -0
  128. data/lib/advanced_billing/models/paid_invoice.rb +2 -2
  129. data/lib/advanced_billing/models/payer_attributes.rb +10 -0
  130. data/lib/advanced_billing/models/prepaid_component_price_point.rb +10 -0
  131. data/lib/advanced_billing/models/prepaid_product_price_point_filter.rb +56 -0
  132. data/lib/advanced_billing/models/prepaid_usage.rb +6 -2
  133. data/lib/advanced_billing/models/prepaid_usage_allocation_detail.rb +10 -0
  134. data/lib/advanced_billing/models/product.rb +5 -16
  135. data/lib/advanced_billing/models/product_price_point.rb +9 -0
  136. data/lib/advanced_billing/models/proforma_invoice.rb +2 -2
  137. data/lib/advanced_billing/models/proforma_invoice_issued.rb +6 -2
  138. data/lib/advanced_billing/models/reactivation_billing.rb +10 -0
  139. data/lib/advanced_billing/models/record_payment_response.rb +1 -13
  140. data/lib/advanced_billing/models/refund_invoice_event.rb +139 -0
  141. data/lib/advanced_billing/models/refund_invoice_event_data.rb +4 -2
  142. data/lib/advanced_billing/models/refund_invoice_request.rb +1 -1
  143. data/lib/advanced_billing/models/refund_prepayment.rb +3 -1
  144. data/lib/advanced_billing/models/remove_payment_event.rb +139 -0
  145. data/lib/advanced_billing/models/remove_payment_event_data.rb +1 -1
  146. data/lib/advanced_billing/models/segment_price.rb +10 -0
  147. data/lib/advanced_billing/models/subscription.rb +10 -16
  148. data/lib/advanced_billing/models/subscription_component.rb +26 -7
  149. data/lib/advanced_billing/models/subscription_component_subscription.rb +10 -0
  150. data/lib/advanced_billing/models/subscription_filter.rb +153 -0
  151. data/lib/advanced_billing/models/subscription_group.rb +2 -2
  152. data/lib/advanced_billing/models/subscription_group_bank_account.rb +10 -0
  153. data/lib/advanced_billing/models/subscription_group_component_custom_price.rb +10 -0
  154. data/lib/advanced_billing/models/subscription_group_prepayment_response.rb +3 -1
  155. data/lib/advanced_billing/models/subscription_group_signup.rb +2 -2
  156. data/lib/advanced_billing/models/subscription_group_signup_failure.rb +4 -2
  157. data/lib/advanced_billing/models/subscription_group_signup_failure_data.rb +10 -0
  158. data/lib/advanced_billing/models/subscription_group_signup_item.rb +10 -0
  159. data/lib/advanced_billing/models/subscription_group_signup_response.rb +2 -2
  160. data/lib/advanced_billing/models/subscription_group_signup_success.rb +8 -4
  161. data/lib/advanced_billing/models/subscription_group_signup_success_data.rb +50 -0
  162. data/lib/advanced_billing/models/update_customer.rb +12 -0
  163. data/lib/advanced_billing/models/update_subscription_component.rb +10 -0
  164. data/lib/advanced_billing/models/upsert_prepaid_configuration.rb +10 -0
  165. data/lib/advanced_billing/models/usage.rb +3 -1
  166. data/lib/advanced_billing/models/void_invoice_event.rb +139 -0
  167. data/lib/advanced_billing/models/void_invoice_event_data.rb +8 -7
  168. data/lib/advanced_billing/models/void_remainder_event.rb +139 -0
  169. data/lib/advanced_billing/models/void_remainder_event_data.rb +4 -2
  170. data/lib/advanced_billing/utilities/union_type_lookup.rb +69 -199
  171. data/lib/advanced_billing.rb +42 -18
  172. metadata +38 -17
  173. data/lib/advanced_billing/exceptions/refund_prepayment_aggregated_errors_response_exception.rb +0 -33
  174. data/lib/advanced_billing/models/billing_address.rb +0 -117
  175. data/lib/advanced_billing/models/credit_note1.rb +0 -419
  176. data/lib/advanced_billing/models/customer1.rb +0 -125
  177. data/lib/advanced_billing/models/invoice_event.rb +0 -124
  178. data/lib/advanced_billing/models/invoice_event_data.rb +0 -447
  179. data/lib/advanced_billing/models/invoice_event_payment.rb +0 -168
  180. data/lib/advanced_billing/models/invoice_event_payment1.rb +0 -160
  181. data/lib/advanced_billing/models/prepayment_aggregated_error.rb +0 -81
  182. data/lib/advanced_billing/models/price_point.rb +0 -216
  183. data/lib/advanced_billing/models/refund.rb +0 -138
  184. data/lib/advanced_billing/models/seller.rb +0 -92
  185. data/lib/advanced_billing/models/shipping_address.rb +0 -117
@@ -227,7 +227,9 @@ module AdvancedBilling
227
227
  APIHelper.valid_type?(value.consolidation_level,
228
228
  ->(val) { val.instance_of? String }) and
229
229
  APIHelper.valid_type?(value.line_items,
230
- ->(val) { InvoiceLineItemEventData.validate(val) })
230
+ ->(val) { InvoiceLineItemEventData.validate(val) },
231
+ is_model_hash: true,
232
+ is_inner_model_hash: true)
231
233
  )
232
234
  end
233
235
 
@@ -263,7 +265,9 @@ module AdvancedBilling
263
265
  APIHelper.valid_type?(value['consolidation_level'],
264
266
  ->(val) { val.instance_of? String }) and
265
267
  APIHelper.valid_type?(value['line_items'],
266
- ->(val) { InvoiceLineItemEventData.validate(val) })
268
+ ->(val) { InvoiceLineItemEventData.validate(val) },
269
+ is_model_hash: true,
270
+ is_inner_model_hash: true)
267
271
  )
268
272
  end
269
273
  end
@@ -302,9 +302,9 @@ module AdvancedBilling
302
302
  price_point_id =
303
303
  hash.key?('price_point_id') ? hash['price_point_id'] : SKIP
304
304
  hide = hash.key?('hide') ? hash['hide'] : SKIP
305
- component_cost_data = hash.key?('component_cost_data') ? APIHelper.deserialize_union_type(
306
- UnionTypeLookUp.get(:InvoiceLineItemComponentCostData2), hash['component_cost_data']
307
- ) : SKIP
305
+ if hash['component_cost_data']
306
+ component_cost_data = InvoiceLineItemComponentCostData.from_hash(hash['component_cost_data'])
307
+ end
308
308
  product_price_point_id =
309
309
  hash.key?('product_price_point_id') ? hash['product_price_point_id'] : SKIP
310
310
  custom_item = hash.key?('custom_item') ? hash['custom_item'] : SKIP
@@ -272,5 +272,15 @@ module AdvancedBilling
272
272
  custom_item,
273
273
  hash)
274
274
  end
275
+
276
+ # Validates an instance of the object from a given value.
277
+ # @param [InvoiceLineItemEventData | Hash] The value against the validation is performed.
278
+ def self.validate(value)
279
+ return true if value.instance_of? self
280
+
281
+ return false unless value.instance_of? Hash
282
+
283
+ true
284
+ end
275
285
  end
276
286
  end
@@ -66,5 +66,15 @@ module AdvancedBilling
66
66
  amount,
67
67
  hash)
68
68
  end
69
+
70
+ # Validates an instance of the object from a given value.
71
+ # @param [InvoiceLineItemPricingDetail | Hash] The value against the validation is performed.
72
+ def self.validate(value)
73
+ return true if value.instance_of? self
74
+
75
+ return false unless value.instance_of? Hash
76
+
77
+ true
78
+ end
69
79
  end
70
80
  end
@@ -109,5 +109,15 @@ module AdvancedBilling
109
109
  vat_number,
110
110
  hash)
111
111
  end
112
+
113
+ # Validates an instance of the object from a given value.
114
+ # @param [InvoicePayer | Hash] The value against the validation is performed.
115
+ def self.validate(value)
116
+ return true if value.instance_of? self
117
+
118
+ return false unless value.instance_of? Hash
119
+
120
+ true
121
+ end
112
122
  end
113
123
  end
@@ -164,5 +164,15 @@ module AdvancedBilling
164
164
  def to_custom_transaction_time
165
165
  DateTimeHelper.to_rfc3339(transaction_time)
166
166
  end
167
+
168
+ # Validates an instance of the object from a given value.
169
+ # @param [InvoicePayment | Hash] The value against the validation is performed.
170
+ def self.validate(value)
171
+ return true if value.instance_of? self
172
+
173
+ return false unless value.instance_of? Hash
174
+
175
+ true
176
+ end
167
177
  end
168
178
  end
@@ -130,5 +130,15 @@ module AdvancedBilling
130
130
  masked_card_number,
131
131
  hash)
132
132
  end
133
+
134
+ # Validates an instance of the object from a given value.
135
+ # @param [InvoicePaymentMethod | Hash] The value against the validation is performed.
136
+ def self.validate(value)
137
+ return true if value.instance_of? self
138
+
139
+ return false unless value.instance_of? Hash
140
+
141
+ true
142
+ end
133
143
  end
134
144
  end
@@ -81,15 +81,5 @@ module AdvancedBilling
81
81
  ending_balance_in_cents,
82
82
  hash)
83
83
  end
84
-
85
- # Validates an instance of the object from a given value.
86
- # @param [InvoicePrePayment | Hash] The value against the validation is performed.
87
- def self.validate(value)
88
- return true if value.instance_of? self
89
-
90
- return false unless value.instance_of? Hash
91
-
92
- true
93
- end
94
84
  end
95
85
  end
@@ -84,5 +84,15 @@ module AdvancedBilling
84
84
  def to_custom_captured_at
85
85
  DateTimeHelper.to_rfc3339(captured_at)
86
86
  end
87
+
88
+ # Validates an instance of the object from a given value.
89
+ # @param [InvoicePreviousBalance | Hash] The value against the validation is performed.
90
+ def self.validate(value)
91
+ return true if value.instance_of? self
92
+
93
+ return false unless value.instance_of? Hash
94
+
95
+ true
96
+ end
87
97
  end
88
98
  end
@@ -134,5 +134,15 @@ module AdvancedBilling
134
134
  gateway_handle,
135
135
  hash)
136
136
  end
137
+
138
+ # Validates an instance of the object from a given value.
139
+ # @param [InvoiceRefund | Hash] The value against the validation is performed.
140
+ def self.validate(value)
141
+ return true if value.instance_of? self
142
+
143
+ return false unless value.instance_of? Hash
144
+
145
+ true
146
+ end
137
147
  end
138
148
  end
@@ -89,5 +89,15 @@ module AdvancedBilling
89
89
  logo_url,
90
90
  hash)
91
91
  end
92
+
93
+ # Validates an instance of the object from a given value.
94
+ # @param [InvoiceSeller | Hash] The value against the validation is performed.
95
+ def self.validate(value)
96
+ return true if value.instance_of? self
97
+
98
+ return false unless value.instance_of? Hash
99
+
100
+ true
101
+ end
92
102
  end
93
103
  end
@@ -5,8 +5,8 @@
5
5
 
6
6
  module AdvancedBilling
7
7
  # The current status of the invoice. See [Invoice
8
- # Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-
9
- # item-breakdowns) for more.
8
+ # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405078794253
9
+ # -Introduction-to-Invoices#invoice-statuses) for more.
10
10
  class InvoiceStatus
11
11
  INVOICE_STATUS = [
12
12
  # TODO: Write general description for DRAFT
@@ -178,5 +178,15 @@ module AdvancedBilling
178
178
  tax_component_breakouts,
179
179
  hash)
180
180
  end
181
+
182
+ # Validates an instance of the object from a given value.
183
+ # @param [InvoiceTax | Hash] The value against the validation is performed.
184
+ def self.validate(value)
185
+ return true if value.instance_of? self
186
+
187
+ return false unless value.instance_of? Hash
188
+
189
+ true
190
+ end
181
191
  end
182
192
  end
@@ -88,5 +88,15 @@ module AdvancedBilling
88
88
  tax_exempt_amount,
89
89
  hash)
90
90
  end
91
+
92
+ # Validates an instance of the object from a given value.
93
+ # @param [InvoiceTaxBreakout | Hash] The value against the validation is performed.
94
+ def self.validate(value)
95
+ return true if value.instance_of? self
96
+
97
+ return false unless value.instance_of? Hash
98
+
99
+ true
100
+ end
91
101
  end
92
102
  end
@@ -87,5 +87,15 @@ module AdvancedBilling
87
87
  subdivision_code,
88
88
  hash)
89
89
  end
90
+
91
+ # Validates an instance of the object from a given value.
92
+ # @param [InvoiceTaxComponentBreakout | Hash] The value against the validation is performed.
93
+ def self.validate(value)
94
+ return true if value.instance_of? self
95
+
96
+ return false unless value.instance_of? Hash
97
+
98
+ true
99
+ end
90
100
  end
91
101
  end
@@ -0,0 +1,139 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module AdvancedBilling
8
+ # IssueInvoiceEvent Model.
9
+ class IssueInvoiceEvent < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [Integer]
15
+ attr_accessor :id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [DateTime]
19
+ attr_accessor :timestamp
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Invoice]
23
+ attr_accessor :invoice
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [InvoiceEventType]
27
+ attr_accessor :event_type
28
+
29
+ # Example schema for an `issue_invoice` event
30
+ # @return [IssueInvoiceEventData]
31
+ attr_accessor :event_data
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['id'] = 'id'
37
+ @_hash['timestamp'] = 'timestamp'
38
+ @_hash['invoice'] = 'invoice'
39
+ @_hash['event_type'] = 'event_type'
40
+ @_hash['event_data'] = 'event_data'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ []
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(id = nil,
55
+ timestamp = nil,
56
+ invoice = nil,
57
+ event_type = InvoiceEventType::ISSUE_INVOICE,
58
+ event_data = nil,
59
+ additional_properties = {})
60
+ @id = id
61
+ @timestamp = timestamp
62
+ @invoice = invoice
63
+ @event_type = event_type
64
+ @event_data = event_data
65
+
66
+ # Add additional model properties to the instance.
67
+ additional_properties.each do |_name, _value|
68
+ instance_variable_set("@#{_name}", _value)
69
+ end
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ id = hash.key?('id') ? hash['id'] : nil
78
+ timestamp = if hash.key?('timestamp')
79
+ (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
80
+ end
81
+ invoice = Invoice.from_hash(hash['invoice']) if hash['invoice']
82
+ event_type = hash['event_type'] ||= InvoiceEventType::ISSUE_INVOICE
83
+ event_data = IssueInvoiceEventData.from_hash(hash['event_data']) if hash['event_data']
84
+
85
+ # Clean out expected properties from Hash.
86
+ names.each_value { |k| hash.delete(k) }
87
+
88
+ # Create object from extracted values.
89
+ IssueInvoiceEvent.new(id,
90
+ timestamp,
91
+ invoice,
92
+ event_type,
93
+ event_data,
94
+ hash)
95
+ end
96
+
97
+ def to_custom_timestamp
98
+ DateTimeHelper.to_rfc3339(timestamp)
99
+ end
100
+
101
+ # Validates an instance of the object from a given value.
102
+ # @param [IssueInvoiceEvent | Hash] The value against the validation is performed.
103
+ def self.validate(value)
104
+ if value.instance_of? self
105
+ return (
106
+ APIHelper.valid_type?(value.id,
107
+ ->(val) { val.instance_of? Integer }) and
108
+ APIHelper.valid_type?(value.timestamp,
109
+ ->(val) { val.instance_of? DateTime }) and
110
+ APIHelper.valid_type?(value.invoice,
111
+ ->(val) { Invoice.validate(val) },
112
+ is_model_hash: true) and
113
+ APIHelper.valid_type?(value.event_type,
114
+ ->(val) { InvoiceEventType.validate(val) }) and
115
+ APIHelper.valid_type?(value.event_data,
116
+ ->(val) { IssueInvoiceEventData.validate(val) },
117
+ is_model_hash: true)
118
+ )
119
+ end
120
+
121
+ return false unless value.instance_of? Hash
122
+
123
+ (
124
+ APIHelper.valid_type?(value['id'],
125
+ ->(val) { val.instance_of? Integer }) and
126
+ APIHelper.valid_type?(value['timestamp'],
127
+ ->(val) { val.instance_of? String }) and
128
+ APIHelper.valid_type?(value['invoice'],
129
+ ->(val) { Invoice.validate(val) },
130
+ is_model_hash: true) and
131
+ APIHelper.valid_type?(value['event_type'],
132
+ ->(val) { InvoiceEventType.validate(val) }) and
133
+ APIHelper.valid_type?(value['event_data'],
134
+ ->(val) { IssueInvoiceEventData.validate(val) },
135
+ is_model_hash: true)
136
+ )
137
+ end
138
+ end
139
+ end
@@ -24,15 +24,15 @@ module AdvancedBilling
24
24
  # @return [InvoiceConsolidationLevel]
25
25
  attr_accessor :consolidation_level
26
26
 
27
- # The status of the invoice before event occurence. See [Invoice
28
- # Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#lin
29
- # e-item-breakdowns) for more.
27
+ # The status of the invoice before event occurrence. See [Invoice
28
+ # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
29
+ # 53-Introduction-to-Invoices#invoice-statusess) for more.
30
30
  # @return [InvoiceStatus]
31
31
  attr_accessor :from_status
32
32
 
33
- # The status of the invoice after event occurence. See [Invoice
34
- # Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#lin
35
- # e-item-breakdowns) for more.
33
+ # The status of the invoice after event occurrence. See [Invoice
34
+ # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
35
+ # 53-Introduction-to-Invoices#invoice-statusess) for more.
36
36
  # @return [InvoiceStatus]
37
37
  attr_accessor :to_status
38
38
 
@@ -27,7 +27,9 @@ module AdvancedBilling
27
27
 
28
28
  # An array for optional fields
29
29
  def self.optionals
30
- []
30
+ %w[
31
+ memo
32
+ ]
31
33
  end
32
34
 
33
35
  # An array for nullable fields
@@ -36,10 +38,10 @@ module AdvancedBilling
36
38
  end
37
39
 
38
40
  def initialize(amount = nil,
39
- memo = nil,
41
+ memo = SKIP,
40
42
  additional_properties = {})
41
43
  @amount = amount
42
- @memo = memo
44
+ @memo = memo unless memo == SKIP
43
45
 
44
46
  # Add additional model properties to the instance.
45
47
  additional_properties.each do |_name, _value|
@@ -55,7 +57,7 @@ module AdvancedBilling
55
57
  amount = hash.key?('amount') ? APIHelper.deserialize_union_type(
56
58
  UnionTypeLookUp.get(:IssueServiceCreditAmount), hash['amount']
57
59
  ) : nil
58
- memo = hash.key?('memo') ? hash['memo'] : nil
60
+ memo = hash.key?('memo') ? hash['memo'] : SKIP
59
61
 
60
62
  # Clean out expected properties from Hash.
61
63
  names.each_value { |k| hash.delete(k) }
@@ -70,22 +72,14 @@ module AdvancedBilling
70
72
  # @param [IssueServiceCredit | Hash] The value against the validation is performed.
71
73
  def self.validate(value)
72
74
  if value.instance_of? self
73
- return (
74
- UnionTypeLookUp.get(:IssueServiceCreditAmount)
75
- .validate(value.amount) and
76
- APIHelper.valid_type?(value.memo,
77
- ->(val) { val.instance_of? String })
78
- )
75
+ return UnionTypeLookUp.get(:IssueServiceCreditAmount)
76
+ .validate(value.amount)
79
77
  end
80
78
 
81
79
  return false unless value.instance_of? Hash
82
80
 
83
- (
84
- UnionTypeLookUp.get(:IssueServiceCreditAmount)
85
- .validate(value['amount']) and
86
- APIHelper.valid_type?(value['memo'],
87
- ->(val) { val.instance_of? String })
88
- )
81
+ UnionTypeLookUp.get(:IssueServiceCreditAmount)
82
+ .validate(value['amount'])
89
83
  end
90
84
  end
91
85
  end
@@ -116,9 +116,11 @@ module AdvancedBilling
116
116
  APIHelper.valid_type?(value.item_name,
117
117
  ->(val) { val.instance_of? String }) and
118
118
  APIHelper.valid_type?(value.previous_price_point,
119
- ->(val) { ItemPricePointData.validate(val) }) and
119
+ ->(val) { ItemPricePointData.validate(val) },
120
+ is_model_hash: true) and
120
121
  APIHelper.valid_type?(value.current_price_point,
121
- ->(val) { ItemPricePointData.validate(val) })
122
+ ->(val) { ItemPricePointData.validate(val) },
123
+ is_model_hash: true)
122
124
  )
123
125
  end
124
126
 
@@ -134,9 +136,11 @@ module AdvancedBilling
134
136
  APIHelper.valid_type?(value['item_name'],
135
137
  ->(val) { val.instance_of? String }) and
136
138
  APIHelper.valid_type?(value['previous_price_point'],
137
- ->(val) { ItemPricePointData.validate(val) }) and
139
+ ->(val) { ItemPricePointData.validate(val) },
140
+ is_model_hash: true) and
138
141
  APIHelper.valid_type?(value['current_price_point'],
139
- ->(val) { ItemPricePointData.validate(val) })
142
+ ->(val) { ItemPricePointData.validate(val) },
143
+ is_model_hash: true)
140
144
  )
141
145
  end
142
146
  end
@@ -76,5 +76,15 @@ module AdvancedBilling
76
76
  name,
77
77
  hash)
78
78
  end
79
+
80
+ # Validates an instance of the object from a given value.
81
+ # @param [ItemPricePointData | Hash] The value against the validation is performed.
82
+ def self.validate(value)
83
+ return true if value.instance_of? self
84
+
85
+ return false unless value.instance_of? Hash
86
+
87
+ true
88
+ end
79
89
  end
80
90
  end
@@ -0,0 +1,74 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module AdvancedBilling
7
+ # ListComponentsFilter Model.
8
+ class ListComponentsFilter < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Allows fetching components with matching id based on provided value. Use
13
+ # in query `filter[ids]=1,2,3`.
14
+ # @return [Array[Integer]]
15
+ attr_accessor :ids
16
+
17
+ # Allows fetching components with matching use_site_exchange_rate based on
18
+ # provided value (refers to default price point). Use in query
19
+ # `filter[use_site_exchange_rate]=true`.
20
+ # @return [TrueClass | FalseClass]
21
+ attr_accessor :use_site_exchange_rate
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ @_hash = {} if @_hash.nil?
26
+ @_hash['ids'] = 'ids'
27
+ @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate'
28
+ @_hash
29
+ end
30
+
31
+ # An array for optional fields
32
+ def self.optionals
33
+ %w[
34
+ ids
35
+ use_site_exchange_rate
36
+ ]
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(ids = SKIP,
45
+ use_site_exchange_rate = SKIP,
46
+ additional_properties = {})
47
+ @ids = ids unless ids == SKIP
48
+ @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP
49
+
50
+ # Add additional model properties to the instance.
51
+ additional_properties.each do |_name, _value|
52
+ instance_variable_set("@#{_name}", _value)
53
+ end
54
+ end
55
+
56
+ # Creates an instance of the object from a hash.
57
+ def self.from_hash(hash)
58
+ return nil unless hash
59
+
60
+ # Extract variables from the hash.
61
+ ids = hash.key?('ids') ? hash['ids'] : SKIP
62
+ use_site_exchange_rate =
63
+ hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP
64
+
65
+ # Clean out expected properties from Hash.
66
+ names.each_value { |k| hash.delete(k) }
67
+
68
+ # Create object from extracted values.
69
+ ListComponentsFilter.new(ids,
70
+ use_site_exchange_rate,
71
+ hash)
72
+ end
73
+ end
74
+ end