recurly 3.29.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.bumpversion.cfg +1 -1
  3. data/.github/workflows/docs.yml +2 -2
  4. data/.github_changelog_generator +8 -0
  5. data/.travis.yml +13 -0
  6. data/CHANGELOG.md +202 -391
  7. data/CONTRIBUTING.md +0 -4
  8. data/GETTING_STARTED.md +20 -17
  9. data/README.md +0 -3
  10. data/lib/data/ca-certificates.crt +40 -0
  11. data/lib/recurly/client/operations.rb +815 -748
  12. data/lib/recurly/client.rb +44 -28
  13. data/lib/recurly/errors/api_errors.rb +33 -1
  14. data/lib/recurly/errors.rb +5 -23
  15. data/lib/recurly/pager.rb +5 -15
  16. data/lib/recurly/requests/{account_acquisition_updatable.rb → account_acquisition_update.rb} +1 -1
  17. data/lib/recurly/requests/account_create.rb +2 -14
  18. data/lib/recurly/requests/account_purchase.rb +2 -14
  19. data/lib/recurly/requests/account_update.rb +0 -12
  20. data/lib/recurly/requests/add_on_create.rb +5 -5
  21. data/lib/recurly/requests/add_on_pricing.rb +5 -5
  22. data/lib/recurly/requests/add_on_update.rb +3 -3
  23. data/lib/recurly/requests/address.rb +1 -13
  24. data/lib/recurly/requests/billing_info_create.rb +4 -52
  25. data/lib/recurly/requests/coupon_create.rb +1 -1
  26. data/lib/recurly/requests/custom_field.rb +0 -8
  27. data/lib/recurly/requests/external_transaction.rb +1 -1
  28. data/lib/recurly/requests/invoice_address.rb +1 -5
  29. data/lib/recurly/requests/invoice_collect.rb +1 -1
  30. data/lib/recurly/requests/invoice_create.rb +1 -9
  31. data/lib/recurly/requests/{invoice_updatable.rb → invoice_update.rb} +1 -1
  32. data/lib/recurly/requests/item_create.rb +1 -1
  33. data/lib/recurly/requests/item_update.rb +1 -1
  34. data/lib/recurly/requests/line_item_create.rb +3 -15
  35. data/lib/recurly/requests/line_item_refund.rb +0 -4
  36. data/lib/recurly/requests/plan_create.rb +1 -17
  37. data/lib/recurly/requests/plan_pricing.rb +1 -5
  38. data/lib/recurly/requests/plan_update.rb +1 -13
  39. data/lib/recurly/requests/pricing.rb +0 -4
  40. data/lib/recurly/requests/purchase_create.rb +1 -9
  41. data/lib/recurly/requests/shipping_address_create.rb +1 -5
  42. data/lib/recurly/requests/shipping_address_update.rb +1 -5
  43. data/lib/recurly/requests/subscription_add_on_create.rb +8 -4
  44. data/lib/recurly/requests/subscription_add_on_tier.rb +5 -1
  45. data/lib/recurly/requests/subscription_add_on_update.rb +6 -2
  46. data/lib/recurly/requests/subscription_change_create.rb +1 -13
  47. data/lib/recurly/requests/subscription_create.rb +6 -26
  48. data/lib/recurly/requests/subscription_pause.rb +1 -1
  49. data/lib/recurly/requests/subscription_purchase.rb +3 -31
  50. data/lib/recurly/requests/subscription_update.rb +1 -13
  51. data/lib/recurly/requests/tier.rb +2 -2
  52. data/lib/recurly/requests/{plan_ramp_pricing.rb → tier_pricing.rb} +6 -2
  53. data/lib/recurly/requests/usage_create.rb +1 -1
  54. data/lib/recurly/resources/account.rb +0 -12
  55. data/lib/recurly/resources/account_balance_amount.rb +0 -8
  56. data/lib/recurly/resources/account_mini.rb +0 -4
  57. data/lib/recurly/resources/add_on.rb +2 -2
  58. data/lib/recurly/resources/add_on_pricing.rb +5 -5
  59. data/lib/recurly/resources/address.rb +1 -13
  60. data/lib/recurly/resources/address_with_name.rb +46 -0
  61. data/lib/recurly/resources/billing_info.rb +1 -5
  62. data/lib/recurly/resources/billing_info_updated_by.rb +1 -1
  63. data/lib/recurly/resources/coupon.rb +5 -17
  64. data/lib/recurly/resources/custom_field.rb +0 -8
  65. data/lib/recurly/resources/custom_field_definition.rb +1 -1
  66. data/lib/recurly/resources/invoice.rb +8 -20
  67. data/lib/recurly/resources/invoice_address.rb +1 -5
  68. data/lib/recurly/resources/item.rb +1 -1
  69. data/lib/recurly/resources/line_item.rb +9 -29
  70. data/lib/recurly/resources/payment_method.rb +0 -12
  71. data/lib/recurly/resources/plan.rb +2 -18
  72. data/lib/recurly/resources/plan_pricing.rb +1 -5
  73. data/lib/recurly/resources/pricing.rb +0 -4
  74. data/lib/recurly/resources/shipping_address.rb +1 -5
  75. data/lib/recurly/resources/subscription.rb +0 -20
  76. data/lib/recurly/resources/subscription_add_on.rb +6 -2
  77. data/lib/recurly/resources/subscription_add_on_tier.rb +5 -1
  78. data/lib/recurly/resources/subscription_change.rb +0 -16
  79. data/lib/recurly/resources/tax_info.rb +3 -7
  80. data/lib/recurly/resources/tier.rb +2 -2
  81. data/lib/recurly/resources/{plan_ramp_pricing.rb → tier_pricing.rb} +6 -2
  82. data/lib/recurly/resources/transaction.rb +3 -7
  83. data/lib/recurly/resources/unique_coupon_code_params.rb +26 -0
  84. data/lib/recurly/resources/usage.rb +6 -2
  85. data/lib/recurly/version.rb +1 -1
  86. data/openapi/api.yaml +2308 -13819
  87. data/scripts/build +2 -2
  88. data/scripts/bump +11 -0
  89. data/scripts/changelog +14 -0
  90. data/scripts/format +2 -2
  91. data/scripts/prepare-release +29 -43
  92. data/scripts/release +20 -5
  93. metadata +14 -33
  94. data/.changelog_config.yaml +0 -11
  95. data/.github/workflows/ci.yml +0 -29
  96. data/.github/workflows/pr-review.yml +0 -27
  97. data/CODE_OF_CONDUCT.md +0 -130
  98. data/lib/recurly/errors/network_errors.rb +0 -10
  99. data/lib/recurly/requests/billing_info_verify.rb +0 -18
  100. data/lib/recurly/requests/billing_info_verify_cvv.rb +0 -26
  101. data/lib/recurly/requests/credit_application_policy.rb +0 -18
  102. data/lib/recurly/requests/dunning_campaigns_bulk_update.rb +0 -18
  103. data/lib/recurly/requests/gateway_attributes.rb +0 -14
  104. data/lib/recurly/requests/plan_ramp_interval.rb +0 -18
  105. data/lib/recurly/requests/subscription_change_billing_info_create.rb +0 -14
  106. data/lib/recurly/requests/subscription_ramp_interval.rb +0 -18
  107. data/lib/recurly/resources/credit_application_policy.rb +0 -18
  108. data/lib/recurly/resources/dunning_campaign.rb +0 -50
  109. data/lib/recurly/resources/dunning_campaigns_bulk_update_response.rb +0 -18
  110. data/lib/recurly/resources/dunning_cycle.rb +0 -58
  111. data/lib/recurly/resources/dunning_interval.rb +0 -18
  112. data/lib/recurly/resources/gateway_attributes.rb +0 -14
  113. data/lib/recurly/resources/line_item_list.rb +0 -26
  114. data/lib/recurly/resources/plan_ramp_interval.rb +0 -18
  115. data/lib/recurly/resources/subscription_change_billing_info.rb +0 -14
  116. data/lib/recurly/resources/subscription_change_preview.rb +0 -90
  117. data/lib/recurly/resources/subscription_ramp_interval_response.rb +0 -30
  118. data/lib/recurly/resources/tax_detail.rb +0 -38
