maxio-advanced-billing-sdk 4.0.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +45 -45
  3. data/lib/advanced_billing/configuration.rb +2 -2
  4. data/lib/advanced_billing/controllers/advance_invoice_controller.rb +24 -24
  5. data/lib/advanced_billing/controllers/api_exports_controller.rb +57 -57
  6. data/lib/advanced_billing/controllers/base_controller.rb +10 -10
  7. data/lib/advanced_billing/controllers/billing_portal_controller.rb +33 -32
  8. data/lib/advanced_billing/controllers/component_price_points_controller.rb +60 -60
  9. data/lib/advanced_billing/controllers/components_controller.rb +110 -107
  10. data/lib/advanced_billing/controllers/coupons_controller.rb +89 -89
  11. data/lib/advanced_billing/controllers/custom_fields_controller.rb +76 -76
  12. data/lib/advanced_billing/controllers/customers_controller.rb +45 -41
  13. data/lib/advanced_billing/controllers/events_based_billing_segments_controller.rb +53 -53
  14. data/lib/advanced_billing/controllers/events_controller.rb +16 -15
  15. data/lib/advanced_billing/controllers/insights_controller.rb +17 -17
  16. data/lib/advanced_billing/controllers/invoices_controller.rb +99 -99
  17. data/lib/advanced_billing/controllers/offers_controller.rb +18 -15
  18. data/lib/advanced_billing/controllers/payment_profiles_controller.rb +107 -104
  19. data/lib/advanced_billing/controllers/product_families_controller.rb +26 -26
  20. data/lib/advanced_billing/controllers/product_price_points_controller.rb +62 -62
  21. data/lib/advanced_billing/controllers/products_controller.rb +37 -37
  22. data/lib/advanced_billing/controllers/proforma_invoices_controller.rb +61 -61
  23. data/lib/advanced_billing/controllers/reason_codes_controller.rb +35 -35
  24. data/lib/advanced_billing/controllers/referral_codes_controller.rb +9 -8
  25. data/lib/advanced_billing/controllers/sales_commissions_controller.rb +13 -13
  26. data/lib/advanced_billing/controllers/sites_controller.rb +11 -10
  27. data/lib/advanced_billing/controllers/subscription_components_controller.rb +170 -161
  28. data/lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb +23 -23
  29. data/lib/advanced_billing/controllers/subscription_group_status_controller.rb +21 -21
  30. data/lib/advanced_billing/controllers/subscription_groups_controller.rb +54 -54
  31. data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +37 -37
  32. data/lib/advanced_billing/controllers/subscription_notes_controller.rb +20 -16
  33. data/lib/advanced_billing/controllers/subscription_products_controller.rb +20 -18
  34. data/lib/advanced_billing/controllers/subscription_status_controller.rb +74 -74
  35. data/lib/advanced_billing/controllers/subscriptions_controller.rb +163 -160
  36. data/lib/advanced_billing/controllers/webhooks_controller.rb +45 -44
  37. data/lib/advanced_billing/exceptions/component_allocation_error_exception.rb +15 -15
  38. data/lib/advanced_billing/exceptions/component_price_point_error_exception.rb +15 -15
  39. data/lib/advanced_billing/exceptions/customer_error_response_exception.rb +15 -15
  40. data/lib/advanced_billing/exceptions/error_array_map_response_exception.rb +15 -15
  41. data/lib/advanced_billing/exceptions/error_list_response_exception.rb +15 -15
  42. data/lib/advanced_billing/exceptions/error_string_map_response_exception.rb +15 -15
  43. data/lib/advanced_billing/exceptions/event_based_billing_list_segments_errors_exception.rb +15 -15
  44. data/lib/advanced_billing/exceptions/event_based_billing_segment_errors_exception.rb +15 -15
  45. data/lib/advanced_billing/exceptions/event_based_billing_segment_exception.rb +15 -15
  46. data/lib/advanced_billing/exceptions/product_price_point_error_response_exception.rb +15 -15
  47. data/lib/advanced_billing/exceptions/proforma_bad_request_error_response_exception.rb +15 -15
  48. data/lib/advanced_billing/exceptions/refund_prepayment_base_errors_response_exception.rb +15 -15
  49. data/lib/advanced_billing/exceptions/single_error_response_exception.rb +15 -15
  50. data/lib/advanced_billing/exceptions/single_string_error_response_exception.rb +15 -15
  51. data/lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb +15 -15
  52. data/lib/advanced_billing/exceptions/subscription_component_allocation_error_exception.rb +15 -15
  53. data/lib/advanced_billing/exceptions/subscription_group_create_error_response_exception.rb +15 -15
  54. data/lib/advanced_billing/exceptions/subscription_group_signup_error_response_exception.rb +15 -15
  55. data/lib/advanced_billing/exceptions/subscription_group_update_error_response_exception.rb +15 -15
  56. data/lib/advanced_billing/exceptions/subscription_remove_coupon_errors_exception.rb +15 -15
  57. data/lib/advanced_billing/exceptions/subscriptions_mrr_error_response_exception.rb +15 -15
  58. data/lib/advanced_billing/exceptions/too_many_management_link_requests_error_exception.rb +15 -15
  59. data/lib/advanced_billing/models/activate_event_based_component.rb +84 -0
  60. data/lib/advanced_billing/models/{current_vault.rb → all_vaults.rb} +28 -7
  61. data/lib/advanced_billing/models/allocation.rb +1 -0
  62. data/lib/advanced_billing/models/allocation_preview_item.rb +1 -0
  63. data/lib/advanced_billing/models/apple_pay_payment_profile.rb +232 -0
  64. data/lib/advanced_billing/models/apple_pay_vault.rb +20 -0
  65. data/lib/advanced_billing/models/bank_account_attributes.rb +2 -0
  66. data/lib/advanced_billing/models/bank_account_payment_profile.rb +25 -20
  67. data/lib/advanced_billing/models/bank_account_vault.rb +19 -9
  68. data/lib/advanced_billing/models/change_invoice_status_event_data.rb +6 -6
  69. data/lib/advanced_billing/models/component.rb +1 -0
  70. data/lib/advanced_billing/models/component_custom_price.rb +33 -14
  71. data/lib/advanced_billing/models/component_price_point_item.rb +3 -1
  72. data/lib/advanced_billing/models/create_component_price_point.rb +3 -1
  73. data/lib/advanced_billing/models/create_customer.rb +11 -1
  74. data/lib/advanced_billing/models/create_metafield.rb +2 -1
  75. data/lib/advanced_billing/models/create_or_update_product.rb +7 -4
  76. data/lib/advanced_billing/models/create_payment_profile.rb +1 -1
  77. data/lib/advanced_billing/models/create_prepaid_usage_component_price_point.rb +6 -5
  78. data/lib/advanced_billing/models/create_product_price_point.rb +5 -3
  79. data/lib/advanced_billing/models/create_subscription.rb +27 -25
  80. data/lib/advanced_billing/models/credit_card_payment_profile.rb +17 -16
  81. data/lib/advanced_billing/models/credit_card_vault.rb +117 -0
  82. data/lib/advanced_billing/models/credit_note.rb +2 -2
  83. data/lib/advanced_billing/models/customer.rb +11 -1
  84. data/lib/advanced_billing/models/customer_attributes.rb +12 -1
  85. data/lib/advanced_billing/models/ebb_component.rb +1 -0
  86. data/lib/advanced_billing/models/{extended_interval_unit.rb → expiration_interval_unit.rb} +4 -4
  87. data/lib/advanced_billing/models/full_subscription_group_response.rb +65 -50
  88. data/lib/advanced_billing/models/get_one_time_token_payment_profile.rb +1 -1
  89. data/lib/advanced_billing/models/invoice.rb +19 -9
  90. data/lib/advanced_billing/models/invoice_consolidation_level.rb +2 -2
  91. data/lib/advanced_billing/models/invoice_refund.rb +13 -1
  92. data/lib/advanced_billing/models/invoice_status.rb +2 -2
  93. data/lib/advanced_billing/models/invoice_tax.rb +29 -0
  94. data/lib/advanced_billing/models/invoice_tax_component_breakout.rb +101 -1
  95. data/lib/advanced_billing/models/issue_invoice_event_data.rb +6 -6
  96. data/lib/advanced_billing/models/metered_component.rb +4 -3
  97. data/lib/advanced_billing/models/offer_item.rb +3 -1
  98. data/lib/advanced_billing/models/on_off_component.rb +3 -2
  99. data/lib/advanced_billing/models/paid_invoice.rb +2 -2
  100. data/lib/advanced_billing/models/pay_pal_vault.rb +29 -0
  101. data/lib/advanced_billing/models/payment_profile_attributes.rb +5 -5
  102. data/lib/advanced_billing/models/payment_profile_response.rb +3 -3
  103. data/lib/advanced_billing/models/payment_type.rb +4 -1
  104. data/lib/advanced_billing/models/paypal_payment_profile.rb +242 -0
  105. data/lib/advanced_billing/models/prepaid_usage_component.rb +5 -4
  106. data/lib/advanced_billing/models/product.rb +2 -2
  107. data/lib/advanced_billing/models/product_price_point.rb +2 -2
  108. data/lib/advanced_billing/models/proforma_invoice.rb +6 -6
  109. data/lib/advanced_billing/models/quantity_based_component.rb +4 -3
  110. data/lib/advanced_billing/models/refund_invoice_event_data.rb +4 -4
  111. data/lib/advanced_billing/models/resent_invitation.rb +36 -0
  112. data/lib/advanced_billing/models/subscription.rb +13 -10
  113. data/lib/advanced_billing/models/subscription_component.rb +1 -0
  114. data/lib/advanced_billing/models/subscription_component_subscription.rb +26 -20
  115. data/lib/advanced_billing/models/subscription_custom_price.rb +5 -2
  116. data/lib/advanced_billing/models/subscription_group_bank_account.rb +2 -0
  117. data/lib/advanced_billing/models/subscription_group_credit_card.rb +1 -1
  118. data/lib/advanced_billing/models/subscription_group_signup_response.rb +39 -30
  119. data/lib/advanced_billing/models/subscription_state.rb +30 -30
  120. data/lib/advanced_billing/models/tax_configuration.rb +1 -2
  121. data/lib/advanced_billing/models/update_component_price_point.rb +3 -1
  122. data/lib/advanced_billing/models/update_customer.rb +12 -1
  123. data/lib/advanced_billing/models/update_payment_profile.rb +1 -1
  124. data/lib/advanced_billing/utilities/file_wrapper.rb +9 -9
  125. data/lib/advanced_billing/utilities/union_type_lookup.rb +17 -3
  126. data/lib/advanced_billing.rb +10 -4
  127. metadata +16 -10
