recurly 3.9.0 → 3.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.bumpversion.cfg +1 -2
  3. data/CHANGELOG.md +65 -2
  4. data/CODE_OF_CONDUCT.md +130 -0
  5. data/CONTRIBUTING.md +4 -0
  6. data/GETTING_STARTED.md +1 -1
  7. data/README.md +3 -0
  8. data/lib/recurly/client.rb +7 -2
  9. data/lib/recurly/client/operations.rb +436 -56
  10. data/lib/recurly/errors/api_errors.rb +59 -17
  11. data/lib/recurly/requests/add_on_create.rb +29 -1
  12. data/lib/recurly/requests/add_on_update.rb +20 -0
  13. data/lib/recurly/requests/coupon_create.rb +1 -1
  14. data/lib/recurly/requests/item_create.rb +8 -0
  15. data/lib/recurly/requests/item_update.rb +8 -0
  16. data/lib/recurly/requests/line_item_create.rb +9 -1
  17. data/lib/recurly/requests/measured_unit_create.rb +22 -0
  18. data/lib/recurly/requests/measured_unit_update.rb +22 -0
  19. data/lib/recurly/requests/plan_create.rb +8 -0
  20. data/lib/recurly/requests/plan_update.rb +8 -0
  21. data/lib/recurly/requests/shipping_purchase.rb +1 -1
  22. data/lib/recurly/requests/subscription_add_on_create.rb +5 -1
  23. data/lib/recurly/requests/subscription_add_on_update.rb +4 -0
  24. data/lib/recurly/requests/subscription_change_create.rb +5 -1
  25. data/lib/recurly/requests/subscription_purchase.rb +4 -0
  26. data/lib/recurly/requests/usage_create.rb +26 -0
  27. data/lib/recurly/resources/add_on.rb +24 -0
  28. data/lib/recurly/resources/add_on_mini.rb +16 -0
  29. data/lib/recurly/resources/coupon.rb +9 -1
  30. data/lib/recurly/resources/export_dates.rb +18 -0
  31. data/lib/recurly/resources/export_file.rb +22 -0
  32. data/lib/recurly/resources/export_files.rb +18 -0
  33. data/lib/recurly/resources/item.rb +8 -0
  34. data/lib/recurly/resources/line_item.rb +8 -0
  35. data/lib/recurly/resources/measured_unit.rb +46 -0
  36. data/lib/recurly/resources/plan.rb +8 -0
  37. data/lib/recurly/resources/subscription_add_on.rb +5 -1
  38. data/lib/recurly/resources/subscription_change.rb +8 -0
  39. data/lib/recurly/resources/subscription_change_preview.rb +5 -1
  40. data/lib/recurly/resources/unique_coupon_code.rb +8 -0
  41. data/lib/recurly/resources/usage.rb +70 -0
  42. data/lib/recurly/version.rb +1 -1
  43. data/openapi/api.yaml +1559 -106
  44. metadata +15 -6
@@ -4,38 +4,80 @@
4
4
  # need and we will usher them to the appropriate places.
5
5
  module Recurly
6
6
  module Errors
7
- class BadRequestError < Errors::APIError; end
7
+ ERROR_MAP = {
8
+ "500" => "InternalServerError",
9
+ "502" => "BadGatewayError",
10
+ "503" => "ServiceUnavailableError",
11
+ "304" => "NotModifiedError",
12
+ "400" => "BadRequestError",
13
+ "401" => "UnauthorizedError",
14
+ "402" => "PaymentRequiredError",
15
+ "403" => "ForbiddenError",
16
+ "404" => "NotFoundError",
17
+ "406" => "NotAcceptableError",
18
+ "412" => "PreconditionFailedError",
19
+ "422" => "UnprocessableEntityError",
20
+ "429" => "TooManyRequestsError",
21
+ }
8
22
 
9
- class InternalServerError < Errors::APIError; end
23
+ class ResponseError < Errors::APIError; end
10
24
 
11
- class ImmutableSubscriptionError < Errors::APIError; end
25
+ class ServerError < ResponseError; end
12
26
 
13
- class InvalidApiKeyError < Errors::APIError; end
27
+ class InternalServerError < ServerError; end
14
28
 
15
- class InvalidApiVersionError < Errors::APIError; end
29
+ class BadGatewayError < ServerError; end
16
30
 
17
- class InvalidContentTypeError < Errors::APIError; end
31
+ class ServiceUnavailableError < ServerError; end
18
32
 
