recurly 3.18.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.bumpversion.cfg +1 -1
  3. data/.github_changelog_generator +1 -1
  4. data/.travis.yml +0 -1
  5. data/CHANGELOG.md +82 -80
  6. data/CONTRIBUTING.md +0 -4
  7. data/GETTING_STARTED.md +20 -17
  8. data/README.md +0 -3
  9. data/lib/recurly/client.rb +41 -23
  10. data/lib/recurly/client/operations.rb +768 -546
  11. data/lib/recurly/errors.rb +5 -23
  12. data/lib/recurly/errors/api_errors.rb +3 -0
  13. data/lib/recurly/pager.rb +4 -14
  14. data/lib/recurly/requests/{account_acquisition_updatable.rb → account_acquisition_update.rb} +1 -1
  15. data/lib/recurly/requests/account_create.rb +2 -2
  16. data/lib/recurly/requests/account_purchase.rb +2 -2
  17. data/lib/recurly/requests/add_on_create.rb +2 -2
  18. data/lib/recurly/requests/add_on_pricing.rb +5 -1
  19. data/lib/recurly/requests/add_on_update.rb +2 -2
  20. data/lib/recurly/requests/address.rb +0 -8
  21. data/lib/recurly/requests/billing_info_create.rb +1 -25
  22. data/lib/recurly/requests/coupon_create.rb +1 -1
  23. data/lib/recurly/requests/external_transaction.rb +1 -1
  24. data/lib/recurly/requests/{invoice_updatable.rb → invoice_update.rb} +1 -1
  25. data/lib/recurly/requests/line_item_create.rb +1 -1
  26. data/lib/recurly/requests/subscription_add_on_create.rb +6 -2
  27. data/lib/recurly/requests/subscription_add_on_tier.rb +5 -1
  28. data/lib/recurly/requests/subscription_add_on_update.rb +6 -2
  29. data/lib/recurly/requests/subscription_change_create.rb +1 -1
  30. data/lib/recurly/requests/subscription_create.rb +3 -3
  31. data/lib/recurly/requests/tier.rb +2 -2
  32. data/lib/recurly/requests/tier_pricing.rb +22 -0
  33. data/lib/recurly/resources/add_on.rb +1 -1
  34. data/lib/recurly/resources/add_on_pricing.rb +5 -1
  35. data/lib/recurly/resources/address.rb +0 -8
  36. data/lib/recurly/resources/address_with_name.rb +46 -0
  37. data/lib/recurly/resources/coupon.rb +5 -17
  38. data/lib/recurly/resources/invoice.rb +6 -2
  39. data/lib/recurly/resources/line_item.rb +4 -0
  40. data/lib/recurly/resources/plan.rb +1 -1
  41. data/lib/recurly/resources/subscription_add_on.rb +6 -2
  42. data/lib/recurly/resources/subscription_add_on_tier.rb +5 -1
  43. data/lib/recurly/resources/subscription_change.rb +0 -4
  44. data/lib/recurly/resources/tier.rb +2 -2
  45. data/lib/recurly/resources/tier_pricing.rb +22 -0
  46. data/lib/recurly/resources/transaction.rb +2 -2
  47. data/lib/recurly/resources/unique_coupon_code_params.rb +26 -0
  48. data/lib/recurly/resources/usage.rb +5 -1
  49. data/lib/recurly/version.rb +1 -1
  50. data/openapi/api.yaml +1835 -1785
  51. data/scripts/changelog +1 -1
  52. metadata +9 -9
  53. data/CODE_OF_CONDUCT.md +0 -130
  54. data/lib/recurly/errors/network_errors.rb +0 -10
  55. data/lib/recurly/resources/line_item_list.rb +0 -26
  56. data/lib/recurly/resources/subscription_change_preview.rb +0 -78
@@ -21,34 +21,17 @@ module Recurly
21
21
  # Error class based on the response code. This may occur when a load balancer
22
22
  # returns an error before it reaches Recurly's API.
23
23
  # @param response [Net::Response]