@@ -20,7 +20,14 @@ module Recurly
20
20
  MAX_RETRIES = 3
21
21
  LOG_LEVELS = %i(debug info warn error fatal).freeze
22
22
  BASE36_ALPHABET = (("0".."9").to_a + ("a".."z").to_a).freeze
23
- REQUEST_OPTIONS = [:headers].freeze
23
+ ALLOWED_OPTIONS = [
24
+ :site_id,
25
+ :open_timeout,
26
+ :read_timeout,
27
+ :body,
28
+ :params,
29
+ :headers,
30
+ ].freeze
24
31
 
25
32
  # Initialize a client. It requires an API key.
26
33
  #
@@ -47,8 +54,7 @@ module Recurly
47
54
  #
48
55
  # @param api_key [String] The private API key
49
56
  # @param logger [Logger] A logger to use. Defaults to creating a new STDOUT logger with level WARN.
50
- def initialize(api_key:, site_id: nil, subdomain: nil, logger: nil)
51
- set_site_id(site_id, subdomain)
57
+ def initialize(api_key:, logger: nil)
52
58
  set_api_key(api_key)
53
59
 
54
60
  if logger.nil?
@@ -90,6 +96,7 @@ module Recurly
90
96
  end
91
97
 
92
98
  def head(path, **options)