19
- class InvalidPermissionsError < Errors::APIError; end
33
+ class RedirectionError < ResponseError; end
20
34
 
21
- class InvalidTokenError < Errors::APIError; end
35
+ class NotModifiedError < ResponseError; end
22
36
 
23
- class NotFoundError < Errors::APIError; end
37
+ class ClientError < Errors::APIError; end
24
38
 
25
- class SimultaneousRequestError < Errors::APIError; end
39
+ class BadRequestError < ClientError; end
26
40
 
27
- class TransactionError < Errors::APIError; end
41
+ class InvalidContentTypeError < BadRequestError; end
28
42
 
29
- class UnauthorizedError < Errors::APIError; end
43
+ class UnauthorizedError < ClientError; end
30
44
 
31
- class UnavailableInApiVersionError < Errors::APIError; end
45
+ class PaymentRequiredError < ClientError; end
32
46
 
33
- class UnknownApiVersionError < Errors::APIError; end
47
+ class ForbiddenError < ClientError; end
34
48
 
35
- class ValidationError < Errors::APIError; end
49
+ class InvalidApiKeyError < ForbiddenError; end
36
50
 
37
- class MissingFeatureError < Errors::APIError; end
51
+ class InvalidPermissionsError < ForbiddenError; end
38
52
 
39
- class RateLimitedError < Errors::APIError; end
53
+ class NotFoundError < ClientError; end
54
+
55
+ class NotAcceptableError < ClientError; end
56
+
57
+ class UnknownApiVersionError < NotAcceptableError; end
58
+
59
+ class UnavailableInApiVersionError < NotAcceptableError; end
60
+
61
+ class InvalidApiVersionError < NotAcceptableError; end
62
+
63
+ class PreconditionFailedError < ClientError; end
64
+
65
+ class UnprocessableEntityError < ClientError; end
66
+
67
+ class ValidationError < UnprocessableEntityError; end
68
+
69
+ class MissingFeatureError < UnprocessableEntityError; end
70
+
71
+ class TransactionError < UnprocessableEntityError; end
72
+
73
+ class SimultaneousRequestError < UnprocessableEntityError; end
74
+
75
+ class ImmutableSubscriptionError < UnprocessableEntityError; end
76
+
77
+ class InvalidTokenError < UnprocessableEntityError; end
78
+
79
+ class TooManyRequestsError < ClientError; end
80
+
81
+ class RateLimitedError < TooManyRequestsError; end
40
82
  end
41
83
  end
@@ -10,6 +10,18 @@ module Recurly
10
10
  # @return [String] Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent.
11
11
  define_attribute :accounting_code, String
12
12
 
13
+ # @!attribute add_on_type
14
+ # @return [String] Whether the add-on type is fixed, or usage-based.
15
+ define_attribute :add_on_type, String
16
+
17
+ # @!attribute avalara_service_type
18
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_service_type` must be absent.
19
+ define_attribute :avalara_service_type, Integer
20
+
21
+ # @!attribute avalara_transaction_type
22
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_transaction_type` must be absent.
23
+ define_attribute :avalara_transaction_type, Integer
24
+
13
25
  # @!attribute code
14
26
  # @return [String] The unique identifier for the add-on within its plan. If `item_code`/`item_id` is part of the request then `code` must be absent. If `item_code`/`item_id` is not present `code` is required.
15
27
  define_attribute :code, String
@@ -34,6 +46,14 @@ module Recurly
34
46
  # @return [String] System-generated unique identifier for an item. Available when the `Credit Invoices` and `Subscription Billing Terms` features are enabled. If `item_id` and `item_code` are both present, `item_id` will be used.
35
47
  define_attribute :item_id, String
36
48
 
49
+ # @!attribute measured_unit_id
50
+ # @return [String] System-generated unique identifier for a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used.
51
+ define_attribute :measured_unit_id, String
52
+
53
+ # @!attribute measured_unit_name
54
+ # @return [String] Name of a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used.
55
+ define_attribute :measured_unit_name, String
56
+
37
57
  # @!attribute name
38
58
  # @return [String] Describes your add-on and will appear in subscribers' invoices. If `item_code`/`item_id` is part of the request then `name` must be absent. If `item_code`/`item_id` is not present `name` is required.
39
59
  define_attribute :name, String
@@ -55,12 +75,20 @@ module Recurly
55
75
  define_attribute :tax_code, String
56
76
 