24
- # @return [Errors::APIError,Errors::NetworkError]
25
- # rubocop:disable Metrics/CyclomaticComplexity
24
+ # @return [Errors::APIError]
26
25
  def self.from_response(response)
27
- case response
28
- when Net::HTTPBadRequest # 400
29
- Recurly::Errors::BadRequestError
30
- when Net::HTTPUnauthorized, Net::HTTPForbidden # 401, 403
31
- Recurly::Errors::UnauthorizedError
32
- when Net::HTTPRequestTimeOut # 408
33
- Recurly::Errors::TimeoutError
34
- when Net::HTTPTooManyRequests # 429
35
- Recurly::Errors::RateLimitedError
36
- when Net::HTTPInternalServerError # 500
37
- Recurly::Errors::InternalServerError
38
- when Net::HTTPServiceUnavailable # 503
39
- Recurly::Errors::UnavailableError
40
- when Net::HTTPGatewayTimeOut # 504
41
- Recurly::Errors::TimeoutError
42
- when Net::HTTPServerError # 5xx
43
- Recurly::Errors::UnavailableError
26
+ if Recurly::Errors::ERROR_MAP.has_key?(response.code)
27
+ Recurly::Errors.const_get(Recurly::Errors::ERROR_MAP[response.code])
44
28
  else
45
29
  Recurly::Errors::APIError
46
30
  end
47
31
  end
48
- # rubocop:enable Metrics/CyclomaticComplexity
49
32
 
50
- def initialize(response, error)
51
- super(error.message)
33
+ def initialize(message, response = nil, error = nil)
34
+ super(message)
52
35
  @response = response
53
36
  @recurly_error = error
54
37
  end
@@ -64,5 +47,4 @@ module Recurly
64
47
  end
65
48
 
66
49
  require_relative "./errors/api_errors"
67
- require_relative "./errors/network_errors"
68
50
  end
@@ -8,6 +8,7 @@ module Recurly
8
8
  "500" => "InternalServerError",
9
9
  "502" => "BadGatewayError",
10
10
  "503" => "ServiceUnavailableError",
11
+ "504" => "TimeoutError",
11
12
  "304" => "NotModifiedError",
12
13
  "400" => "BadRequestError",
13
14
  "401" => "UnauthorizedError",
@@ -32,6 +33,8 @@ module Recurly
32
33
 
33
34
  class ServiceUnavailableError < ServerError; end
34
35
 
36
+ class TimeoutError < ServerError; end
37
+
35
38
  class RedirectionError < ResponseError; end
36
39
 
37
40
  class NotModifiedError < ResponseError; end
data/lib/recurly/pager.rb CHANGED
@@ -6,7 +6,7 @@ module Recurly
6
6
  def initialize(client:, path:, options: {})
7
7
  @client = client
8
8
  @path = path
9
- @options = map_array_params(options)
9
+ @options = options
10
10
  rewind!
11
11
  end
12
12
 
@@ -16,7 +16,7 @@ module Recurly
16
16
  # Modify the @next url to set the :limit to 1
17
17
  original_next = @next
18
18
  @next = @path
19
- fetch_next!(@options.merge(limit: 1))
19
+ fetch_next!(@options.merge(params: @options.fetch(:params, {}).merge({ limit: 1 })))
20
20
  # Restore the @next url to the original
21
21
  @next = original_next
22
22
  @data.first
@@ -103,7 +103,7 @@ module Recurly
103
103
  Enumerator.new do |yielder|
104
104
  loop do
105
105
  # Pass in @options when requesting the first page (@data.empty?)
106
- next_options = @data.empty? ? @options : {}
106
+ next_options = @data.empty? ? @options : @options.merge(params: {})
107
107
  fetch_next!(next_options)
108
108
  yielder << data
109
109
  unless has_more?
@@ -116,7 +116,7 @@ module Recurly
116
116
 
117
117
  def fetch_next!(options)
118
118
  path = extract_path(self.next)
119
- page = @client.send(:get, path, **options)
119
+ page = @client.send(:get, path, options)
120
120
  @data = page.data.map { |d| JSONParser.from_json(d) }