99
+ validate_options!(options)
93
100
  request = Net::HTTP::Head.new build_url(path, options)
94
101
  set_headers(request, options[:headers])
95
102
  http_response = run_request(request, options)
@@ -97,25 +104,26 @@ module Recurly
97
104
  end
98
105
 
99
106
  def get(path, **options)
107
+ validate_options!(options)
100
108
  request = Net::HTTP::Get.new build_url(path, options)
101
109
  set_headers(request, options[:headers])
102
110
  http_response = run_request(request, options)
103
111
  handle_response! request, http_response
104
112
  end
105
113
 
106
- def post(path, request_data = nil, request_class = nil, **options)
114
+ def post(path, request_data, request_class, **options)
115
+ validate_options!(options)
116
+ request_class.new(request_data).validate!
107
117
  request = Net::HTTP::Post.new build_url(path, options)
108
118
  request.set_content_type(JSON_CONTENT_TYPE)
109
119
  set_headers(request, options[:headers])
110
- if request_data
111
- request_class.new(request_data).validate!
112
- request.body = JSON.dump(request_data)
113
- end
120
+ request.body = JSON.dump(request_data)
114
121
  http_response = run_request(request, options)
115
122
  handle_response! request, http_response
116
123
  end
117
124
 
118
125
  def put(path, request_data = nil, request_class = nil, **options)
126
+ validate_options!(options)
119
127
  request = Net::HTTP::Put.new build_url(path, options)
120
128
  request.set_content_type(JSON_CONTENT_TYPE)
121
129
  set_headers(request, options[:headers])
@@ -129,6 +137,7 @@ module Recurly
129
137
  end
130
138
 
131
139
  def delete(path, **options)
140
+ validate_options!(options)
132
141
  request = Net::HTTP::Delete.new build_url(path, options)
133
142
  set_headers(request, options[:headers])
134
143
  http_response = run_request(request, options)
@@ -242,7 +251,7 @@ module Recurly
242
251
  elsif BINARY_TYPES.include?(http_response.content_type)
243
252
  FileParser.parse(response.body)
244
253
  else