@@ -10,8 +10,9 @@ module AdvancedBilling
10
10
  # a subscription.
11
11
  # @param [Integer] subscription_id Required parameter: The Chargify id of
12
12
  # the subscription
13
- # @param [Integer] component_id Required parameter: The Chargify id of the
14
- # component. Alternatively, the component's handle prefixed by `handle:`
13
+ # @param [Integer] component_id Required parameter: The Advanced Billing id
14
+ # of the component. Alternatively, the component's handle prefixed by
15
+ # `handle:`
15
16
  # @return [SubscriptionComponentResponse] response from the API call
16
17
  def read_subscription_component(subscription_id,
17
18
  component_id)
@@ -28,11 +29,11 @@ module AdvancedBilling
28
29
  .header_param(new_parameter('application/json', key: 'accept'))
29
30
  .auth(Single.new('BasicAuth')))
30
31
  .response(new_response_handler
31
- .deserializer(APIHelper.method(:custom_type_deserializer))
32
- .deserialize_into(SubscriptionComponentResponse.method(:from_hash))
33
- .local_error_template('404',
34
- 'Not Found:\'{$response.body}\'',
35
- APIException))
32
+ .deserializer(APIHelper.method(:custom_type_deserializer))
33
+ .deserialize_into(SubscriptionComponentResponse.method(:from_hash))
34
+ .local_error_template('404',
35
+ 'Not Found:\'{$response.body}\'',
36
+ APIException))
36
37
  .execute