121
121
  @has_more = page.has_more
122
122
  @next = page.next
@@ -132,15 +132,5 @@ module Recurly
132
132
  uri = URI(uri_or_path)
133
133
  uri.kind_of?(URI::HTTP) ? uri.request_uri : uri_or_path
134
134
  end
135
-
136
- # Converts array parameters to CSV strings to maintain consistency with
137
- # how the server expects the request to be formatted while providing the
138
- # developer with an array type to maintain developer happiness!
139
- def map_array_params(params)
140
- @options = params.map do |key, param|
141
- new_param = param.is_a?(Array) ? param.join(",") : param
142
- [key, new_param]
143
- end.to_h
144
- end
145
135
  end
146
136
  end
@@ -4,7 +4,7 @@
4
4
  # need and we will usher them to the appropriate places.
5
5
  module Recurly
6
6
  module Requests
7
- class AccountAcquisitionUpdatable < Request
7
+ class AccountAcquisitionUpdate < Request
8
8
 
9
9
  # @!attribute campaign
10
10
  # @return [String] An arbitrary identifier for the marketing campaign that led to the acquisition of this account.
@@ -7,8 +7,8 @@ module Recurly
7
7
  class AccountCreate < Request
8
8
 
9
9
  # @!attribute acquisition
10
- # @return [AccountAcquisitionUpdatable]
11
- define_attribute :acquisition, :AccountAcquisitionUpdatable
10
+ # @return [AccountAcquisitionUpdate]
11
+ define_attribute :acquisition, :AccountAcquisitionUpdate
12
12
 
13
13
  # @!attribute address
14
14
  # @return [Address]
@@ -7,8 +7,8 @@ module Recurly
7
7
  class AccountPurchase < Request
8
8
 
9
9
  # @!attribute acquisition
10
- # @return [AccountAcquisitionUpdatable]
11
- define_attribute :acquisition, :AccountAcquisitionUpdatable
10
+ # @return [AccountAcquisitionUpdate]
11
+ define_attribute :acquisition, :AccountAcquisitionUpdate
12
12
 
13
13
  # @!attribute address
14
14
  # @return [Address]
@@ -27,7 +27,7 @@ module Recurly
27
27
  define_attribute :code, String
28
28
 
29
29
  # @!attribute currencies
30
- # @return [Array[AddOnPricing]] * If `item_code`/`item_id` is part of the request and the item has a default currency then `currencies` is optional. If the item does not have a default currency, then `currencies` is required. If `item_code`/`item_id` is not present `currencies` is required. * If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `currencies` must be absent.
30
+ # @return [Array[AddOnPricing]] * If `item_code`/`item_id` is part of the request and the item has a default currency then `currencies` is optional. If the item does not have a default currency, then `currencies` is required. If `item_code`/`item_id` is not present `currencies` is required. * If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `currencies` must be absent. * Must be absent if `add_on_type` is `usage` and `usage_type` is `percentage`.
31
31
  define_attribute :currencies, Array, { :item_type => :AddOnPricing }
32
32
 
33
33
  # @!attribute default_quantity
@@ -39,7 +39,7 @@ module Recurly
39
39
  define_attribute :display_quantity, :Boolean
40
40
 
41
41
  # @!attribute item_code
42
- # @return [String] Unique code to identify an item. Avaliable 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.
42
+ # @return [String] Unique code to identify 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.
43
43
  define_attribute :item_code, String
44
44
 
45
45
  # @!attribute item_id
@@ -11,8 +11,12 @@ module Recurly
11
11
  define_attribute :currency, String
12
12
 
13
13
  # @!attribute unit_amount
14
- # @return [Float] Unit price
14
+ # @return [Float] Allows up to 2 decimal places. Required unless `unit_amount_decimal` is provided.
15
15
  define_attribute :unit_amount, Float
16
+
17
+ # @!attribute unit_amount_decimal
18
+ # @return [String] Allows up to 9 decimal places. Only supported when `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided.
19
+ define_attribute :unit_amount_decimal, String
16
20
  end
17
21
  end
18
22
  end
