recurly 3.28.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.bumpversion.cfg +1 -1
  3. data/.github/workflows/docs.yml +1 -1
  4. data/.github_changelog_generator +8 -0
  5. data/.travis.yml +13 -0
  6. data/CHANGELOG.md +202 -369
  7. data/CONTRIBUTING.md +0 -4
  8. data/GETTING_STARTED.md +20 -17
  9. data/README.md +0 -3
  10. data/lib/recurly/client/operations.rb +778 -659
  11. data/lib/recurly/client.rb +44 -28
  12. data/lib/recurly/errors/api_errors.rb +3 -2
  13. data/lib/recurly/errors.rb +5 -23
  14. data/lib/recurly/pager.rb +5 -15
  15. data/lib/recurly/requests/{account_acquisition_updatable.rb → account_acquisition_update.rb} +1 -1
  16. data/lib/recurly/requests/account_create.rb +2 -10
  17. data/lib/recurly/requests/account_purchase.rb +2 -10
  18. data/lib/recurly/requests/account_update.rb +0 -8
  19. data/lib/recurly/requests/add_on_create.rb +4 -4
  20. data/lib/recurly/requests/add_on_pricing.rb +5 -5
  21. data/lib/recurly/requests/add_on_update.rb +2 -2
  22. data/lib/recurly/requests/address.rb +1 -9
  23. data/lib/recurly/requests/billing_info_create.rb +3 -39
  24. data/lib/recurly/requests/coupon_create.rb +1 -1
  25. data/lib/recurly/requests/external_transaction.rb +1 -1
  26. data/lib/recurly/requests/invoice_address.rb +1 -1
  27. data/lib/recurly/requests/invoice_collect.rb +1 -1
  28. data/lib/recurly/requests/{invoice_updatable.rb → invoice_update.rb} +1 -1
  29. data/lib/recurly/requests/line_item_create.rb +2 -10
  30. data/lib/recurly/requests/line_item_refund.rb +0 -4
  31. data/lib/recurly/requests/plan_create.rb +0 -16
  32. data/lib/recurly/requests/plan_pricing.rb +1 -5
  33. data/lib/recurly/requests/plan_update.rb +0 -12
  34. data/lib/recurly/requests/pricing.rb +0 -4
  35. data/lib/recurly/requests/purchase_create.rb +1 -1
  36. data/lib/recurly/requests/shipping_address_create.rb +1 -1
  37. data/lib/recurly/requests/shipping_address_update.rb +1 -1
  38. data/lib/recurly/requests/subscription_add_on_create.rb +8 -4
  39. data/lib/recurly/requests/subscription_add_on_tier.rb +5 -1
  40. data/lib/recurly/requests/subscription_add_on_update.rb +6 -2
  41. data/lib/recurly/requests/subscription_change_create.rb +1 -13
  42. data/lib/recurly/requests/subscription_create.rb +5 -13
  43. data/lib/recurly/requests/subscription_pause.rb +1 -1
  44. data/lib/recurly/requests/subscription_purchase.rb +2 -10
  45. data/lib/recurly/requests/subscription_update.rb +1 -5
  46. data/lib/recurly/requests/tier.rb +2 -2
  47. data/lib/recurly/requests/{plan_ramp_pricing.rb → tier_pricing.rb} +6 -2
  48. data/lib/recurly/requests/usage_create.rb +1 -1
  49. data/lib/recurly/resources/account.rb +0 -8
  50. data/lib/recurly/resources/account_balance_amount.rb +0 -8
  51. data/lib/recurly/resources/account_mini.rb +0 -4
  52. data/lib/recurly/resources/add_on.rb +1 -1
  53. data/lib/recurly/resources/add_on_pricing.rb +5 -5
  54. data/lib/recurly/resources/address.rb +1 -9
  55. data/lib/recurly/resources/address_with_name.rb +46 -0
  56. data/lib/recurly/resources/billing_info.rb +1 -5
  57. data/lib/recurly/resources/billing_info_updated_by.rb +1 -1
  58. data/lib/recurly/resources/coupon.rb +5 -17
  59. data/lib/recurly/resources/custom_field_definition.rb +1 -1
  60. data/lib/recurly/resources/invoice.rb +8 -12
  61. data/lib/recurly/resources/invoice_address.rb +1 -1
  62. data/lib/recurly/resources/line_item.rb +7 -23
  63. data/lib/recurly/resources/payment_method.rb +0 -8
  64. data/lib/recurly/resources/plan.rb +1 -17
  65. data/lib/recurly/resources/plan_pricing.rb +1 -5
  66. data/lib/recurly/resources/pricing.rb +0 -4
  67. data/lib/recurly/resources/shipping_address.rb +1 -1
  68. data/lib/recurly/resources/subscription.rb +0 -12
  69. data/lib/recurly/resources/subscription_add_on.rb +6 -2
  70. data/lib/recurly/resources/subscription_add_on_tier.rb +5 -1
  71. data/lib/recurly/resources/subscription_change.rb +0 -16
  72. data/lib/recurly/resources/tax_info.rb +3 -7
  73. data/lib/recurly/resources/tier.rb +2 -2
  74. data/lib/recurly/resources/{plan_ramp_pricing.rb → tier_pricing.rb} +6 -2
  75. data/lib/recurly/resources/transaction.rb +3 -7
  76. data/lib/recurly/resources/unique_coupon_code_params.rb +26 -0
  77. data/lib/recurly/resources/usage.rb +6 -2
  78. data/lib/recurly/version.rb +1 -1
  79. data/openapi/api.yaml +2030 -3058
  80. data/scripts/build +2 -2
  81. data/scripts/bump +11 -0
  82. data/scripts/changelog +14 -0
  83. data/scripts/format +2 -2
  84. data/scripts/prepare-release +29 -43
  85. data/scripts/release +20 -5
  86. metadata +16 -31
  87. data/.changelog_config.yaml +0 -11
  88. data/.github/workflows/ci.yml +0 -29
  89. data/CODE_OF_CONDUCT.md +0 -130
  90. data/lib/recurly/errors/network_errors.rb +0 -10
  91. data/lib/recurly/requests/billing_info_verify.rb +0 -14
  92. data/lib/recurly/requests/dunning_campaigns_bulk_update.rb +0 -18
  93. data/lib/recurly/requests/gateway_attributes.rb +0 -14
  94. data/lib/recurly/requests/plan_ramp_interval.rb +0 -18
  95. data/lib/recurly/requests/subscription_change_billing_info_create.rb +0 -14
  96. data/lib/recurly/requests/subscription_ramp_interval.rb +0 -18
  97. data/lib/recurly/resources/dunning_campaign.rb +0 -50
  98. data/lib/recurly/resources/dunning_campaigns_bulk_update_response.rb +0 -18
  99. data/lib/recurly/resources/dunning_cycle.rb +0 -58
  100. data/lib/recurly/resources/dunning_interval.rb +0 -18
  101. data/lib/recurly/resources/gateway_attributes.rb +0 -14
  102. data/lib/recurly/resources/line_item_list.rb +0 -26
  103. data/lib/recurly/resources/plan_ramp_interval.rb +0 -18
  104. data/lib/recurly/resources/subscription_change_billing_info.rb +0 -14
  105. data/lib/recurly/resources/subscription_change_preview.rb +0 -90
  106. data/lib/recurly/resources/subscription_ramp_interval_response.rb +0 -22
  107. 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",