37
38
  end
38
39
 
@@ -108,9 +109,9 @@ module AdvancedBilling
108
109
  .auth(Single.new('BasicAuth'))
109
110
  .array_serialization_format(ArraySerializationFormat::CSV))
110
111
  .response(new_response_handler
111
- .deserializer(APIHelper.method(:custom_type_deserializer))
112
- .deserialize_into(SubscriptionComponentResponse.method(:from_hash))
113
- .is_response_array(true))
112
+ .deserializer(APIHelper.method(:custom_type_deserializer))
113
+ .deserialize_into(SubscriptionComponentResponse.method(:from_hash))
114
+ .is_response_array(true))
114
115
  .execute
115
116
  end
116
117
 
@@ -140,12 +141,12 @@ module AdvancedBilling
140
141
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
141
142
  .auth(Single.new('BasicAuth')))
142
143
  .response(new_response_handler
143
- .deserializer(APIHelper.method(:custom_type_deserializer))
144
- .deserialize_into(BulkComponentsPricePointAssignment.method(:from_hash))
145
- .local_error_template('422',
146
- 'HTTP Response Not OK. Status code: {$statusCode}.'\
147
- ' Response: \'{$response.body}\'.',
148
- ComponentPricePointErrorException))
144
+ .deserializer(APIHelper.method(:custom_type_deserializer))
145
+ .deserialize_into(BulkComponentsPricePointAssignment.method(:from_hash))
146
+ .local_error_template('422',
147
+ 'HTTP Response Not OK. Status code: {$statusCode}.'\
148
+ ' Response: \'{$response.body}\'.',
149
+ ComponentPricePointErrorException))
149
150
  .execute
150
151
  end
151
152
 
@@ -166,8 +167,8 @@ module AdvancedBilling
166
167
  .header_param(new_parameter('application/json', key: 'accept'))
167
168
  .auth(Single.new('BasicAuth')))
168
169
  .response(new_response_handler
169
- .deserializer(APIHelper.method(:custom_type_deserializer))
170
- .deserialize_into(SubscriptionResponse.method(:from_hash)))
170
+ .deserializer(APIHelper.method(:custom_type_deserializer))
171
+ .deserialize_into(SubscriptionResponse.method(:from_hash)))
171
172
  .execute
172
173
  end
173
174
 
@@ -176,12 +177,12 @@ module AdvancedBilling
176
177
  # **Notice**: Allocations can only be updated for Quantity, On/Off, and
177
178
  # Prepaid Components.
178
179
  # ## Allocations Documentation
179
- # Full documentation on how to record Allocations in the Chargify UI can be
180
- # located
181
- # [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404527849997)
182
- # . It is focused on how allocations operate within the Chargify UI.It goes
183
- # into greater detail on how the user interface will react when recording
184
- # allocations.
180
+ # Full documentation on how to record Allocations in the Advanced Billing UI
181
+ # can be located
182
+ # [here](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Componen
183
+ # t-Allocations-Overview). It is focused on how allocations operate within
184
+ # the Advanced Billing UI.It goes into greater detail on how the user
185
+ # interface will react when recording allocations.
185
186
  # This documentation also goes into greater detail on how proration is taken