@@ -23,7 +23,7 @@ module Recurly
23
23
  define_attribute :code, String
24
24
 
25
25
  # @!attribute currencies
26
- # @return [Array[AddOnPricing]] If the add-on's `tier_type` is `tiered`, `volume` or `stairstep`, then `currencies` must be absent.
26
+ # @return [Array[AddOnPricing]] If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then currencies must be absent. Must also be absent if `add_on_type` is `usage` and `usage_type` is `percentage`.
27
27
  define_attribute :currencies, Array, { :item_type => :AddOnPricing }
28
28
 
29
29
  # @!attribute default_quantity
@@ -55,7 +55,7 @@ module Recurly
55
55
  define_attribute :optional, :Boolean
56
56
 
57
57
  # @!attribute revenue_schedule_type
58
- # @return [String] When this add-on is invoiced, the line item will use this revenue schedule. If an `Item` is associated to the `AddOn` then `revenue_schedule_type` must be absent in the request as the value will be set from the item.
58
+ # @return [String] When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item.
59
59
  define_attribute :revenue_schedule_type, String
60
60
 
61
61
  # @!attribute tax_code
@@ -14,14 +14,6 @@ module Recurly
14
14
  # @return [String] Country, 2-letter ISO code.
15
15
  define_attribute :country, String
16
16
 
17
- # @!attribute first_name
18
- # @return [String] First name
19
- define_attribute :first_name, String
20
-
21
- # @!attribute last_name
22
- # @return [String] Last name
23
- define_attribute :last_name, String
24
-
25
17
  # @!attribute phone
26
18
  # @return [String] Phone number
27
19
  define_attribute :phone, String
@@ -6,14 +6,6 @@ module Recurly
6
6
  module Requests
7
7
  class BillingInfoCreate < Request
8
8
 
9
- # @!attribute account_number
10
- # @return [String] The bank account number. (ACH, Bacs only)
11
- define_attribute :account_number, String
12
-
13
- # @!attribute account_type
14
- # @return [String] The bank account type. (ACH only)
15
- define_attribute :account_type, String
16
-
17
9
  # @!attribute address
18
10
  # @return [Address]
19
11
  define_attribute :address, :Address
@@ -47,7 +39,7 @@ module Recurly
47
39
  define_attribute :gateway_token, String
48
40
 
49
41
  # @!attribute iban
50
- # @return [String] The International Bank Account Number, up to 34 alphanumeric characters comprising a country code; two check digits; and a number that includes the domestic bank account number, branch identifier, and potential routing information. (SEPA only)
42
+ # @return [String] The International Bank Account Number, up to 34 alphanumeric characters comprising a country code; two check digits; and a number that includes the domestic bank account number, branch identifier, and potential routing information
51
43
  define_attribute :iban, String
52
44
 
53
45
  # @!attribute ip_address
@@ -62,10 +54,6 @@ module Recurly
62
54
  # @return [String] Expiration month
63
55
  define_attribute :month, String
64
56
 
65
- # @!attribute name_on_account
66
- # @return [String] The name associated with the bank account (ACH, SEPA, Bacs only)
67
- define_attribute :name_on_account, String
68
-
69
57
  # @!attribute number
70
58
  # @return [String] Credit card number, spaces and dashes are accepted.
71
59
  define_attribute :number, String
@@ -78,14 +66,6 @@ module Recurly
78
66
  # @return [Boolean] The `primary_payment_method` indicator is used to designate the primary billing info on the account. The first billing info created on an account will always become primary. Adding additional billing infos provides the flexibility to mark another billing info as primary, or adding additional non-primary billing infos. This can be accomplished by passing the `primary_payment_method` indicator. When adding billing infos via the billing_info and /accounts endpoints, this value is not permitted, and will return an error if provided.
79
67
  define_attribute :primary_payment_method, :Boolean
80
68
 
81
- # @!attribute routing_number
82
- # @return [String] The bank's rounting number. (ACH only)
83
- define_attribute :routing_number, String
84
-
85
- # @!attribute sort_code
86
- # @return [String] Bank identifier code for UK based banks. Required for Bacs based billing infos. (Bacs only)
87
- define_attribute :sort_code, String
88
-
89
69
  # @!attribute tax_identifier