245
- raise Recurly::Errors::InvalidResponseError, "Unexpected content type: #{http_response.content_type}"
254
+ raise Recurly::Errors::InvalidContentTypeError, "Unexpected content type: #{http_response.content_type}"
246
255
  end
247
256
  else
248
257
  Resources::Empty.new
@@ -255,20 +264,15 @@ module Recurly
255
264
  def raise_api_error!(http_response, response)
256
265
  if response.content_type.include?(JSON_CONTENT_TYPE)
257
266
  error = JSONParser.parse(self, response.body)
258
- begin
259
- error_class = Errors::APIError.error_class(error.type)
260
- raise error_class.new(response, error)
261
- rescue NameError
262
- error_class = Errors::APIError.from_response(http_response)
263
- raise error_class.new(response, error)
264
- end
267
+ error_class = Errors::APIError.error_class(error.type)
268
+ raise error_class.new(error.message, response, error)
265
269
  end
266
270
 
267
271
  error_class = Errors::APIError.from_response(http_response)
268
272
 
269
273
  if error_class <= Recurly::Errors::APIError
270
274
  error = Recurly::Resources::Error.new(message: "#{http_response.code}: #{http_response.message}")
271
- raise error_class.new(response, error)
275
+ raise error_class.new(error.message, response, error)
272
276
  else
273
277
  raise error_class, "#{http_response.code}: #{http_response.message}"
274
278
  end
@@ -281,6 +285,17 @@ module Recurly
281
285
  response
282
286
  end
283
287
 
288
+ def validate_options!(**options)
289
+ invalid_options = options.keys.reject do |k|
290
+ ALLOWED_OPTIONS.include?(k)
291
+ end
292
+ if invalid_options.any?
293
+ joinedKeys = invalid_options.join(", ")
294
+ joinedOptions = ALLOWED_OPTIONS.join(", ")
295
+ raise ArgumentError, "Invalid options: '#{joinedKeys}'. Allowed options: '#{joinedOptions}'"
296
+ end
297
+ end
298
+
284
299
  def validate_path_parameters!(**options)
285
300
  # Check to see that we are passing the correct data types
286
301
  # This prevents a confusing error if the user passes in a non-primitive by mistake
@@ -301,7 +316,7 @@ module Recurly
301
316
  end
302
317
 
303
318
  def interpolate_path(path, **options)
304
- validate_path_parameters!(**options)
319
+ validate_path_parameters!(options)
305
320
  options.each do |k, v|
306
321
  # We need to encode the values for the url
307
322
  options[k] = ERB::Util.url_encode(v.to_s)
@@ -310,21 +325,13 @@ module Recurly
310
325
  path % options
311
326
  end
312
327
 
313
- def set_site_id(site_id, subdomain)
314
- if site_id
315
- @site_id = site_id
316
- elsif subdomain
317
- @site_id = "subdomain-#{subdomain}"
318
- end
319
- end
320
-
321
328
  def set_api_key(api_key)
322
329
  @api_key = api_key
323
330
  end
324
331
 
325
332
  def build_url(path, options)
326
333
  path = scope_by_site(path, options)
327
- query_params = options.reject { |k, _| REQUEST_OPTIONS.include?(k.to_sym) }
334
+ query_params = map_array_params(options.fetch(:params, {}))
328
335
  if query_params.any?
329
336
  "#{path}?#{URI.encode_www_form(query_params)}"
330
337
  else
@@ -332,7 +339,16 @@ module Recurly
332
339
  end
333
340
  end
334
341
 
335
- def scope_by_site(path, options)
342
+ # Converts array parameters to CSV strings to maintain consistency with
343
+ # how the server expects the request to be formatted while providing the
344
+ # developer with an array type to maintain developer happiness!
345
+ def map_array_params(params)
346
+ params.map do |key, param|
347
+ [key, param.is_a?(Array) ? param.join(",") : param]
348
+ end.to_h
349
+ end
350
+
351
+ def scope_by_site(path, **options)
336
352
  if site = site_id || options[:site_id]