186
187
  # into consideration when applying component allocations.
187
188
  # ## Proration Schemes
@@ -194,8 +195,8 @@ module AdvancedBilling
194
195
  # without proration.
195
196
  # For background information on prorated components and upgrade/downgrade
196
197
  # schemes, see [Setting Component
197
- # Allocations.](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404527
198
- # 849997#proration-upgrades-vs-downgrades).
198
+ # Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-C
199
+ # omponent-Allocations-Proration).
199
200
  # See the tables below for valid values.
200
201
  # | upgrade_charge | Definition
201
202
  #            |
@@ -224,24 +225,24 @@ module AdvancedBilling
224
225
  # 1. Per allocation in API call (within a single allocation of the
225
226
  # `allocations` array)
226
227
  # 2. [Component-level default
227
- # value](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404527849997-
228
- # Component-Allocations#component-allocations-0-0)
228
+ # value](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Componen
229
+ # t-Allocations-Overview)
229
230
  # 3. Allocation API call top level (outside of the `allocations` array)
230
231
  # 4. [Site-level default
231
- # value](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404527849997#
232
- # proration-schemes)
232
+ # value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Componen
233
+ # t-Allocations-Proration#proration-schemes)
233
234
  # ### Order of Resolution for accrue charge
234
235
  # 1. Allocation API call top level (outside of the `allocations` array)
235
236
  # 2. [Site-level default
236
- # value](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404527849997#
237
- # proration-schemes)
237
+ # value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Componen
238
+ # t-Allocations-Proration#proration-schemes)
238
239
  # **NOTE: Proration uses the current price of the component as well as the
239
240
  # current tax rates. Changes to either may cause the prorated charge/credit
240
241
  # to be wrong.**
241
242
  # @param [Integer] subscription_id Required parameter: The Chargify id of
242
243
  # the subscription
243
- # @param [Integer] component_id Required parameter: The Chargify id of the
244
- # component
244
+ # @param [Integer] component_id Required parameter: The Advanced Billing id
245
+ # of the component
245
246
  # @param [CreateAllocationRequest] body Optional parameter: Example:
246
247
  # @return [AllocationResponse] response from the API call
247
248
  def allocate_component(subscription_id,
@@ -263,12 +264,12 @@ module AdvancedBilling
263
264
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
264
265
  .auth(Single.new('BasicAuth')))
265
266
  .response(new_response_handler
266
- .deserializer(APIHelper.method(:custom_type_deserializer))
267
- .deserialize_into(AllocationResponse.method(:from_hash))
268
- .local_error_template('422',
269
- 'HTTP Response Not OK. Status code: {$statusCode}.'\
270
- ' Response: \'{$response.body}\'.',
271
- ErrorListResponseException))
267
+ .deserializer(APIHelper.method(:custom_type_deserializer))
268
+ .deserialize_into(AllocationResponse.method(:from_hash))
269
+ .local_error_template('422',
270
+ 'HTTP Response Not OK. Status code: {$statusCode}.'\
271
+ ' Response: \'{$response.body}\'.',
272
+ ErrorListResponseException))
272
273
  .execute
273
274
  end
274
275
 
@@ -277,8 +278,8 @@ module AdvancedBilling
277
278
  # ## On/Off Components
278
279
  # When a subscription's on/off component has been toggled to on (`1`) or off
279
280
  # (`0`), usage will be logged in this response.
280
- # ## Querying data via Chargify gem
281
- # You can also query the current quantity via the [official Chargify
281
+ # ## Querying data via Advanced Billing gem
282
+ # You can also query the current quantity via the [official Advanced Billing
282
283
  # Gem.](http://github.com/chargify/chargify_api_ares)
283
284
  # ```# First way
284
285
  # component = Chargify::Subscription::Component.find(1, :params =>
@@ -292,8 +293,8 @@ module AdvancedBilling
292
293
  # ```
293
294
  # @param [Integer] subscription_id Required parameter: The Chargify id of
294
295
  # the subscription
295
- # @param [Integer] component_id Required parameter: The Chargify id of the
296
- # component
296
+ # @param [Integer] component_id Required parameter: The Advanced Billing id
297
+ # of the component
297
298
  # @param [Integer] page Optional parameter: Result records are organized in
298
299
  # pages. By default, the first page of results is displayed. The page
299
300
  # parameter specifies a page number of results to fetch. You can start
@@ -319,16 +320,16 @@ module AdvancedBilling
319
320
  .header_param(new_parameter('application/json', key: 'accept'))
320
321
  .auth(Single.new('BasicAuth')))