90
70
  # @return [String] Tax identifier is required if adding a billing info that is a consumer card in Brazil. This would be the customer's CPF, CPF is a Brazilian tax identifier for all tax paying residents.
91
71
  define_attribute :tax_identifier, String
@@ -106,10 +86,6 @@ module Recurly
106
86
  # @return [String] An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions.
107
87
  define_attribute :transaction_type, String
108
88
 
109
- # @!attribute type
110
- # @return [String] The payment method type for a non-credit card based billing info. The value of `bacs` is the only accepted value (Bacs only)
111
- define_attribute :type, String
112
-
113
89
  # @!attribute vat_number
114
90
  # @return [String] VAT number
115
91
  define_attribute :vat_number, String
@@ -11,7 +11,7 @@ module Recurly
11
11
  define_attribute :applies_to_all_items, :Boolean
12
12
 
13
13
  # @!attribute applies_to_all_plans
14
- # @return [Boolean] The coupon is valid for all plans if true. If false then `plans` and `plans_names` will list the applicable plans.
14
+ # @return [Boolean] The coupon is valid for all plans if true. If false then `plans` will list the applicable plans.
15
15
  define_attribute :applies_to_all_plans, :Boolean
16
16
 
17
17
  # @!attribute applies_to_non_plan_charges
@@ -19,7 +19,7 @@ module Recurly
19
19
  define_attribute :description, String
20
20
 
21
21
  # @!attribute payment_method
22
- # @return [String] Payment method used for the external transaction.
22
+ # @return [String] Payment method used for external transaction.
23
23
  define_attribute :payment_method, String
24
24
  end
25
25
  end
@@ -4,7 +4,7 @@
4
4
  # need and we will usher them to the appropriate places.
5
5
  module Recurly
6
6
  module Requests
7
- class InvoiceUpdatable < Request
7
+ class InvoiceUpdate < Request
8
8
 
9
9
  # @!attribute address
10
10
  # @return [InvoiceAddress]
@@ -35,7 +35,7 @@ module Recurly
35
35
  define_attribute :end_date, DateTime
36
36
 
37
37
  # @!attribute item_code
38
- # @return [String] Unique code to identify an item. Avaliable when the Credit Invoices and Subscription Billing Terms features are enabled.
38
+ # @return [String] Unique code to identify an item. Available when the Credit Invoices and Subscription Billing Terms features are enabled.
39
39
  define_attribute :item_code, String
40
40
 
41
41
  # @!attribute item_id
@@ -7,7 +7,7 @@ module Recurly
7
7
  class SubscriptionAddOnCreate < Request
8
8
 
9
9
  # @!attribute add_on_source
10
- # @return [String] Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add_on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog.
10
+ # @return [String] Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog.
11
11
  define_attribute :add_on_source, String
12
12
 
13
13
  # @!attribute code
@@ -27,9 +27,13 @@ module Recurly
27
27
  define_attribute :tiers, Array, { :item_type => :SubscriptionAddOnTier }
28
28
 
29
29
  # @!attribute unit_amount
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.
30
+ # @return [Float] Allows up to 2 decimal places. 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` cannot be provided.
31
31
  define_attribute :unit_amount, Float
32
32
 
33
+ # @!attribute unit_amount_decimal
34
+ # @return [String] Allows up to 9 decimal places. 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_decimal` cannot be provided. Only supported when the plan add-on's `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided.
35
+ define_attribute :unit_amount_decimal, String
36
+
33
37
  # @!attribute usage_percentage
34
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. 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
39
  define_attribute :usage_percentage, Float
@@ -11,8 +11,12 @@ module Recurly
11
11
  define_attribute :ending_quantity, Integer
12
12
 
13
13
  # @!attribute unit_amount
14
- # @return [Float] Unit amount
14
+ # @return [Float] Allows up to 2 decimal places. Optionally, override the tiers' default unit amount.
15
15
  define_attribute :unit_amount, Float