57
77
  # @!attribute tier_type
58
- # @return [String] The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based).
78
+ # @return [String] The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based). See our [Guide](https://developers.recurly.com/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models.
59
79
  define_attribute :tier_type, String
60
80
 
61
81
  # @!attribute tiers
62
82
  # @return [Array[Tier]] If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier with an `ending_quantity` of 999999999 which is the default if not provided.
63
83
  define_attribute :tiers, Array, { :item_type => :Tier }
84
+
85
+ # @!attribute usage_percentage
86
+ # @return [Float] The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage and `usage_type` is percentage. Must be omitted otherwise. `usage_percentage` does not support tiers.
87
+ define_attribute :usage_percentage, Float
88
+
89
+ # @!attribute usage_type
90
+ # @return [String] Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://developers.recurly.com/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons.
91
+ define_attribute :usage_type, String
64
92
  end
65
93
  end
66
94
  end
@@ -10,6 +10,14 @@ module Recurly
10
10
  # @return [String] Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If an `Item` is associated to the `AddOn` then `accounting code` must be absent.
11
11
  define_attribute :accounting_code, String
12
12
 
13
+ # @!attribute avalara_service_type
14
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_service_type` must be absent.
15
+ define_attribute :avalara_service_type, Integer
16
+
17
+ # @!attribute avalara_transaction_type
18
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_transaction_type` must be absent.
19
+ define_attribute :avalara_transaction_type, Integer
20
+
13
21
  # @!attribute code
14
22
  # @return [String] The unique identifier for the add-on within its plan. If an `Item` is associated to the `AddOn` then `code` must be absent.
15
23
  define_attribute :code, String
@@ -30,6 +38,14 @@ module Recurly
30
38
  # @return [String] Add-on ID
31
39
  define_attribute :id, String
32
40
 
41
+ # @!attribute measured_unit_id
42
+ # @return [String] System-generated unique identifier for a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used.
43
+ define_attribute :measured_unit_id, String
44
+
45
+ # @!attribute measured_unit_name
46
+ # @return [String] Name of a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used.
47
+ define_attribute :measured_unit_name, String
48
+
33
49
  # @!attribute name
34
50
  # @return [String] Describes your add-on and will appear in subscribers' invoices. If an `Item` is associated to the `AddOn` then `name` must be absent.
35
51
  define_attribute :name, String
@@ -49,6 +65,10 @@ module Recurly
49
65
  # @!attribute tiers
50
66
  # @return [Array[Tier]] If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier with an `ending_quantity` of 999999999 which is the default if not provided.
51
67
  define_attribute :tiers, Array, { :item_type => :Tier }
68
+
69
+ # @!attribute usage_percentage
70
+ # @return [Float] The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage and `usage_type` is percentage. Must be omitted otherwise. `usage_percentage` does not support tiers.
71
+ define_attribute :usage_percentage, Float
52
72
  end
53
73
  end
54
74
  end
@@ -67,7 +67,7 @@ module Recurly
67
67
  define_attribute :name, String
68
68
 
69
69
  # @!attribute plan_codes
70
- # @return [Array[String]] List of plan codes to which this coupon applies. See `applies_to_all_plans`
70
+ # @return [Array[String]] List of plan codes to which this coupon applies. Required if `applies_to_all_plans` is false. Overrides `applies_to_all_plans` when `applies_to_all_plans` is true.
71
71
  define_attribute :plan_codes, Array, { :item_type => String }
72
72
 
73
73
  # @!attribute redeem_by_date
@@ -10,6 +10,14 @@ module Recurly
10
10
  # @return [String] Accounting code for invoice line items.
11
11
  define_attribute :accounting_code, String
12
12
 
13
+ # @!attribute avalara_service_type
14
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
15
+ define_attribute :avalara_service_type, Integer
16
+
17
+ # @!attribute avalara_transaction_type
18
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
19
+ define_attribute :avalara_transaction_type, Integer
20
+
13
21
  # @!attribute code
14
22
  # @return [String] Unique code to identify the item.
15
23
  define_attribute :code, String
@@ -10,6 +10,14 @@ module Recurly
10
10
  # @return [String] Accounting code for invoice line items.
11
11
  define_attribute :accounting_code, String
12
12
 
13
+ # @!attribute avalara_service_type
14
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
15
+ define_attribute :avalara_service_type, Integer
16
+
17
+ # @!attribute avalara_transaction_type
18
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
19
+ define_attribute :avalara_transaction_type, Integer
20
+
13
21
  # @!attribute code