321
322
  .response(new_response_handler
322
- .deserializer(APIHelper.method(:custom_type_deserializer))
323
- .deserialize_into(AllocationResponse.method(:from_hash))
324
- .is_response_array(true)
325
- .local_error_template('404',
326
- 'Not Found:\'{$response.body}\'',
327
- APIException)
328
- .local_error_template('422',
329
- 'HTTP Response Not OK. Status code: {$statusCode}.'\
330
- ' Response: \'{$response.body}\'.',
331
- ErrorListResponseException))
323
+ .deserializer(APIHelper.method(:custom_type_deserializer))
324
+ .deserialize_into(AllocationResponse.method(:from_hash))
325
+ .is_response_array(true)
326
+ .local_error_template('404',
327
+ 'Not Found:\'{$response.body}\'',
328
+ APIException)
329
+ .local_error_template('422',
330
+ 'HTTP Response Not OK. Status code: {$statusCode}.'\
331
+ ' Response: \'{$response.body}\'.',
332
+ ErrorListResponseException))
332
333
  .execute
333
334
  end
334
335
 
@@ -358,20 +359,20 @@ module AdvancedBilling
358
359
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
359
360
  .auth(Single.new('BasicAuth')))
360
361
  .response(new_response_handler
361
- .deserializer(APIHelper.method(:custom_type_deserializer))
362
- .deserialize_into(AllocationResponse.method(:from_hash))
363
- .is_response_array(true)
364
- .local_error_template('404',
365
- 'Not Found:\'{$response.body}\'',
366
- APIException)
367
- .local_error_template('422',
368
- 'HTTP Response Not OK. Status code: {$statusCode}.'\
369
- ' Response: \'{$response.body}\'.',
370
- ErrorListResponseException))
362
+ .deserializer(APIHelper.method(:custom_type_deserializer))
363
+ .deserialize_into(AllocationResponse.method(:from_hash))
364
+ .is_response_array(true)
365
+ .local_error_template('404',
366
+ 'Not Found:\'{$response.body}\'',
367
+ APIException)
368
+ .local_error_template('422',
369
+ 'HTTP Response Not OK. Status code: {$statusCode}.'\
370
+ ' Response: \'{$response.body}\'.',
371
+ ErrorListResponseException))
371
372
  .execute
372
373
  end
373
374
 
374
- # Chargify offers the ability to preview a potential subscription's
375
+ # Advanced Billing offers the ability to preview a potential subscription's
375
376
  # **quantity-based** or **on/off** component allocation in the middle of the
376
377
  # current billing period. This is useful if you want users to be able to
377
378
  # see the effect of a component operation before actually doing it.
@@ -402,12 +403,12 @@ module AdvancedBilling
402
403
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
403
404
  .auth(Single.new('BasicAuth')))
404
405
  .response(new_response_handler
405
- .deserializer(APIHelper.method(:custom_type_deserializer))
406
- .deserialize_into(AllocationPreviewResponse.method(:from_hash))
407
- .local_error_template('422',
408
- 'HTTP Response Not OK. Status code: {$statusCode}.'\
409
- ' Response: \'{$response.body}\'.',
410
- ComponentAllocationErrorException))
406
+ .deserializer(APIHelper.method(:custom_type_deserializer))
407
+ .deserialize_into(AllocationPreviewResponse.method(:from_hash))
408
+ .local_error_template('422',
409
+ 'HTTP Response Not OK. Status code: {$statusCode}.'\
410
+ ' Response: \'{$response.body}\'.',
411
+ ComponentAllocationErrorException))
411
412
  .execute
412
413
  end
413
414
 
@@ -427,10 +428,10 @@ module AdvancedBilling
427
428
  # it) up to the subscription's current period beginning date.
428
429
  # @param [Integer] subscription_id Required parameter: The Chargify id of
429
430
  # the subscription
430
- # @param [Integer] component_id Required parameter: The Chargify id of the
431
- # component
432
- # @param [Integer] allocation_id Required parameter: The Chargify id of the
433
- # allocation
431
+ # @param [Integer] component_id Required parameter: The Advanced Billing id
432
+ # of the component
433
+ # @param [Integer] allocation_id Required parameter: The Advanced Billing id
434
+ # of the allocation
434
435
  # @param [UpdateAllocationExpirationDate] body Optional parameter:
435
436
  # Example:
436
437
  # @return [void] response from the API call
@@ -456,14 +457,14 @@ module AdvancedBilling
456
457
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
457
458
  .auth(Single.new('BasicAuth')))
458
459
  .response(new_response_handler
459
- .is_response_void(true)
460
- .local_error_template('404',
461
- 'Not Found:\'{$response.body}\'',
462
- APIException)
463
- .local_error_template('422',
464
- 'HTTP Response Not OK. Status code: {$statusCode}.'\
465
- ' Response: \'{$response.body}\'.',
466
- SubscriptionComponentAllocationErrorException))
460
+ .is_response_void(true)
461
+ .local_error_template('404',
462
+ 'Not Found:\'{$response.body}\'',
463
+ APIException)
464
+ .local_error_template('422',
465
+ 'HTTP Response Not OK. Status code: {$statusCode}.'\
466
+ ' Response: \'{$response.body}\'.',
467
+ SubscriptionComponentAllocationErrorException))
467
468
  .execute
468
469
  end
469
470
 
@@ -484,10 +485,10 @@ module AdvancedBilling
484
485
  # updated and a refund will be issued along with a Credit Note.