16
+
17
+ # @!attribute unit_amount_decimal
18
+ # @return [String] Allows up to 9 decimal places. Optionally, override tiers' default unit amount. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided.
19
+ define_attribute :unit_amount_decimal, String
16
20
  end
17
21
  end
18
22
  end
@@ -7,7 +7,7 @@ module Recurly
7
7
  class SubscriptionAddOnUpdate < Request
8
8
 
9
9
  # @!attribute add_on_source
10
- # @return [String] Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add_on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog.
10
+ # @return [String] Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog.
11
11
  define_attribute :add_on_source, String
12
12
 
13
13
  # @!attribute code
@@ -31,9 +31,13 @@ module Recurly
31
31
  define_attribute :tiers, Array, { :item_type => :SubscriptionAddOnTier }
32
32
 
33
33
  # @!attribute unit_amount
34
- # @return [Float] Optionally, override the add-on's default unit amount.
34
+ # @return [Float] Allows up to 2 decimal places. 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` cannot be provided.
35
35
  define_attribute :unit_amount, Float
36
36
 
37
+ # @!attribute unit_amount_decimal
38
+ # @return [String] Allows up to 9 decimal places. 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_decimal` cannot be provided. Only supported when the plan add-on's `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided.
39
+ define_attribute :unit_amount_decimal, String
40
+
37
41
  # @!attribute usage_percentage
38
42
  # @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
43
  define_attribute :usage_percentage, Float
@@ -7,7 +7,7 @@ module Recurly
7
7
  class SubscriptionChangeCreate < Request
8
8
 
9
9
  # @!attribute add_ons
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
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 this value is omitted your existing add-ons will be unaffected. To remove all existing add-ons, this value should be an empty array.' 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
@@ -26,9 +26,9 @@ module Recurly
26
26
  # @return [String] Collection method
27
27
  define_attribute :collection_method, String
28
28
 
29
- # @!attribute coupon_code
30
- # @return [String] Optional coupon code to redeem on the account and discount the subscription. Please note, the subscription request will fail if the coupon is invalid.
31
- define_attribute :coupon_code, String
29
+ # @!attribute coupon_codes
30
+ # @return [Array[String]] A list of coupon_codes to be redeemed on the subscription or account during the purchase.
31
+ define_attribute :coupon_codes, Array, { :item_type => String }
32
32
 
33
33
  # @!attribute credit_customer_notes
34
34
  # @return [String] If there are pending credits on the account that will be invoiced during the subscription creation, these will be used as the Customer Notes on the credit invoice.
@@ -7,8 +7,8 @@ module Recurly
7
7
  class Tier < Request
8
8
 
9
9
  # @!attribute currencies
10
- # @return [Array[Pricing]] Tier pricing
11
- define_attribute :currencies, Array, { :item_type => :Pricing }
10
+ # @return [Array[TierPricing]] Tier pricing
11
+ define_attribute :currencies, Array, { :item_type => :TierPricing }
12
12
 
13
13
  # @!attribute ending_quantity
14
14
  # @return [Integer] Ending quantity
@@ -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 TierPricing < Request
8
+
9
+ # @!attribute currency
10
+ # @return [String] 3-letter ISO 4217 currency code.
11
+ define_attribute :currency, String
12
+
13
+ # @!attribute unit_amount
14
+ # @return [Float] Allows up to 2 decimal places. Required unless `unit_amount_decimal` is provided.
15
+ define_attribute :unit_amount, Float
16
+
17
+ # @!attribute unit_amount_decimal
18
+ # @return [String] Allows up to 9 decimal places. Only supported when `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided.
19
+ define_attribute :unit_amount_decimal, String
20
+ end
21
+ end
22
+ end
@@ -91,7 +91,7 @@ module Recurly
91
91
  define_attribute :tax_code, String
92
92
 
93
93
  # @!attribute tier_type
94
- # @return [String] The type of tiering used by the Add-on.
94
+ # @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.
95
95
  define_attribute :tier_type, String
96
96
 
97
97
  # @!attribute tiers