337
353
  # Ensure that we are only including the site_id once because the Pager operations
338
354
  # will use the cursor returned from the API which may already have these components
@@ -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",
@@ -21,36 +22,67 @@ module Recurly
21
22
  }
22
23
 
23
24
  class ResponseError < Errors::APIError; end
25
+
24
26
  class ServerError < ResponseError; end
27
+
25
28
  class InternalServerError < ServerError; end
29
+
26
30
  class ServiceNotAvailableError < InternalServerError; end
27
- class TaxServiceError < InternalServerError; end
31
+
28
32
  class BadGatewayError < ServerError; end
33
+
29
34
  class ServiceUnavailableError < ServerError; end
35
+
36
+ class TimeoutError < ServerError; end
37
+
30
38
  class RedirectionError < ResponseError; end
39
+
31
40
  class NotModifiedError < ResponseError; end
41
+
32
42
  class ClientError < Errors::APIError; end
43
+
33
44
  class BadRequestError < ClientError; end
45
+
34
46
  class InvalidContentTypeError < BadRequestError; end
47
+
35
48
  class UnauthorizedError < ClientError; end
49
+
36
50
  class PaymentRequiredError < ClientError; end
51
+
37
52
  class ForbiddenError < ClientError; end
53
+
38
54
  class InvalidApiKeyError < ForbiddenError; end
55
+
39
56
  class InvalidPermissionsError < ForbiddenError; end
57
+
40
58
  class NotFoundError < ClientError; end
59
+
41
60
  class NotAcceptableError < ClientError; end
61
+
42
62
  class UnknownApiVersionError < NotAcceptableError; end
63
+
43
64
  class UnavailableInApiVersionError < NotAcceptableError; end
65
+
44
66
  class InvalidApiVersionError < NotAcceptableError; end
67
+
45
68
  class PreconditionFailedError < ClientError; end
69
+
46
70
  class UnprocessableEntityError < ClientError; end
71
+
47
72
  class ValidationError < UnprocessableEntityError; end
73
+
48
74
  class MissingFeatureError < UnprocessableEntityError; end
75
+
49
76
  class TransactionError < UnprocessableEntityError; end
77
+
50
78
  class SimultaneousRequestError < UnprocessableEntityError; end
79
+
51
80
  class ImmutableSubscriptionError < UnprocessableEntityError; end
81
+
52
82
  class InvalidTokenError < UnprocessableEntityError; end
83
+
53
84
  class TooManyRequestsError < ClientError; end
85
+
54
86
  class RateLimitedError < TooManyRequestsError; end
55
87
  end
56
88
  end
@@ -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
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
@@ -24,7 +24,7 @@ module Recurly
24
24
 
25
25
  # Makes a HEAD request to the API to determine how many total records exist.
26
26
  def count
27
- resource = @client.send(:head, self.next, **@options)
27
+ resource = @client.send(:head, self.next, @options)
28
28
  resource.get_response.total_records
29
29
  end
30
30
 
@@ -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]
@@ -38,18 +38,10 @@ module Recurly
38
38
  # @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.
39
39
  define_attribute :custom_fields, Array, { :item_type => :CustomField }
40
40
 
41
- # @!attribute dunning_campaign_id
42
- # @return [String] Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used.
43
- define_attribute :dunning_campaign_id, String
44
-
45
41
  # @!attribute email
46
42
  # @return [String] The email address used for communicating with this customer. The customer will also use this email address to log into your hosted account management pages. This value does not need to be unique.
47
43
  define_attribute :email, String
48
44
 
49
- # @!attribute entity_use_code
50
- # @return [String] The Avalara AvaTax value that can be passed to identify the customer type for tax purposes. The range of values can be A - R (more info at Avalara). Value is case-sensitive.
51
- define_attribute :entity_use_code, String
52
-
53
45
  # @!attribute exemption_certificate