485
486
  # @param [Integer] subscription_id Required parameter: The Chargify id of
486
487
  # the subscription
487
- # @param [Integer] component_id Required parameter: The Chargify id of the
488
- # component
489
- # @param [Integer] allocation_id Required parameter: The Chargify id of the
490
- # allocation
488
+ # @param [Integer] component_id Required parameter: The Advanced Billing id
489
+ # of the component
490
+ # @param [Integer] allocation_id Required parameter: The Advanced Billing id
491
+ # of the allocation
491
492
  # @param [CreditSchemeRequest] body Optional parameter: Example:
492
493
  # @return [void] response from the API call
493
494
  def delete_prepaid_usage_allocation(subscription_id,
@@ -512,39 +513,39 @@ module AdvancedBilling
512
513
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
513
514
  .auth(Single.new('BasicAuth')))
514
515
  .response(new_response_handler
515
- .is_response_void(true)
516
- .local_error_template('404',
517
- 'Not Found:\'{$response.body}\'',
518
- APIException)
519
- .local_error_template('422',
520
- 'HTTP Response Not OK. Status code: {$statusCode}.'\
521
- ' Response: \'{$response.body}\'.',
522
- SubscriptionComponentAllocationErrorException))
516
+ .is_response_void(true)
517
+ .local_error_template('404',
518
+ 'Not Found:\'{$response.body}\'',
519
+ APIException)
520
+ .local_error_template('422',
521
+ 'HTTP Response Not OK. Status code: {$statusCode}.'\
522
+ ' Response: \'{$response.body}\'.',
523
+ SubscriptionComponentAllocationErrorException))
523
524
  .execute
524
525
  end
525
526
 
526
527
  # ## Documentation
527
- # Full documentation on how to create Components in the Chargify UI can be
528
- # located
529
- # [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677#
530
- # creating-components). Additionally, for information on how to record
531
- # component usage against a subscription, please see the following
528
+ # Full documentation on how to create Components in the Advanced Billing UI
529
+ # can be located
530
+ # [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-E
531
+ # dit-and-Archive-Components). Additionally, for information on how to
532
+ # record component usage against a subscription, please see the following
532
533
  # resources:
533
534
  # + [Recording Metered Component
534
- # Usage](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404527849997#
535
- # reporting-metered-component-usage)
535
+ # Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reportin
536
+ # g-Component-Allocations#reporting-metered-component-usage)
536
537
  # + [Reporting Prepaid Component
537
- # Status](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404527849997
538
- # #reporting-prepaid-component-status)
539
- # You may choose to report metered or prepaid usage to Chargify as often as
540
- # you wish. You may report usage as it happens. You may also report usage
541
- # periodically, such as each night or once per billing period. If usage
542
- # events occur in your system very frequently (on the order of thousands of
543
- # times an hour), it is best to accumulate usage into batches on your side,
544
- # and then report those batches less frequently, such as daily. This will
545
- # ensure you remain below any API throttling limits. If your use case
546
- # requires higher rates of usage reporting, we recommend utilizing Events
547
- # Based Components.
538
+ # Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporti
539
+ # ng-Component-Allocations#reporting-prepaid-component-status)
540
+ # You may choose to report metered or prepaid usage to Advanced Billing as
541
+ # often as you wish. You may report usage as it happens. You may also report
542
+ # usage periodically, such as each night or once per billing period. If
543
+ # usage events occur in your system very frequently (on the order of
544
+ # thousands of times an hour), it is best to accumulate usage into batches
545
+ # on your side, and then report those batches less frequently, such as
546
+ # daily. This will ensure you remain below any API throttling limits. If
547
+ # your use case requires higher rates of usage reporting, we recommend
548
+ # utilizing Events Based Components.
548
549
  # ## Create Usage for Subscription
549
550
  # This endpoint allows you to record an instance of metered or prepaid usage
550
551
  # for a subscription. The `quantity` from usage for each component is
@@ -552,7 +553,8 @@ module AdvancedBilling
552
553
  # Item](./b3A6MTQxMDgzNzQ-read-subscription-component) for the subscription.
553
554
  # ## Price Point ID usage
554
555
  # If you are using price points, for metered and prepaid usage components,
555
- # Chargify gives you the option to specify a price point in your request.
556
+ # Advanced Billing gives you the option to specify a price point in your
557
+ # request.
556
558
  # You do not need to specify a price point ID. If a price point is not
557
559
  # included, the default price point for the component will be used when the
558
560
  # usage is recorded.
@@ -594,8 +596,8 @@ module AdvancedBilling
594
596
  # @param [Integer] subscription_id Required parameter: The Chargify id of
595
597
  # the subscription
596
598
  # @param [Integer | String] component_id Required parameter: Either the
597
- # Chargify id for the component or the component's handle prefixed by
598
- # `handle:`
599
+ # Advanced Billing id for the component or the component's handle prefixed
600
+ # by `handle:`
599
601
  # @param [CreateUsageRequest] body Optional parameter: Example:
600
602
  # @return [UsageResponse] response from the API call