14
22
  # @return [String] Unique code to identify the item.
15
23
  define_attribute :code, String
@@ -10,6 +10,14 @@ module Recurly
10
10
  # @return [String] Accounting Code for the `LineItem`. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent.
11
11
  define_attribute :accounting_code, String
12
12
 
13
+ # @!attribute avalara_service_type
14
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `LineItem`, then the `avalara_service_type` must be absent.
15
+ define_attribute :avalara_service_type, Integer
16
+
17
+ # @!attribute avalara_transaction_type
18
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `LineItem`, then the `avalara_transaction_type` must be absent.
19
+ define_attribute :avalara_transaction_type, Integer
20
+
13
21
  # @!attribute credit_reason_code
14
22
  # @return [String] The reason the credit was given when line item is `type=credit`. When the Credit Invoices feature is enabled, the value can be set and will default to `general`. When the Credit Invoices feature is not enabled, the value will always be `null`.
15
23
  define_attribute :credit_reason_code, String
@@ -35,7 +43,7 @@ module Recurly
35
43
  define_attribute :item_id, String
36
44
 
37
45
  # @!attribute origin
38
- # @return [String] Only allowed if the Gift Cards feature is enabled on your site and `type` is `credit`. Can only have a value of `external_gift_card`. Set this value in order to track gift card credits from external gift cards (like InComm). It also skips billing information requirements.
46
+ # @return [String] Origin `external_gift_card` is allowed if the Gift Cards feature is enabled on your site and `type` is `credit`. Set this value in order to track gift card credits from external gift cards (like InComm). It also skips billing information requirements. Origin `prepayment` is only allowed if `type` is `charge` and `tax_exempt` is left blank or set to true. This origin creates a charge and opposite credit on the account to be used for future invoices.
39
47
  define_attribute :origin, String
40
48
 
41
49
  # @!attribute product_code
@@ -0,0 +1,22 @@
1
+ # This file is automatically created by Recurly's OpenAPI generation process
2
+ # and thus any edits you make by hand will be lost. If you wish to make a
3
+ # change to this file, please create a Github issue explaining the changes you
4
+ # need and we will usher them to the appropriate places.
5
+ module Recurly
6
+ module Requests
7
+ class MeasuredUnitCreate < Request
8
+
9
+ # @!attribute description
10
+ # @return [String] Optional internal description.
11
+ define_attribute :description, String
12
+
13
+ # @!attribute display_name
14
+ # @return [String] Display name for the measured unit.
15
+ define_attribute :display_name, String
16
+
17
+ # @!attribute name
18
+ # @return [String] Unique internal name of the measured unit on your site.
19
+ define_attribute :name, String
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # This file is automatically created by Recurly's OpenAPI generation process
2
+ # and thus any edits you make by hand will be lost. If you wish to make a
3
+ # change to this file, please create a Github issue explaining the changes you
4
+ # need and we will usher them to the appropriate places.
5
+ module Recurly
6
+ module Requests
7
+ class MeasuredUnitUpdate < Request
8
+
9
+ # @!attribute description
10
+ # @return [String] Optional internal description.
11
+ define_attribute :description, String
12
+
13
+ # @!attribute display_name
14
+ # @return [String] Display name for the measured unit.
15
+ define_attribute :display_name, String
16
+
17
+ # @!attribute name
18
+ # @return [String] Unique internal name of the measured unit on your site.
19
+ define_attribute :name, String
20
+ end
21
+ end
22
+ end
@@ -22,6 +22,14 @@ module Recurly
22
22
  # @return [Boolean] Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself.
23
23
  define_attribute :auto_renew, :Boolean
24
24
 
25
+ # @!attribute avalara_service_type
26
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
27
+ define_attribute :avalara_service_type, Integer
28
+
29
+ # @!attribute avalara_transaction_type
30
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
31
+ define_attribute :avalara_transaction_type, Integer
32
+
25
33
  # @!attribute code
26
34
  # @return [String] Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports.
27
35
  define_attribute :code, String
@@ -22,6 +22,14 @@ module Recurly
22
22
  # @return [Boolean] Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself.
23
23
  define_attribute :auto_renew, :Boolean
24
24
 
25
+ # @!attribute avalara_service_type
26
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
27
+ define_attribute :avalara_service_type, Integer
28
+
29
+ # @!attribute avalara_transaction_type
30
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
31
+ define_attribute :avalara_transaction_type, Integer
32
+
25
33
  # @!attribute code