@@ -28,12 +29,12 @@ module Recurly
28
29
 
29
30
  class ServiceNotAvailableError < InternalServerError; end
30
31
 
31
- class TaxServiceError < InternalServerError; end
32
-
33
32
  class BadGatewayError < ServerError; end
34
33
 
35
34
  class ServiceUnavailableError < ServerError; end
36
35
 
36
+ class TimeoutError < ServerError; end
37
+
37
38
  class RedirectionError < ResponseError; end
38
39
 
39
40
  class NotModifiedError < ResponseError; 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,10 +38,6 @@ 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
@@ -70,10 +66,6 @@ module Recurly
70
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.
71
67
  define_attribute :preferred_locale, String
72
68
 
73
- # @!attribute preferred_time_zone
74
- # @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)
75
- define_attribute :preferred_time_zone, String
76
-
77
69
  # @!attribute shipping_addresses
78
70
  # @return [Array[ShippingAddressCreate]]
79
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,10 +38,6 @@ 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
@@ -74,10 +70,6 @@ module Recurly
74
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.
75
71
  define_attribute :preferred_locale, String
76
72
 
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
73
  # @!attribute tax_exempt
82
74
  # @return [Boolean] The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account.
83
75
  define_attribute :tax_exempt, :Boolean
@@ -30,10 +30,6 @@ 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
@@ -62,10 +58,6 @@ module Recurly
62
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.
63
59
  define_attribute :preferred_locale, String
64
60
 
65
- # @!attribute preferred_time_zone
66
- # @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)
67
- define_attribute :preferred_time_zone, String
68
-
69
61
  # @!attribute tax_exempt
70
62
  # @return [Boolean] The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account.
71
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
@@ -75,7 +75,7 @@ module Recurly
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,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
@@ -11,17 +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 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
@@ -22,18 +14,10 @@ module Recurly
22
14
  # @return [String] Amazon billing agreement ID
23
15
  define_attribute :amazon_billing_agreement_id, String
24
16
 