601
603
  def create_usage(subscription_id,
@@ -621,12 +623,12 @@ module AdvancedBilling
621
623
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
622
624
  .auth(Single.new('BasicAuth')))
623
625
  .response(new_response_handler
624
- .deserializer(APIHelper.method(:custom_type_deserializer))
625
- .deserialize_into(UsageResponse.method(:from_hash))
626
- .local_error_template('422',
627
- 'HTTP Response Not OK. Status code: {$statusCode}.'\
628
- ' Response: \'{$response.body}\'.',
629
- ErrorListResponseException))
626
+ .deserializer(APIHelper.method(:custom_type_deserializer))
627
+ .deserialize_into(UsageResponse.method(:from_hash))
628
+ .local_error_template('422',
629
+ 'HTTP Response Not OK. Status code: {$statusCode}.'\
630
+ ' Response: \'{$response.body}\'.',
631
+ ErrorListResponseException))
630
632
  .execute
631
633
  end
632
634
 
@@ -649,8 +651,8 @@ module AdvancedBilling
649
651
  # @param [Integer] subscription_id Required parameter: The Chargify id of
650
652
  # the subscription
651
653
  # @param [Integer | String] component_id Required parameter: Either the
652
- # Chargify id for the component or the component's handle prefixed by
653
- # `handle:`
654
+ # Advanced Billing id for the component or the component's handle prefixed
655
+ # by `handle:`
654
656
  # @param [Integer] since_id Optional parameter: Returns usages with an id
655
657
  # greater than or equal to the one specified
656
658
  # @param [Integer] max_id Optional parameter: Returns usages with an id less
@@ -697,9 +699,9 @@ module AdvancedBilling
697
699
  .header_param(new_parameter('application/json', key: 'accept'))
698
700
  .auth(Single.new('BasicAuth')))
699
701
  .response(new_response_handler
700
- .deserializer(APIHelper.method(:custom_type_deserializer))
701
- .deserialize_into(UsageResponse.method(:from_hash))
702
- .is_response_array(true))
702
+ .deserializer(APIHelper.method(:custom_type_deserializer))
703
+ .deserialize_into(UsageResponse.method(:from_hash))
704
+ .is_response_array(true))
703
705
  .execute
704
706
  end
705
707
 
@@ -707,22 +709,24 @@ module AdvancedBilling
707
709
  # Events-Based Billing feature, the components must be activated for the
708
710
  # subscriber.
709
711
  # Learn more about the role of activation in the [Events-Based Billing
710
- # docs](https://chargify.zendesk.com/hc/en-us/articles/4407720810907#activat
711
- # ing-components-for-subscribers).
712
+ # docs](https://maxio.zendesk.com/hc/en-us/articles/24260323329805-Events-Ba
713
+ # sed-Billing-Overview).
712
714
  # Use this endpoint to activate an event-based component for a single
713
- # subscription. Activating an event-based component causes Chargify to bill
714
- # for events when the subscription is renewed.
715
+ # subscription. Activating an event-based component causes Advanced Billing
716
+ # to bill for events when the subscription is renewed.
715
717
  # *Note: it is possible to stream events for a subscription at any time,
716
718
  # regardless of component activation status. The activation status only
717
719
  # determines if the subscription should be billed for event-based component
718
720
  # usage at renewal.*
719
- # @param [Integer] subscription_id Required parameter: The Chargify id of
720
- # the subscription
721
- # @param [Integer] component_id Required parameter: The Chargify id of the
722
- # component
721
+ # @param [Integer] subscription_id Required parameter: The Advanced Billing
722
+ # id of the subscription
723
+ # @param [Integer] component_id Required parameter: The Advanced Billing id
724
+ # of the component
725
+ # @param [ActivateEventBasedComponent] body Optional parameter: Example:
723
726
  # @return [void] response from the API call
724
727
  def activate_event_based_component(subscription_id,
725
- component_id)
728
+ component_id,
729
+ body: nil)
726
730
  new_api_call_builder
727
731
  .request(new_request_builder(HttpMethodEnum::POST,
728
732
  '/event_based_billing/subscriptions/{subscription_id}/components/{component_id}/activate.json',
@@ -733,19 +737,22 @@ module AdvancedBilling
733
737
  .template_param(new_parameter(component_id, key: 'component_id')
734
738
  .is_required(true)
735
739
  .should_encode(true))
740
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
741
+ .body_param(new_parameter(body))
742
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
736
743
  .auth(Single.new('BasicAuth')))
737
744
  .response(new_response_handler
738
- .is_response_void(true))
745
+ .is_response_void(true))
739
746
  .execute
740
747
  end
741
748
 
742
749
  # Use this endpoint to deactivate an event-based component for a single
743
- # subscription. Deactivating the event-based component causes Chargify to
744
- # ignore related events at subscription renewal.
745
- # @param [Integer] subscription_id Required parameter: The Chargify id of
746
- # the subscription
747
- # @param [Integer] component_id Required parameter: The Chargify id of the
748
- # component
750
+ # subscription. Deactivating the event-based component causes Advanced
751
+ # Billing to ignore related events at subscription renewal.
752
+ # @param [Integer] subscription_id Required parameter: The Advanced Billing
753
+ # id of the subscription
754
+ # @param [Integer] component_id Required parameter: The Advanced Billing id
755
+ # of the component
749
756
  # @return [void] response from the API call