54
46
  # @return [String] The tax exemption certificate number for the account. If the merchant has an integration for the Vertex tax provider, this optional value will be sent in any tax calculation requests for the account.
55
47
  define_attribute :exemption_certificate, String
@@ -74,10 +66,6 @@ module Recurly
74
66
  # @return [String] Used to determine the language and locale of emails sent on behalf of the merchant to the customer. The list of locales is restricted to those the merchant has enabled on the site.
75
67
  define_attribute :preferred_locale, String
76
68
 
77
- # @!attribute preferred_time_zone
78
- # @return [String] Used to determine the time zone of emails sent on behalf of the merchant to the customer. Must be a [supported IANA time zone name](https://docs.recurly.com/docs/email-time-zones-and-time-stamps#supported-api-iana-time-zone-names)
79
- define_attribute :preferred_time_zone, String
80
-
81
69
  # @!attribute shipping_addresses
82
70
  # @return [Array[ShippingAddressCreate]]
83
71
  define_attribute :shipping_addresses, Array, { :item_type => :ShippingAddressCreate }
@@ -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]
@@ -38,18 +38,10 @@ module Recurly
38
38
  # @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.
39
39
  define_attribute :custom_fields, Array, { :item_type => :CustomField }
40
40
 
41
- # @!attribute dunning_campaign_id
42
- # @return [String] Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used.
43
- define_attribute :dunning_campaign_id, String
44
-
45
41
  # @!attribute email
46
42
  # @return [String] The email address used for communicating with this customer. The customer will also use this email address to log into your hosted account management pages. This value does not need to be unique.
47
43
  define_attribute :email, String
48
44
 
49
- # @!attribute entity_use_code
50
- # @return [String] The Avalara AvaTax value that can be passed to identify the customer type for tax purposes. The range of values can be A - R (more info at Avalara). Value is case-sensitive.
51
- define_attribute :entity_use_code, String
52
-
53
45
  # @!attribute exemption_certificate
54
46
  # @return [String] The tax exemption certificate number for the account. If the merchant has an integration for the Vertex tax provider, this optional value will be sent in any tax calculation requests for the account.
55
47
  define_attribute :exemption_certificate, String
@@ -78,10 +70,6 @@ module Recurly
78
70
  # @return [String] Used to determine the language and locale of emails sent on behalf of the merchant to the customer. The list of locales is restricted to those the merchant has enabled on the site.
79
71
  define_attribute :preferred_locale, String
80
72
 
81
- # @!attribute preferred_time_zone
82
- # @return [String] Used to determine the time zone of emails sent on behalf of the merchant to the customer. Must be a [supported IANA time zone name](https://docs.recurly.com/docs/email-time-zones-and-time-stamps#supported-api-iana-time-zone-names)
83
- define_attribute :preferred_time_zone, String
84
-
85
73
  # @!attribute tax_exempt
86
74
  # @return [Boolean] The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account.
87
75
  define_attribute :tax_exempt, :Boolean
@@ -30,18 +30,10 @@ module Recurly
30
30
  # @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.
31
31
  define_attribute :custom_fields, Array, { :item_type => :CustomField }
32
32
 
33
- # @!attribute dunning_campaign_id
34
- # @return [String] Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used.
35
- define_attribute :dunning_campaign_id, String
36
-
37
33
  # @!attribute email
38
34
  # @return [String] The email address used for communicating with this customer. The customer will also use this email address to log into your hosted account management pages. This value does not need to be unique.
39
35
  define_attribute :email, String
40
36
 
41
- # @!attribute entity_use_code
42
- # @return [String] The Avalara AvaTax value that can be passed to identify the customer type for tax purposes. The range of values can be A - R (more info at Avalara). Value is case-sensitive.
43
- define_attribute :entity_use_code, String
44
-
45
37
  # @!attribute exemption_certificate