26
34
  # @return [String] Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports.
27
35
  define_attribute :code, String
@@ -11,7 +11,7 @@ module Recurly
11
11
  define_attribute :address, :ShippingAddressCreate
12
12
 
13
13
  # @!attribute address_id
14
- # @return [String] Assign a shipping address from the account's existing shipping addresses. If this and `shipping_address` are both present, `shipping_address` will take precedence.
14
+ # @return [String] Assign a shipping address from the account's existing shipping addresses. If this and `address` are both present, `address` will take precedence.
15
15
  define_attribute :address_id, String
16
16
 
17
17
  # @!attribute fees
@@ -23,12 +23,16 @@ module Recurly
23
23
  define_attribute :revenue_schedule_type, String
24
24
 
25
25
  # @!attribute tiers
26
- # @return [Array[SubscriptionAddOnTier]] If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier with an `ending_quantity` of 999999999 which is the default if not provided.
26
+ # @return [Array[SubscriptionAddOnTier]] If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier with an `ending_quantity` of 999999999 which is the default if not provided. See our [Guide](https://developers.recurly.com/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models.
27
27
  define_attribute :tiers, Array, { :item_type => :SubscriptionAddOnTier }
28
28
 
29
29
  # @!attribute unit_amount
30
30
  # @return [Float] * Optionally, override the add-on's default unit amount. * If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` must be absent.
31
31
  define_attribute :unit_amount, Float
32
+
33
+ # @!attribute usage_percentage
34
+ # @return [Float] The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage and `usage_type` is percentage. Must be omitted otherwise. `usage_percentage` does not support tiers. See our [Guide](https://developers.recurly.com/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons.
35
+ define_attribute :usage_percentage, Float
32
36
  end
33
37
  end
34
38
  end
@@ -33,6 +33,10 @@ module Recurly
33
33
  # @!attribute unit_amount
34
34
  # @return [Float] Optionally, override the add-on's default unit amount.
35
35
  define_attribute :unit_amount, Float
36
+
37
+ # @!attribute usage_percentage
38
+ # @return [Float] The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if add_on_type is usage and usage_type is percentage.
39
+ define_attribute :usage_percentage, Float
36
40
  end
37
41
  end
38
42
  end
@@ -7,7 +7,7 @@ module Recurly
7
7
  class SubscriptionChangeCreate < Request
8
8
 
9
9
  # @!attribute add_ons
10
- # @return [Array[SubscriptionAddOnUpdate]] If you provide a value for this field it will replace any existing add-ons. So, when adding or modifying an add-on, you need to include the existing subscription add-ons. Unchanged add-ons can be included just using the subscription add-on's ID: `{"id": "abc123"}`. If a subscription add-on's `code` is supplied without the `id`, `{"code": "def456"}`, the subscription add-on attributes will be set to the current values of the plan add-on unless provided in the request. - If an `id` is passed, any attributes not passed in will pull from the existing subscription add-on - If a `code` is passed, any attributes not passed in will pull from the current values of the plan add-on - Attributes passed in as part of the request will override either of the above scenarios
10
+ # @return [Array[SubscriptionAddOnUpdate]] If this value is omitted your existing add-ons will be removed. If you provide a value for this field it will replace any existing add-ons. So, when adding or modifying an add-on, you need to include the existing subscription add-ons. Unchanged add-ons can be included just using the subscription add-on's ID: `{"id": "abc123"}`. If a subscription add-on's `code` is supplied without the `id`, `{"code": "def456"}`, the subscription add-on attributes will be set to the current values of the plan add-on unless provided in the request. - If an `id` is passed, any attributes not passed in will pull from the existing subscription add-on - If a `code` is passed, any attributes not passed in will pull from the current values of the plan add-on - Attributes passed in as part of the request will override either of the above scenarios
11
11
  define_attribute :add_ons, Array, { :item_type => :SubscriptionAddOnUpdate }
12
12
 
13
13
  # @!attribute collection_method
@@ -18,6 +18,10 @@ module Recurly
18
18
  # @return [Array[String]] A list of coupon_codes to be redeemed on the subscription during the change. Only allowed if timeframe is now and you change something about the subscription that creates an invoice.
19
19
  define_attribute :coupon_codes, Array, { :item_type => String }
20
20
 