750
757
  def deactivate_event_based_component(subscription_id,
751
758
  component_id)
@@ -761,23 +768,25 @@ module AdvancedBilling
761
768
  .should_encode(true))
762
769
  .auth(Single.new('BasicAuth')))
763
770
  .response(new_response_handler
764
- .is_response_void(true))
771
+ .is_response_void(true))
765
772
  .execute
766
773
  end
767
774
 
768
775
  # ## Documentation
769
776
  # Events-Based Billing is an evolved form of metered billing that is based
770
- # on data-rich events streamed in real-time from your system to Chargify.
777
+ # on data-rich events streamed in real-time from your system to Advanced
778
+ # Billing.
771
779
  # These events can then be transformed, enriched, or analyzed to form the
772
780
  # computed totals of usage charges billed to your customers.
773
- # This API allows you to stream events into the Chargify data ingestion
774
- # engine.
781
+ # This API allows you to stream events into the Advanced Billing data
782
+ # ingestion engine.
775
783
  # Learn more about the feature in general in the [Events-Based Billing help
776
- # docs](https://chargify.zendesk.com/hc/en-us/articles/4407720613403).
784
+ # docs](https://maxio.zendesk.com/hc/en-us/articles/24260323329805-Events-Ba
785
+ # sed-Billing-Overview).
777
786
  # ## Record Event
778
787
  # Use this endpoint to record a single event.
779
- # *Note: this endpoint differs from the standard Chargify endpoints in that
780
- # the URL subdomain will be `events` and your site subdomain will be
788
+ # *Note: this endpoint differs from the standard Chargify API endpoints in
789
+ # that the URL subdomain will be `events` and your site subdomain will be
781
790
  # included in the URL path. For example:*
782
791
  # ```
783
792
  # https://events.chargify.com/my-site-subdomain/events/my-stream-api-handle
@@ -786,8 +795,8 @@ module AdvancedBilling
786
795
  # @param [String] api_handle Required parameter: Identifies the Stream for
787
796
  # which the event should be published.
788
797
  # @param [String] store_uid Optional parameter: If you've attached your own
789
- # Keen project as a Chargify event data-store, use this parameter to
790
- # indicate the data-store.
798
+ # Keen project as an Advanced Billing event data-store, use this parameter
799
+ # to indicate the data-store.
791
800
  # @param [EBBEvent] body Optional parameter: Example:
792
801
  # @return [void] response from the API call
793
802
  def record_event(subdomain,
@@ -810,22 +819,22 @@ module AdvancedBilling
810
819
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
811
820
  .auth(Single.new('BasicAuth')))
812
821
  .response(new_response_handler
813
- .is_response_void(true))
822
+ .is_response_void(true))
814
823
  .execute
815
824
  end
816
825
 
817
826
  # Use this endpoint to record a collection of events.
818
- # *Note: this endpoint differs from the standard Chargify endpoints in that
819
- # the subdomain will be `events` and your site subdomain will be included in
820
- # the URL path.*
827
+ # *Note: this endpoint differs from the standard Chargify API endpoints in
828
+ # that the subdomain will be `events` and your site subdomain will be
829
+ # included in the URL path.*
821
830
  # A maximum of 1000 events can be published in a single request. A 422 will
822
831
  # be returned if this limit is exceeded.
823
832
  # @param [String] subdomain Required parameter: Your site's subdomain
824
833
  # @param [String] api_handle Required parameter: Identifies the Stream for
825
834
  # which the events should be published.
826
835
  # @param [String] store_uid Optional parameter: If you've attached your own
827
- # Keen project as a Chargify event data-store, use this parameter to
828
- # indicate the data-store.
836
+ # Keen project as an Advanced Billing event data-store, use this parameter
837
+ # to indicate the data-store.
829
838
  # @param [Array[EBBEvent]] body Optional parameter: Example:
830
839
  # @return [void] response from the API call
831
840
  def bulk_record_events(subdomain,
@@ -848,7 +857,7 @@ module AdvancedBilling
848
857
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
849
858
  .auth(Single.new('BasicAuth')))
850
859
  .response(new_response_handler
851
- .is_response_void(true))
860
+ .is_response_void(true))
852
861
  .execute
853
862
  end
854
863
 
@@ -930,8 +939,8 @@ module AdvancedBilling
930
939
  .auth(Single.new('BasicAuth'))
931
940
  .array_serialization_format(ArraySerializationFormat::CSV))
932
941
  .response(new_response_handler
933
- .deserializer(APIHelper.method(:custom_type_deserializer))
934
- .deserialize_into(ListSubscriptionComponentsResponse.method(:from_hash)))
942
+ .deserializer(APIHelper.method(:custom_type_deserializer))
943
+ .deserialize_into(ListSubscriptionComponentsResponse.method(:from_hash)))
935
944
  .execute
936
945
  end
937
946
  end