46
38
  # @return [String] The tax exemption certificate number for the account. If the merchant has an integration for the Vertex tax provider, this optional value will be sent in any tax calculation requests for the account.
47
39
  define_attribute :exemption_certificate, String
@@ -66,10 +58,6 @@ module Recurly
66
58
  # @return [String] Used to determine the language and locale of emails sent on behalf of the merchant to the customer. The list of locales is restricted to those the merchant has enabled on the site.
67
59
  define_attribute :preferred_locale, String
68
60
 
69
- # @!attribute preferred_time_zone
70
- # @return [String] Used to determine the time zone of emails sent on behalf of the merchant to the customer. Must be a [supported IANA time zone name](https://docs.recurly.com/docs/email-time-zones-and-time-stamps#supported-api-iana-time-zone-names)
71
- define_attribute :preferred_time_zone, String
72
-
73
61
  # @!attribute tax_exempt
74
62
  # @return [Boolean] The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account.
75
63
  define_attribute :tax_exempt, :Boolean
@@ -39,11 +39,11 @@ 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` feature is 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
46
- # @return [String] System-generated unique identifier for an item. Available when the `Credit Invoices` feature is enabled. If `item_id` and `item_code` are both present, `item_id` will be used.
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.
47
47
  define_attribute :item_id, String
48
48
 
49
49
  # @!attribute measured_unit_id
@@ -71,11 +71,11 @@ module Recurly
71
71
  define_attribute :revenue_schedule_type, String
72
72
 
73
73
  # @!attribute tax_code
74
- # @return [String] Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. If `item_code`/`item_id` is part of the request then `tax_code` must be absent.
74
+ # @return [String] Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If `item_code`/`item_id` is part of the request then `tax_code` must be absent.
75
75
  define_attribute :tax_code, String
76
76
 
77
77
  # @!attribute tier_type
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://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models.
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.
79
79
  define_attribute :tier_type, String
80
80
 
81
81
  # @!attribute tiers
@@ -87,7 +87,7 @@ module Recurly
87
87
  define_attribute :usage_percentage, Float
88
88
 
89
89
  # @!attribute usage_type
90
- # @return [String] Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons.
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
91
  define_attribute :usage_type, String
92
92
  end
93
93
  end
@@ -10,13 +10,13 @@ module Recurly
10
10
  # @return [String] 3-letter ISO 4217 currency code.
11
11
  define_attribute :currency, String
12
12
 
13
- # @!attribute tax_inclusive
14
- # @return [Boolean] This field is deprecated. Please do not use it.
15
- define_attribute :tax_inclusive, :Boolean
16
-
17
13
  # @!attribute unit_amount
18
- # @return [Float] Unit price
14
+ # @return [Float] Allows up to 2 decimal places. Required unless `unit_amount_decimal` is provided.
19
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
20
  end
21
21
  end
22
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. Must also be absent if `add_on_type` is `usage` and `usage_type` is `percentage`.
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,11 +55,11 @@ 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
62
- # @return [String] Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. If an `Item` is associated to the `AddOn` then `tax_code` must be absent.
62
+ # @return [String] Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If an `Item` is associated to the `AddOn` then `tax code` must be absent.
63
63
  define_attribute :tax_code, String
64
64
 
65
65
  # @!attribute tiers
@@ -11,21 +11,9 @@ module Recurly
11
11
  define_attribute :city, String
12
12
 
13
13
  # @!attribute country
14
- # @return [String] Country, 2-letter ISO 3166-1 alpha-2 code.
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 geo_code
22
- # @return [String] Code that represents a geographic entity (location or object). Only returned when Vertex or Avalara for Communications is enabled.
23
- define_attribute :geo_code, String
24
-
25
- # @!attribute last_name
26
- # @return [String] Last name
27
- define_attribute :last_name, String
28
-
29
17
  # @!attribute phone
30
18
  # @return [String] Phone number
31
19
  define_attribute :phone, String