21
+ # @!attribute custom_fields
22
+ # @return [Array[CustomField]] The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value.
23
+ define_attribute :custom_fields, Array, { :item_type => :CustomField }
24
+
21
25
  # @!attribute net_terms
22
26
  # @return [Integer] Integer representing the number of days after an invoice's creation that the invoice will become past due. If an invoice's net terms are set to '0', it is due 'On Receipt' and will become past due 24 hours after it’s created. If an invoice is due net 30, it will become past due at 31 days exactly.
23
27
  define_attribute :net_terms, Integer
@@ -46,6 +46,10 @@ module Recurly
46
46
  # @return [SubscriptionShippingPurchase] Create a shipping address on the account and assign it to the subscription.
47
47
  define_attribute :shipping, :SubscriptionShippingPurchase
48
48
 
49
+ # @!attribute starts_at
50
+ # @return [DateTime] If set, the subscription will begin in the future on this date. The subscription will apply the setup fee and trial period, unless the plan has no trial.
51
+ define_attribute :starts_at, DateTime
52
+
49
53
  # @!attribute total_billing_cycles
50
54
  # @return [Integer] The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire.
51
55
  define_attribute :total_billing_cycles, Integer
@@ -0,0 +1,26 @@
1
+ # This file is automatically created by Recurly's OpenAPI generation process
2
+ # and thus any edits you make by hand will be lost. If you wish to make a
3
+ # change to this file, please create a Github issue explaining the changes you
4
+ # need and we will usher them to the appropriate places.
5
+ module Recurly
6
+ module Requests
7
+ class UsageCreate < Request
8
+
9
+ # @!attribute amount
10
+ # @return [Float] The amount of usage. Can be positive, negative, or 0. No decimals allowed, we will strip them. If the usage-based add-on is billed with a percentage, your usage will be a monetary amount you will want to format in cents. (e.g., $5.00 is "500").
11
+ define_attribute :amount, Float
12
+
13
+ # @!attribute merchant_tag
14
+ # @return [String] Custom field for recording the id in your own system associated with the usage, so you can provide auditable usage displays to your customers using a GET on this endpoint.
15
+ define_attribute :merchant_tag, String
16
+
17
+ # @!attribute recording_timestamp
18
+ # @return [DateTime] When the usage was recorded in your system.
19
+ define_attribute :recording_timestamp, DateTime
20
+
21
+ # @!attribute usage_timestamp
22
+ # @return [DateTime] When the usage actually happened. This will define the line item dates this usage is billed under and is important for revenue recognition.
23
+ define_attribute :usage_timestamp, DateTime
24
+ end
25
+ end
26
+ end
@@ -10,6 +10,18 @@ module Recurly
10
10
  # @return [String] Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code.
11
11
  define_attribute :accounting_code, String
12
12
 
13
+ # @!attribute add_on_type
14
+ # @return [String] Whether the add-on type is fixed, or usage-based.
15
+ define_attribute :add_on_type, String
16
+
17
+ # @!attribute avalara_service_type
18
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
19
+ define_attribute :avalara_service_type, Integer
20
+
21
+ # @!attribute avalara_transaction_type
22
+ # @return [Integer] Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types.
23
+ define_attribute :avalara_transaction_type, Integer
24
+
13
25
  # @!attribute code
14
26
  # @return [String] The unique identifier for the add-on within its plan.
15
27
  define_attribute :code, String
@@ -46,6 +58,10 @@ module Recurly
46
58
  # @return [ItemMini] Just the important parts.
47
59
  define_attribute :item, :ItemMini
48
60
 
61
+ # @!attribute measured_unit_id
62
+ # @return [String] System-generated unique identifier for an measured unit associated with the add-on.
63
+ define_attribute :measured_unit_id, String
64
+
49
65
  # @!attribute name
50
66
  # @return [String] Describes your add-on and will appear in subscribers' invoices.
51
67
  define_attribute :name, String
@@ -85,6 +101,14 @@ module Recurly
85
101
  # @!attribute updated_at
86
102
  # @return [DateTime] Last updated at
87
103
  define_attribute :updated_at, DateTime
104
+
105
+ # @!attribute usage_percentage
106
+ # @return [Float] The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0.
107
+ define_attribute :usage_percentage, Float
108
+
109
+ # @!attribute usage_type
110
+ # @return [String] Type of usage, returns usage type if `add_on_type` is `usage`.
111
+ define_attribute :usage_type, String
88
112
  end
89
113
  end
90
114
  end