25
- # @!attribute backup_payment_method
26
- # @return [Boolean] The `backup_payment_method` field is used to designate a billing info as a backup on the account that will be tried if the initial billing info used for an invoice is declined. All payment methods, including the billing info marked `primary_payment_method` can be set as a backup. An account can have a maximum of 1 backup, if a user sets a different payment method as a backup, the existing backup will no longer be marked as such.
27
- define_attribute :backup_payment_method, :Boolean
28
-
29
17
  # @!attribute company
30
18
  # @return [String] Company name
31
19
  define_attribute :company, String
32
20
 
33
- # @!attribute currency
34
- # @return [String] 3-letter ISO 4217 currency code.
35
- define_attribute :currency, String
36
-
37
21
  # @!attribute cvv
38
22
  # @return [String] *STRONGLY RECOMMENDED*
39
23
  define_attribute :cvv, String
@@ -46,10 +30,6 @@ module Recurly
46
30
  # @return [String] Fraud Session ID
47
31
  define_attribute :fraud_session_id, String
48
32
 
49
- # @!attribute gateway_attributes
50
- # @return [GatewayAttributes] Additional attributes to send to the gateway.
51
- define_attribute :gateway_attributes, :GatewayAttributes
52
-
53
33
  # @!attribute gateway_code
54
34
  # @return [String] An identifier for a specific payment gateway. Must be used in conjunction with `gateway_token`.
55
35
  define_attribute :gateway_code, String
@@ -59,7 +39,7 @@ module Recurly
59
39
  define_attribute :gateway_token, String
60
40
 
61
41
  # @!attribute iban
62
- # @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
63
43
  define_attribute :iban, String
64
44
 
65
45
  # @!attribute ip_address
@@ -74,10 +54,6 @@ module Recurly
74
54
  # @return [String] Expiration month
75
55
  define_attribute :month, String
76
56
 
77
- # @!attribute name_on_account
78
- # @return [String] The name associated with the bank account (ACH, SEPA, Bacs only)
79
- define_attribute :name_on_account, String
80
-
81
57
  # @!attribute number
82
58
  # @return [String] Credit card number, spaces and dashes are accepted.
83
59
  define_attribute :number, String
@@ -87,17 +63,9 @@ module Recurly
87
63
  define_attribute :paypal_billing_agreement_id, String
88
64
 
89
65
  # @!attribute primary_payment_method
90
- # @return [Boolean] The `primary_payment_method` field 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` with a value of `true`. When adding billing infos via the billing_info and /accounts endpoints, this value is not permitted, and will return an error if provided.
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.
91
67
  define_attribute :primary_payment_method, :Boolean
92
68
 
93
- # @!attribute routing_number
94
- # @return [String] The bank's rounting number. (ACH only)
95
- define_attribute :routing_number, String
96
-
97
- # @!attribute sort_code
98
- # @return [String] Bank identifier code for UK based banks. Required for Bacs based billing infos. (Bacs only)
99
- define_attribute :sort_code, String
100
-
101
69
  # @!attribute tax_identifier
102
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.
103
71
  define_attribute :tax_identifier, String
@@ -111,17 +79,13 @@ module Recurly
111
79
  define_attribute :three_d_secure_action_result_token_id, String
112
80
 
113
81
  # @!attribute token_id
114
- # @return [String] A token [generated by Recurly.js](https://recurly.com/developers/reference/recurly-js/#getting-a-token).
82
+ # @return [String] A token [generated by Recurly.js](https://developers.recurly.com/reference/recurly-js/#getting-a-token).
115
83
  define_attribute :token_id, String
116
84
 
117
85
  # @!attribute transaction_type
118
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.
119
87
  define_attribute :transaction_type, String
120
88
 
121
- # @!attribute type
122
- # @return [String] The payment method type for a non-credit card based billing info. `bacs` and `becs` are the only accepted values.
123
- define_attribute :type, String
124
-
125
89
  # @!attribute vat_number
126
90
  # @return [String] VAT number
127
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
@@ -15,7 +15,7 @@ module Recurly
15
15
  define_attribute :company, String
16
16
 
17
17
  # @!attribute country
18
- # @return [String] Country, 2-letter ISO 3166-1 alpha-2 code.
18
+ # @return [String] Country, 2-letter ISO code.
19
19
  define_attribute :country, String
20
20
 
21
21
  # @!attribute first_name
@@ -7,7 +7,7 @@ module Recurly
7
7
  class InvoiceCollect < Request
8
8
 
9
9
  # @!attribute billing_info_id
10
- # @return [String] The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature.
10
+ # @return [String] The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info.
11
11
  define_attribute :billing_info_id, String
12
12
 
13
13
  # @!attribute three_d_secure_action_result_token_id
@@ -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]