recurly 3.0.0.beta.5 → 3.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 (71) hide show
  1. checksums.yaml +5 -5
  2. data/.bumpversion.cfg +12 -0
  3. data/.travis.yml +2 -2
  4. data/.yardopts +3 -0
  5. data/CONTRIBUTING.md +102 -0
  6. data/GETTING_STARTED.md +266 -0
  7. data/README.md +12 -194
  8. data/benchmark.rb +16 -0
  9. data/lib/recurly.rb +4 -7
  10. data/lib/recurly/client.rb +60 -60
  11. data/lib/recurly/client/operations.rb +498 -340
  12. data/lib/recurly/errors.rb +4 -0
  13. data/lib/recurly/http.rb +43 -0
  14. data/lib/recurly/pager.rb +4 -10
  15. data/lib/recurly/request.rb +6 -6
  16. data/lib/recurly/requests.rb +8 -0
  17. data/lib/recurly/requests/account_acquisition_updatable.rb +2 -2
  18. data/lib/recurly/requests/billing_info_create.rb +4 -0
  19. data/lib/recurly/requests/custom_field.rb +18 -0
  20. data/lib/recurly/requests/invoice_create.rb +0 -4
  21. data/lib/recurly/requests/invoice_refund.rb +2 -2
  22. data/lib/recurly/requests/line_item_create.rb +4 -0
  23. data/lib/recurly/requests/purchase_create.rb +3 -7
  24. data/lib/recurly/requests/shipping_fee_create.rb +22 -0
  25. data/lib/recurly/requests/shipping_purchase.rb +22 -0
  26. data/lib/recurly/requests/subscription_add_on_create.rb +2 -6
  27. data/lib/recurly/requests/subscription_add_on_update.rb +26 -0
  28. data/lib/recurly/requests/subscription_change_create.rb +7 -3
  29. data/lib/recurly/requests/subscription_change_shipping_create.rb +22 -0
  30. data/lib/recurly/requests/subscription_create.rb +4 -8
  31. data/lib/recurly/requests/subscription_shipping_create.rb +30 -0
  32. data/lib/recurly/requests/subscription_shipping_update.rb +22 -0
  33. data/lib/recurly/requests/subscription_update.rb +3 -7
  34. data/lib/recurly/resource.rb +14 -1
  35. data/lib/recurly/resources.rb +17 -0
  36. data/lib/recurly/resources/account_acquisition.rb +2 -2
  37. data/lib/recurly/resources/add_on.rb +1 -1
  38. data/lib/recurly/resources/billing_info.rb +6 -6
  39. data/lib/recurly/resources/coupon.rb +1 -1
  40. data/lib/recurly/resources/coupon_discount.rb +2 -2
  41. data/lib/recurly/resources/coupon_redemption.rb +2 -2
  42. data/lib/recurly/resources/coupon_redemption_mini.rb +2 -2
  43. data/lib/recurly/resources/error_may_have_transaction.rb +2 -2
  44. data/lib/recurly/resources/invoice.rb +4 -0
  45. data/lib/recurly/resources/line_item.rb +1 -1
  46. data/lib/recurly/resources/{billing_info_payment_method.rb → payment_method.rb} +18 -2
  47. data/lib/recurly/resources/plan.rb +1 -1
  48. data/lib/recurly/resources/shipping_method.rb +42 -0
  49. data/lib/recurly/resources/shipping_method_mini.rb +26 -0
  50. data/lib/recurly/resources/subscription.rb +3 -3
  51. data/lib/recurly/resources/subscription_change.rb +4 -0
  52. data/lib/recurly/resources/subscription_shipping.rb +26 -0
  53. data/lib/recurly/resources/transaction.rb +4 -4
  54. data/lib/recurly/resources/transaction_error.rb +30 -0
  55. data/lib/recurly/schema.rb +85 -49
  56. data/lib/recurly/schema/json_parser.rb +16 -8
  57. data/lib/recurly/schema/request_caster.rb +10 -16
  58. data/lib/recurly/schema/resource_caster.rb +48 -0
  59. data/lib/recurly/schema/schema_factory.rb +0 -2
  60. data/lib/recurly/schema/schema_validator.rb +11 -14
  61. data/lib/recurly/version.rb +1 -1
  62. data/recurly.gemspec +6 -6
  63. data/scripts/build +1 -0
  64. data/scripts/bump +4 -0
  65. data/scripts/format +2 -0
  66. data/scripts/release +11 -0
  67. data/scripts/test +1 -0
  68. metadata +38 -20
  69. data/.ruby-version +0 -1
  70. data/lib/recurly/resources/transaction_payment_method.rb +0 -34
  71. data/lib/recurly/schema/json_deserializer.rb +0 -56
@@ -0,0 +1,16 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+ require "recurly"
4
+ require "benchmark"
5
+
6
+ N = 1_000
7
+
8
+ account_body = "{\"id\":\"ljvmmbjchtgs\",\"object\":\"account\",\"code\":\"9ebd49f7288@example.com\",\"parent_account_id\":null,\"bill_to\":\"self\",\"state\":\"active\",\"username\":null,\"email\":null,\"cc_emails\":null,\"preferred_locale\":null,\"first_name\":\"Benjamin\",\"last_name\":\"Du Monde\",\"company\":null,\"vat_number\":null,\"tax_exempt\":false,\"exemption_certificate\":null,\"address\":null,\"billing_info\":null,\"shipping_addresses\":[{\"object\":\"shipping_address\",\"first_name\":\"Benjamin\",\"last_name\":\"Du Monde\",\"company\":null,\"phone\":null,\"street1\":\"1 Tchoupitoulas St\",\"street2\":null,\"city\":\"New Orleans\",\"region\":\"LA\",\"postal_code\":\"70115\",\"country\":\"US\",\"nickname\":\"Home\",\"email\":null,\"vat_number\":null,\"id\":\"ljvmmbk9e1as\",\"account_id\":\"ljvmmbjchtgs\",\"created_at\":\"2019-09-19T22:45:59Z\",\"updated_at\":\"2019-09-19T22:45:59Z\"}],\"custom_fields\":[],\"hosted_login_token\":\"PSvcHow5H4HGEGKTfHXadLNoDcRaDVMK\",\"created_at\":\"2019-09-19T22:45:59Z\",\"updated_at\":\"2019-09-19T22:45:59Z\",\"deleted_at\":null}"
9
+
10
+ Benchmark.bm do |benchmark|
11
+ benchmark.report("JSON parsing and casting\n") do
12
+ N.times do
13
+ _account = Recurly::JSONParser.parse(nil, account_body)
14
+ end
15
+ end
16
+ end
@@ -3,17 +3,14 @@ require "recurly/schema"
3
3
  require "recurly/request"
4
4
  require "recurly/resource"
5
5
  require "recurly/pager"
6
- # Include all request files
7
- resources = File.join(File.dirname(__FILE__), "recurly", "requests", "*.rb")
8
- Dir.glob(resources, &method(:require))
9
- # Include all resource files
10
- resources = File.join(File.dirname(__FILE__), "recurly", "resources", "*.rb")
11
- Dir.glob(resources, &method(:require))
6
+ require "recurly/requests"
7
+ require "recurly/resources"
8
+ require "recurly/http"
12
9
  require "recurly/errors"
13
10
  require "recurly/client"
14
11
 
15
12
  module Recurly
16
- STRICT_MODE = !ENV["RECURLY_STRICT_MODE"].nil?
13
+ STRICT_MODE = ENV["RECURLY_STRICT_MODE"] && ENV["RECURLY_STRICT_MODE"].downcase == "true"
17
14
  if STRICT_MODE
18
15
  puts "[Recurly] [WARNING] STRICT_MODE enabled. This should only be used for testing purposes."
19
16
  end
@@ -8,49 +8,30 @@ module Recurly
8
8
  class Client
9
9
  require_relative "./client/operations"
10
10
 
11
- BASE_URL = "https://partner-api.recurly.com/"
12
-
13
- # The last result of the *X-RateLimit-Limit* header
14
- # @return [Integer] The rate limit applied to this client.
15
- attr_reader :rate_limit
16
-
17
- # The last result of the *X-RateLimit-Remaining* header
18
- # @return [Integer] The number of remaining requests, decrements per request.
19
- attr_reader :rate_limit_remaining
20
-
21
- # The last result of the *X-RateLimit-Reset* header
22
- # @return [DateTime] The DateTime in which the request count will be reset.
23
- attr_reader :rate_limit_reset
11
+ BASE_URL = "https://v3.recurly.com/"
24
12
 
25
13
  # Initialize a client. It requires an API key.
26
14
  #
27
15
  # @example
28
16
  # API_KEY = '83749879bbde395b5fe0cc1a5abf8e5'
29
- # SITE_ID = 'dqzlv9shi7wa'
30
- # client = Recurly::Client.new(site_id: SITE_ID, api_key: API_KEY)
31
- # # You can optionally use the subdomain instead of the site id
32
- # client = Recurly::Client.new(subdomain: 'mysite-prod', api_key: API_KEY)
17
+ # client = Recurly::Client.new(api_key: API_KEY)
33
18
  # sub = client.get_subscription(subscription_id: 'abcd123456')
34
19
  # @example
35
20
  # # You can also pass the initializer a block. This will give you
36
21
  # # a client scoped for just that block
37
- # Recurly::Client.new(subdomain: 'mysite-prod', api_key: API_KEY) do |client|
22
+ # Recurly::Client.new(api_key: API_KEY) do |client|
38
23
  # sub = client.get_subscription(subscription_id: 'abcd123456')
39
24
  # end
40
25
  # @example
41
26
  # # If you only plan on using the client for more than one site,
42
27
  # # you should initialize a new client for each site.
43
28
  #
44
- # # Give a `site_id`
45
- # client = Recurly::Client.new(api_key: API_KEY, site_id: SITE_ID)
46
- # # Or use the subdomain
47
- # client = Recurly::Client.new(api_key: API_KEY, subdomain: 'mysite-dev')
48
- #
49
- # sub = client.get_subscription(subscription_id: 'abcd123456')
29
+ # client = Recurly::Client.new(api_key: API_KEY1)
30
+ # sub = client.get_subscription(subscription_id: 'uuid-abcd123456')
50
31
  #
51
32
  # # you should create a new client to connect to another site
52
- # client = Recurly::Client.new(api_key: API_KEY, subdomain: 'mysite-prod')
53
- # sub = client.get_subscription(subscription_id: 'abcd7890')
33
+ # client = Recurly::Client.new(api_key: API_KEY2)
34
+ # sub = client.get_subscription(subscription_id: 'uuid-abcd7890')
54
35
  #
55
36
  # @param api_key [String] The private API key
56
37
  # @param site_id [String] The site you wish to be scoped to.
@@ -65,57 +46,60 @@ module Recurly
65
46
  end
66
47
 
67
48
  def next_page(pager)
68
- run_request(:get, pager.next, nil, headers).tap do |response|
69
- raise_api_error!(response) unless (200...300).include?(response.status)
70
- end
49
+ req = HTTP::Request.new(:get, pager.next, nil)
50
+ faraday_resp = run_request(req, headers)
51
+ handle_response! req, faraday_resp
71
52
  end
72
53
 
73
54
  protected
74
55
 
75
56
  def pager(path, **options)
76
- Pager.new(client: self, path: path, options: options)
57
+ path = scope_by_site(path, **options)
58
+ Pager.new(
59
+ client: self,
60
+ path: path,
61
+ options: options,
62
+ )
77
63
  end
78
64
 
79
65
  def get(path, **options)
80
- response = run_request(:get, path, nil, headers)
81
- raise_api_error!(response) unless (200...300).include?(response.status)
82
- JSONParser.parse(self, response.body)
66
+ path = scope_by_site(path, **options)
67
+ request = HTTP::Request.new(:get, path, nil)
68
+ faraday_resp = run_request(request, headers)
69
+ handle_response! request, faraday_resp
83
70
  rescue Faraday::ClientError => ex
84
71
  raise_network_error!(ex)
85
72
  end
86
73
 
87
74
  def post(path, request_data, request_class, **options)
88
- request = request_class.new(request_data)
89
- request.validate!
90
- logger.info("POST BODY #{JSON.dump(request_data)}")
91
- response = run_request(:post, path, JSON.dump(request.attributes), headers)
92
- raise_api_error!(response) unless (200...300).include?(response.status)
93
- JSONParser.parse(self, response.body)
75
+ request_class.new(request_data).validate!
76
+ path = scope_by_site(path, **options)
77
+ request = HTTP::Request.new(:post, path, JSON.dump(request_data))
78
+ faraday_resp = run_request(request, headers)
79
+ handle_response! request, faraday_resp
94
80
  rescue Faraday::ClientError => ex
95
81
  raise_network_error!(ex)
96
82
  end
97
83
 
98
84
  def put(path, request_data = nil, request_class = nil, **options)
99
- response = if request_data
100
- request = request_class.new(request_data)
101
- request.validate!
102
- logger.info("PUT BODY #{JSON.dump(request_data)}")
103
- run_request(:put, path, JSON.dump(request_data), headers)
104
- else
105
- run_request(:put, path, nil, headers)
106
- end
107
- raise_api_error!(response) unless (200...300).include?(response.status)
108
- JSONParser.parse(self, response.body)
85
+ path = scope_by_site(path, **options)
86
+ request = HTTP::Request.new(:put, path)
87
+ if request_data
88
+ request_class.new(request_data).validate!
89
+ logger.info("PUT BODY #{JSON.dump(request_data)}")
90
+ request.body = JSON.dump(request_data)
91
+ end
92
+ faraday_resp = run_request(request, headers)
93
+ handle_response! request, faraday_resp
109
94
  rescue Faraday::ClientError => ex
110
95
  raise_network_error!(ex)
111
96
  end
112
97
 
113
98
  def delete(path, **options)
114
- response = run_request(:delete, path, nil, headers)
115
- raise_api_error!(response) unless (200...300).include?(response.status)
116
- if response.body && !response.body.empty?
117
- JSONParser.parse(self, response.body)
118
- end
99
+ path = scope_by_site(path, **options)
100
+ request = HTTP::Request.new(:delete, path, nil)
101
+ faraday_resp = run_request(request, headers)
102
+ handle_response! request, faraday_resp
119
103
  rescue Faraday::ClientError => ex
120
104
  raise_network_error!(ex)
121
105
  end
@@ -130,8 +114,21 @@ module Recurly
130
114
  # @return [Logger]
131
115
  attr_reader :logger
132
116
 
133
- def run_request(method, url, body, headers)
134
- read_headers @conn.run_request(method, url, body, headers)
117
+ def run_request(request, headers)
118
+ read_headers @conn.run_request(request.method, request.path, request.body, headers)
119
+ end
120
+
121
+ def handle_response!(request, faraday_resp)
122
+ response = HTTP::Response.new(faraday_resp, request)
123
+ raise_api_error!(response) unless (200...300).include?(response.status)
124
+ resource = if response.body
125
+ JSONParser.parse(self, response.body)
126
+ else
127
+ Resources::Empty.new
128
+ end
129
+ # Keep this interface "private"
130
+ resource.instance_variable_set(:@response, response)
131
+ resource
135
132
  end
136
133
 
137
134
  def raise_network_error!(ex)
@@ -156,9 +153,6 @@ module Recurly
156
153
  end
157
154
 
158
155
  def read_headers(response)
159
- @rate_limit = response.headers["x-ratelimit-limit"].to_i
160
- @rate_limit_remaining = response.headers["x-ratelimit-remaining"].to_i
161
- @rate_limit_reset = Time.at(response.headers["x-ratelimit-reset"].to_i).to_datetime
162
156
  if !@_ignore_deprecation_warning && response.headers["Recurly-Deprecated"]&.upcase == "TRUE"
163
157
  puts "[recurly-client-ruby] WARNING: Your current API version \"#{api_version}\" is deprecated and will be sunset on #{response.headers["Recurly-Sunset-Date"]}"
164
158
  end
@@ -196,8 +190,14 @@ module Recurly
196
190
  @site_id = site_id
197
191
  elsif subdomain
198
192
  @site_id = "subdomain-#{subdomain}"
193
+ end
194
+ end
195
+
196
+ def scope_by_site(path, **options)
197
+ if site = site_id || options[:site_id]
198
+ "/sites/#{site}#{path}"
199
199
  else
200
- raise ArgumentError, "You must pass a site_id or subdomain argument to initialize the Client"
200
+ path
201
201
  end
202
202
  end
203
203
 
@@ -5,14 +5,14 @@
5
5
  module Recurly
6
6
  class Client
7
7
  def api_version
8
- "v2018-08-09"
8
+ "v2019-10-10"
9
9
  end
10
10
 
11
11
  # List sites
12
12
  #
13
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_sites list_sites api documenation}
13
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_sites list_sites api documenation}
14
14
  #
15
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
15
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
16
16
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
17
17
  #
18
18
  # *Important notes:*
@@ -44,19 +44,20 @@ module Recurly
44
44
 
45
45
  # Fetch a site
46
46
  #
47
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_site get_site api documenation}
47
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_site get_site api documenation}
48
48
  #
49
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
49
50
  # @return [Resources::Site] A site.
50
- def get_site()
51
+ def get_site(site_id:)
51
52
  path = interpolate_path("/sites/{site_id}", site_id: site_id)
52
53
  get(path)
53
54
  end
54
55
 
55
56
  # List a site's accounts
56
57
  #
57
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_accounts list_accounts api documenation}
58
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_accounts list_accounts api documenation}
58
59
  #
59
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
60
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
60
61
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
61
62
  #
62
63
  # *Important notes:*
@@ -80,10 +81,12 @@ module Recurly
80
81
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
81
82
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
82
83
  #
83
- # @param subscriber [String] Filter accounts accounts with or without a subscription in the +active+,
84
+ # @param email [String] Filter for accounts with this exact email address. A blank value will return accounts with both +null+ and +""+ email addresses. Note that multiple accounts can share one email address.
85
+ # @param subscriber [Boolean] Filter for accounts with or without a subscription in the +active+,
84
86
  # +canceled+, or +future+ state.
85
87
  #
86
88
  # @param past_due [String] Filter for accounts with an invoice in the +past_due+ state.
89
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
87
90
  # @return [Pager<Resources::Account>] A list of the site's accounts.
88
91
  # @example
89
92
  # accounts = @client.list_accounts(limit: 200)
@@ -92,15 +95,16 @@ module Recurly
92
95
  # end
93
96
  #
94
97
  def list_accounts(**options)
95
- path = interpolate_path("/sites/{site_id}/accounts", site_id: site_id)
98
+ path = interpolate_path("/accounts")
96
99
  pager(path, **options)
97
100
  end
98
101
 
99
102
  # Create an account
100
103
  #
101
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_account create_account api documenation}
104
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_account create_account api documenation}
102
105
  #
103
106
  # @param body [Requests::AccountCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AccountCreate}
107
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
104
108
  # @return [Resources::Account] An account.
105
109
  # @example
106
110
  # begin
@@ -138,16 +142,17 @@ module Recurly
138
142
  # puts "ValidationError: #{e.recurly_error.params}"
139
143
  # end
140
144
  #
141
- def create_account(body:)
142
- path = interpolate_path("/sites/{site_id}/accounts", site_id: site_id)
143
- post(path, body, Requests::AccountCreate)
145
+ def create_account(body:, **options)
146
+ path = interpolate_path("/accounts")
147
+ post(path, body, Requests::AccountCreate, **options)
144
148
  end
145
149
 
146
150
  # Fetch an account
147
151
  #
148
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_account get_account api documenation}
152
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_account get_account api documenation}
149
153
  #
150
154
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
155
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
151
156
  # @return [Resources::Account] An account.
152
157
  # @example
153
158
  # begin
@@ -159,17 +164,18 @@ module Recurly
159
164
  # puts "Resource Not Found"
160
165
  # end
161
166
  #
162
- def get_account(account_id:)
163
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}", site_id: site_id, account_id: account_id)
164
- get(path)
167
+ def get_account(account_id:, **options)
168
+ path = interpolate_path("/accounts/{account_id}", account_id: account_id)
169
+ get(path, **options)
165
170
  end
166
171
 
167
172
  # Modify an account
168
173
  #
169
- # {https://partner-docs.recurly.com/v2018-08-09#operation/update_account update_account api documenation}
174
+ # {https://developers.recurly.com/api/v2019-10-10#operation/update_account update_account api documenation}
170
175
  #
171
176
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
172
177
  # @param body [Requests::AccountUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AccountUpdate}
178
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
173
179
  # @return [Resources::Account] An account.
174
180
  # @example
175
181
  # begin
@@ -188,16 +194,17 @@ module Recurly
188
194
  # puts "ValidationError: #{e.recurly_error.params}"
189
195
  # end
190
196
  #
191
- def update_account(account_id:, body:)
192
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}", site_id: site_id, account_id: account_id)
193
- put(path, body, Requests::AccountUpdate)
197
+ def update_account(account_id:, body:, **options)
198
+ path = interpolate_path("/accounts/{account_id}", account_id: account_id)
199
+ put(path, body, Requests::AccountUpdate, **options)
194
200
  end
195
201
 
196
202
  # Deactivate an account
197
203
  #
198
- # {https://partner-docs.recurly.com/v2018-08-09#operation/deactivate_account deactivate_account api documenation}
204
+ # {https://developers.recurly.com/api/v2019-10-10#operation/deactivate_account deactivate_account api documenation}
199
205
  #
200
206
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
207
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
201
208
  # @return [Resources::Account] An account.
202
209
  # @example
203
210
  # begin
@@ -209,16 +216,17 @@ module Recurly
209
216
  # puts "Resource Not Found"
210
217
  # end
211
218
  #
212
- def deactivate_account(account_id:)
213
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}", site_id: site_id, account_id: account_id)
214
- delete(path)
219
+ def deactivate_account(account_id:, **options)
220
+ path = interpolate_path("/accounts/{account_id}", account_id: account_id)
221
+ delete(path, **options)
215
222
  end
216
223
 
217
224
  # Fetch an account's acquisition data
218
225
  #
219
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_account_acquisition get_account_acquisition api documenation}
226
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_account_acquisition get_account_acquisition api documenation}
220
227
  #
221
228
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
229
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
222
230
  # @return [Resources::AccountAcquisition] An account's acquisition data.
223
231
  # @example
224
232
  # begin
@@ -230,28 +238,31 @@ module Recurly
230
238
  # puts "Resource Not Found"
231
239
  # end
232
240
  #
233
- def get_account_acquisition(account_id:)
234
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/acquisition", site_id: site_id, account_id: account_id)
235
- get(path)
241
+ def get_account_acquisition(account_id:, **options)
242
+ path = interpolate_path("/accounts/{account_id}/acquisition", account_id: account_id)
243
+ get(path, **options)
236
244
  end
237
245
 
238
246
  # Update an account's acquisition data
239
247
  #
240
- # {https://partner-docs.recurly.com/v2018-08-09#operation/update_account_acquisition update_account_acquisition api documenation}
248
+ # {https://developers.recurly.com/api/v2019-10-10#operation/update_account_acquisition update_account_acquisition api documenation}
241
249
  #
242
250
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
243
251
  # @param body [Requests::AccountAcquisitionUpdatable] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AccountAcquisitionUpdatable}
252
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
244
253
  # @return [Resources::AccountAcquisition] An account's updated acquisition data.
245
- def update_account_acquisition(account_id:, body:)
246
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/acquisition", site_id: site_id, account_id: account_id)
247
- put(path, body, Requests::AccountAcquisitionUpdatable)
254
+ def update_account_acquisition(account_id:, body:, **options)
255
+ path = interpolate_path("/accounts/{account_id}/acquisition", account_id: account_id)
256
+ put(path, body, Requests::AccountAcquisitionUpdatable, **options)
248
257
  end
249
258
 
250
259
  # Remove an account's acquisition data
251
260
  #
252
- # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_account_acquisition remove_account_acquisition api documenation}
261
+ # {https://developers.recurly.com/api/v2019-10-10#operation/remove_account_acquisition remove_account_acquisition api documenation}
253
262
  #
254
263
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
264
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
265
+ # @return [Empty] Acquisition data was succesfully deleted.
255
266
  # @example
256
267
  # begin
257
268
  # acquisition = @client.remove_account_acquisition(account_id: account_id)
@@ -262,16 +273,17 @@ module Recurly
262
273
  # puts "Resource Not Found"
263
274
  # end
264
275
  #
265
- def remove_account_acquisition(account_id:)
266
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/acquisition", site_id: site_id, account_id: account_id)
267
- delete(path)
276
+ def remove_account_acquisition(account_id:, **options)
277
+ path = interpolate_path("/accounts/{account_id}/acquisition", account_id: account_id)
278
+ delete(path, **options)
268
279
  end
269
280
 
270
281
  # Reactivate an inactive account
271
282
  #
272
- # {https://partner-docs.recurly.com/v2018-08-09#operation/reactivate_account reactivate_account api documenation}
283
+ # {https://developers.recurly.com/api/v2019-10-10#operation/reactivate_account reactivate_account api documenation}
273
284
  #
274
285
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
286
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
275
287
  # @return [Resources::Account] An account.
276
288
  # @example
277
289
  # begin
@@ -283,16 +295,17 @@ module Recurly
283
295
  # puts "Resource Not Found"
284
296
  # end
285
297
  #
286
- def reactivate_account(account_id:)
287
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/reactivate", site_id: site_id, account_id: account_id)
288
- put(path)
298
+ def reactivate_account(account_id:, **options)
299
+ path = interpolate_path("/accounts/{account_id}/reactivate", account_id: account_id)
300
+ put(path, **options)
289
301
  end
290
302
 
291
303
  # Fetch an account's balance and past due status
292
304
  #
293
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_account_balance get_account_balance api documenation}
305
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_account_balance get_account_balance api documenation}
294
306
  #
295
307
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
308
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
296
309
  # @return [Resources::AccountBalance] An account's balance.
297
310
  # @example
298
311
  # begin
@@ -304,16 +317,17 @@ module Recurly
304
317
  # puts "Resource Not Found"
305
318
  # end
306
319
  #
307
- def get_account_balance(account_id:)
308
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/balance", site_id: site_id, account_id: account_id)
309
- get(path)
320
+ def get_account_balance(account_id:, **options)
321
+ path = interpolate_path("/accounts/{account_id}/balance", account_id: account_id)
322
+ get(path, **options)
310
323
  end
311
324
 
312
325
  # Fetch an account's billing information
313
326
  #
314
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_billing_info get_billing_info api documenation}
327
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_billing_info get_billing_info api documenation}
315
328
  #
316
329
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
330
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
317
331
  # @return [Resources::BillingInfo] An account's billing information.
318
332
  # @example
319
333
  # begin
@@ -325,17 +339,18 @@ module Recurly
325
339
  # puts "Resource Not Found"
326
340
  # end
327
341
  #
328
- def get_billing_info(account_id:)
329
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/billing_info", site_id: site_id, account_id: account_id)
330
- get(path)
342
+ def get_billing_info(account_id:, **options)
343
+ path = interpolate_path("/accounts/{account_id}/billing_info", account_id: account_id)
344
+ get(path, **options)
331
345
  end
332
346
 
333
347
  # Set an account's billing information
334
348
  #
335
- # {https://partner-docs.recurly.com/v2018-08-09#operation/update_billing_info update_billing_info api documenation}
349
+ # {https://developers.recurly.com/api/v2019-10-10#operation/update_billing_info update_billing_info api documenation}
336
350
  #
337
351
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
338
352
  # @param body [Requests::BillingInfoCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::BillingInfoCreate}
353
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
339
354
  # @return [Resources::BillingInfo] Updated billing information.
340
355
  # @example
341
356
  # begin
@@ -354,16 +369,18 @@ module Recurly
354
369
  # puts "ValidationError: #{e.recurly_error.params}"
355
370
  # end
356
371
  #
357
- def update_billing_info(account_id:, body:)
358
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/billing_info", site_id: site_id, account_id: account_id)
359
- put(path, body, Requests::BillingInfoCreate)
372
+ def update_billing_info(account_id:, body:, **options)
373
+ path = interpolate_path("/accounts/{account_id}/billing_info", account_id: account_id)
374
+ put(path, body, Requests::BillingInfoCreate, **options)
360
375
  end
361
376
 
362
377
  # Remove an account's billing information
363
378
  #
364
- # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_billing_info remove_billing_info api documenation}
379
+ # {https://developers.recurly.com/api/v2019-10-10#operation/remove_billing_info remove_billing_info api documenation}
365
380
  #
366
381
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
382
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
383
+ # @return [Empty] Billing information deleted
367
384
  # @example
368
385
  # begin
369
386
  # @client.remove_billing_info(account_id: account_id)
@@ -374,17 +391,17 @@ module Recurly
374
391
  # puts "Resource Not Found"
375
392
  # end
376
393
  #
377
- def remove_billing_info(account_id:)
378
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/billing_info", site_id: site_id, account_id: account_id)
379
- delete(path)
394
+ def remove_billing_info(account_id:, **options)
395
+ path = interpolate_path("/accounts/{account_id}/billing_info", account_id: account_id)
396
+ delete(path, **options)
380
397
  end
381
398
 
382
399
  # Show the coupon redemptions for an account
383
400
  #
384
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_coupon_redemptions list_account_coupon_redemptions api documenation}
401
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_coupon_redemptions list_account_coupon_redemptions api documenation}
385
402
  #
386
403
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
387
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
404
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
388
405
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
389
406
  #
390
407
  # *Important notes:*
@@ -406,6 +423,7 @@ module Recurly
406
423
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
407
424
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
408
425
  #
426
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
409
427
  # @return [Pager<Resources::CouponRedemption>] A list of the the coupon redemptions on an account.
410
428
  # @example
411
429
  # redemptions = @client.list_account_coupon_redemptions(
@@ -417,15 +435,16 @@ module Recurly
417
435
  # end
418
436
  #
419
437
  def list_account_coupon_redemptions(account_id:, **options)
420
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/coupon_redemptions", site_id: site_id, account_id: account_id)
438
+ path = interpolate_path("/accounts/{account_id}/coupon_redemptions", account_id: account_id)
421
439
  pager(path, **options)
422
440
  end
423
441
 
424
442
  # Show the coupon redemption that is active on an account
425
443
  #
426
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_active_coupon_redemption get_active_coupon_redemption api documenation}
444
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_active_coupon_redemption get_active_coupon_redemption api documenation}
427
445
  #
428
446
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
447
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
429
448
  # @return [Resources::CouponRedemption] An active coupon redemption on an account.
430
449
  # @example
431
450
  # begin
@@ -437,17 +456,18 @@ module Recurly
437
456
  # puts "Resource Not Found"
438
457
  # end
439
458
  #
440
- def get_active_coupon_redemption(account_id:)
441
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/coupon_redemptions/active", site_id: site_id, account_id: account_id)
442
- get(path)
459
+ def get_active_coupon_redemption(account_id:, **options)
460
+ path = interpolate_path("/accounts/{account_id}/coupon_redemptions/active", account_id: account_id)
461
+ get(path, **options)
443
462
  end
444
463
 
445
464
  # Generate an active coupon redemption on an account
446
465
  #
447
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_coupon_redemption create_coupon_redemption api documenation}
466
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_coupon_redemption create_coupon_redemption api documenation}
448
467
  #
449
468
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
450
469
  # @param body [Requests::CouponRedemptionCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CouponRedemptionCreate}
470
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
451
471
  # @return [Resources::CouponRedemption] Returns the new coupon redemption.
452
472
  # @example
453
473
  # begin
@@ -466,16 +486,17 @@ module Recurly
466
486
  # puts "ValidationError: #{e.recurly_error.params}"
467
487
  # end
468
488
  #
469
- def create_coupon_redemption(account_id:, body:)
470
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/coupon_redemptions/active", site_id: site_id, account_id: account_id)
471
- post(path, body, Requests::CouponRedemptionCreate)
489
+ def create_coupon_redemption(account_id:, body:, **options)
490
+ path = interpolate_path("/accounts/{account_id}/coupon_redemptions/active", account_id: account_id)
491
+ post(path, body, Requests::CouponRedemptionCreate, **options)
472
492
  end
473
493
 
474
494
  # Delete the active coupon redemption from an account
475
495
  #
476
- # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_coupon_redemption remove_coupon_redemption api documenation}
496
+ # {https://developers.recurly.com/api/v2019-10-10#operation/remove_coupon_redemption remove_coupon_redemption api documenation}
477
497
  #
478
498
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
499
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
479
500
  # @return [Resources::CouponRedemption] Coupon redemption deleted.
480
501
  # @example
481
502
  # begin
@@ -487,14 +508,14 @@ module Recurly
487
508
  # puts "Resource Not Found"
488
509
  # end
489
510
  #
490
- def remove_coupon_redemption(account_id:)
491
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/coupon_redemptions/active", site_id: site_id, account_id: account_id)
492
- delete(path)
511
+ def remove_coupon_redemption(account_id:, **options)
512
+ path = interpolate_path("/accounts/{account_id}/coupon_redemptions/active", account_id: account_id)
513
+ delete(path, **options)
493
514
  end
494
515
 
495
516
  # List an account's credit payments
496
517
  #
497
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_credit_payments list_account_credit_payments api documenation}
518
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_credit_payments list_account_credit_payments api documenation}
498
519
  #
499
520
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
500
521
  # @param limit [Integer] Limit number of records 1-200.
@@ -509,6 +530,7 @@ module Recurly
509
530
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
510
531
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
511
532
  #
533
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
512
534
  # @return [Pager<Resources::CreditPayment>] A list of the account's credit payments.
513
535
  # @example
514
536
  # payments = @client.list_account_credit_payments(
@@ -520,16 +542,16 @@ module Recurly
520
542
  # end
521
543
  #
522
544
  def list_account_credit_payments(account_id:, **options)
523
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/credit_payments", site_id: site_id, account_id: account_id)
545
+ path = interpolate_path("/accounts/{account_id}/credit_payments", account_id: account_id)
524
546
  pager(path, **options)
525
547
  end
526
548
 
527
549
  # List an account's invoices
528
550
  #
529
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_invoices list_account_invoices api documenation}
551
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_invoices list_account_invoices api documenation}
530
552
  #
531
553
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
532
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
554
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
533
555
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
534
556
  #
535
557
  # *Important notes:*
@@ -559,6 +581,7 @@ module Recurly
559
581
  # - +type=non-legacy+, only charge and credit invoices will be returned.
560
582
  # - +type=legacy+, only legacy invoices will be returned.
561
583
  #
584
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
562
585
  # @return [Pager<Resources::Invoice>] A list of the account's invoices.
563
586
  # @example
564
587
  # invoices = @client.list_account_invoices(
@@ -570,16 +593,17 @@ module Recurly
570
593
  # end
571
594
  #
572
595
  def list_account_invoices(account_id:, **options)
573
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/invoices", site_id: site_id, account_id: account_id)
596
+ path = interpolate_path("/accounts/{account_id}/invoices", account_id: account_id)
574
597
  pager(path, **options)
575
598
  end
576
599
 
577
600
  # Create an invoice for pending line items
578
601
  #
579
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_invoice create_invoice api documenation}
602
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_invoice create_invoice api documenation}
580
603
  #
581
604
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
582
605
  # @param body [Requests::InvoiceCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceCreate}
606
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
583
607
  # @return [Resources::InvoiceCollection] Returns the new invoices.
584
608
  # @example
585
609
  # begin
@@ -598,17 +622,18 @@ module Recurly
598
622
  # puts "ValidationError: #{e.recurly_error.params}"
599
623
  # end
600
624
  #
601
- def create_invoice(account_id:, body:)
602
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/invoices", site_id: site_id, account_id: account_id)
603
- post(path, body, Requests::InvoiceCreate)
625
+ def create_invoice(account_id:, body:, **options)
626
+ path = interpolate_path("/accounts/{account_id}/invoices", account_id: account_id)
627
+ post(path, body, Requests::InvoiceCreate, **options)
604
628
  end
605
629
 
606
630
  # Preview new invoice for pending line items
607
631
  #
608
- # {https://partner-docs.recurly.com/v2018-08-09#operation/preview_invoice preview_invoice api documenation}
632
+ # {https://developers.recurly.com/api/v2019-10-10#operation/preview_invoice preview_invoice api documenation}
609
633
  #
610
634
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
611
635
  # @param body [Requests::InvoiceCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceCreate}
636
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
612
637
  # @return [Resources::InvoiceCollection] Returns the invoice previews.
613
638
  # @example
614
639
  # begin
@@ -627,17 +652,17 @@ module Recurly
627
652
  # puts "ValidationError: #{e.recurly_error.params}"
628
653
  # end
629
654
  #
630
- def preview_invoice(account_id:, body:)
631
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/invoices/preview", site_id: site_id, account_id: account_id)
632
- post(path, body, Requests::InvoiceCreate)
655
+ def preview_invoice(account_id:, body:, **options)
656
+ path = interpolate_path("/accounts/{account_id}/invoices/preview", account_id: account_id)
657
+ post(path, body, Requests::InvoiceCreate, **options)
633
658
  end
634
659
 
635
660
  # List an account's line items
636
661
  #
637
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_line_items list_account_line_items api documenation}
662
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_line_items list_account_line_items api documenation}
638
663
  #
639
664
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
640
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
665
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
641
666
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
642
667
  #
643
668
  # *Important notes:*
@@ -664,6 +689,7 @@ module Recurly
664
689
  # @param original [String] Filter by original field.
665
690
  # @param state [String] Filter by state field.
666
691
  # @param type [String] Filter by type field.
692
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
667
693
  # @return [Pager<Resources::LineItem>] A list of the account's line items.
668
694
  # @example
669
695
  # line_items = @client.list_account_line_items(
@@ -675,16 +701,17 @@ module Recurly
675
701
  # end
676
702
  #
677
703
  def list_account_line_items(account_id:, **options)
678
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/line_items", site_id: site_id, account_id: account_id)
704
+ path = interpolate_path("/accounts/{account_id}/line_items", account_id: account_id)
679
705
  pager(path, **options)
680
706
  end
681
707
 
682
708
  # Create a new line item for the account
683
709
  #
684
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_line_item create_line_item api documenation}
710
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_line_item create_line_item api documenation}
685
711
  #
686
712
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
687
713
  # @param body [Requests::LineItemCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::LineItemCreate}
714
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
688
715
  # @return [Resources::LineItem] Returns the new line item.
689
716
  # @example
690
717
  # begin
@@ -704,17 +731,17 @@ module Recurly
704
731
  # puts "ValidationError: #{e.recurly_error.params}"
705
732
  # end
706
733
  #
707
- def create_line_item(account_id:, body:)
708
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/line_items", site_id: site_id, account_id: account_id)
709
- post(path, body, Requests::LineItemCreate)
734
+ def create_line_item(account_id:, body:, **options)
735
+ path = interpolate_path("/accounts/{account_id}/line_items", account_id: account_id)
736
+ post(path, body, Requests::LineItemCreate, **options)
710
737
  end
711
738
 
712
739
  # Fetch a list of an account's notes
713
740
  #
714
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_notes list_account_notes api documenation}
741
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_notes list_account_notes api documenation}
715
742
  #
716
743
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
717
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
744
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
718
745
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
719
746
  #
720
747
  # *Important notes:*
@@ -726,6 +753,7 @@ module Recurly
726
753
  # * Records are returned in an arbitrary order. Since results are all
727
754
  # returned at once you can sort the records yourself.
728
755
  #
756
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
729
757
  # @return [Pager<Resources::AccountNote>] A list of an account's notes.
730
758
  # @example
731
759
  # account_notes = @client.list_account_notes(account_id: account_id, limit: 200)
@@ -734,16 +762,17 @@ module Recurly
734
762
  # end
735
763
  #
736
764
  def list_account_notes(account_id:, **options)
737
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/notes", site_id: site_id, account_id: account_id)
765
+ path = interpolate_path("/accounts/{account_id}/notes", account_id: account_id)
738
766
  pager(path, **options)
739
767
  end
740
768
 
741
769
  # Fetch an account note
742
770
  #
743
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_account_note get_account_note api documenation}
771
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_account_note get_account_note api documenation}
744
772
  #
745
773
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
746
774
  # @param account_note_id [String] Account Note ID.
775
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
747
776
  # @return [Resources::AccountNote] An account note.
748
777
  # @example
749
778
  # begin
@@ -758,17 +787,17 @@ module Recurly
758
787
  # puts "Resource Not Found"
759
788
  # end
760
789
  #
761
- def get_account_note(account_id:, account_note_id:)
762
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/notes/{account_note_id}", site_id: site_id, account_id: account_id, account_note_id: account_note_id)
763
- get(path)
790
+ def get_account_note(account_id:, account_note_id:, **options)
791
+ path = interpolate_path("/accounts/{account_id}/notes/{account_note_id}", account_id: account_id, account_note_id: account_note_id)
792
+ get(path, **options)
764
793
  end
765
794
 
766
795
  # Fetch a list of an account's shipping addresses
767
796
  #
768
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_shipping_addresses list_shipping_addresses api documenation}
797
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_shipping_addresses list_shipping_addresses api documenation}
769
798
  #
770
799
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
771
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
800
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
772
801
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
773
802
  #
774
803
  # *Important notes:*
@@ -792,6 +821,7 @@ module Recurly
792
821
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
793
822
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
794
823
  #
824
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
795
825
  # @return [Pager<Resources::ShippingAddress>] A list of an account's shipping addresses.
796
826
  # @example
797
827
  # shipping_addresses = @client.list_shipping_addresses(
@@ -803,28 +833,30 @@ module Recurly
803
833
  # end
804
834
  #
805
835
  def list_shipping_addresses(account_id:, **options)
806
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses", site_id: site_id, account_id: account_id)
836
+ path = interpolate_path("/accounts/{account_id}/shipping_addresses", account_id: account_id)
807
837
  pager(path, **options)
808
838
  end
809
839
 
810
840
  # Create a new shipping address for the account
811
841
  #
812
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_shipping_address create_shipping_address api documenation}
842
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_shipping_address create_shipping_address api documenation}
813
843
  #
814
844
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
815
845
  # @param body [Requests::ShippingAddressCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingAddressCreate}
846
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
816
847
  # @return [Resources::ShippingAddress] Returns the new shipping address.
817
- def create_shipping_address(account_id:, body:)
818
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses", site_id: site_id, account_id: account_id)
819
- post(path, body, Requests::ShippingAddressCreate)
848
+ def create_shipping_address(account_id:, body:, **options)
849
+ path = interpolate_path("/accounts/{account_id}/shipping_addresses", account_id: account_id)
850
+ post(path, body, Requests::ShippingAddressCreate, **options)
820
851
  end
821
852
 
822
853
  # Fetch an account's shipping address
823
854
  #
824
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_shipping_address get_shipping_address api documenation}
855
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_shipping_address get_shipping_address api documenation}
825
856
  #
826
857
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
827
858
  # @param shipping_address_id [String] Shipping Address ID.
859
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
828
860
  # @return [Resources::ShippingAddress] A shipping address.
829
861
  # @example
830
862
  # begin
@@ -839,18 +871,19 @@ module Recurly
839
871
  # puts "Resource Not Found"
840
872
  # end
841
873
  #
842
- def get_shipping_address(account_id:, shipping_address_id:)
843
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}", site_id: site_id, account_id: account_id, shipping_address_id: shipping_address_id)
844
- get(path)
874
+ def get_shipping_address(account_id:, shipping_address_id:, **options)
875
+ path = interpolate_path("/accounts/{account_id}/shipping_addresses/{shipping_address_id}", account_id: account_id, shipping_address_id: shipping_address_id)
876
+ get(path, **options)
845
877
  end
846
878
 
847
879
  # Update an account's shipping address
848
880
  #
849
- # {https://partner-docs.recurly.com/v2018-08-09#operation/update_shipping_address update_shipping_address api documenation}
881
+ # {https://developers.recurly.com/api/v2019-10-10#operation/update_shipping_address update_shipping_address api documenation}
850
882
  #
851
883
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
852
884
  # @param shipping_address_id [String] Shipping Address ID.
853
885
  # @param body [Requests::ShippingAddressUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingAddressUpdate}
886
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
854
887
  # @return [Resources::ShippingAddress] The updated shipping address.
855
888
  # @example
856
889
  # begin
@@ -871,17 +904,19 @@ module Recurly
871
904
  # puts "ValidationError: #{e.recurly_error.params}"
872
905
  # end
873
906
  #
874
- def update_shipping_address(account_id:, shipping_address_id:, body:)
875
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}", site_id: site_id, account_id: account_id, shipping_address_id: shipping_address_id)
876
- put(path, body, Requests::ShippingAddressUpdate)
907
+ def update_shipping_address(account_id:, shipping_address_id:, body:, **options)
908
+ path = interpolate_path("/accounts/{account_id}/shipping_addresses/{shipping_address_id}", account_id: account_id, shipping_address_id: shipping_address_id)
909
+ put(path, body, Requests::ShippingAddressUpdate, **options)
877
910
  end
878
911
 
879
912
  # Remove an account's shipping address
880
913
  #
881
- # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_shipping_address remove_shipping_address api documenation}
914
+ # {https://developers.recurly.com/api/v2019-10-10#operation/remove_shipping_address remove_shipping_address api documenation}
882
915
  #
883
916
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
884
917
  # @param shipping_address_id [String] Shipping Address ID.
918
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
919
+ # @return [Empty] Shipping address deleted.
885
920
  # @example
886
921
  # begin
887
922
  # @client.remove_shipping_address(
@@ -895,17 +930,17 @@ module Recurly
895
930
  # puts "Resource Not Found"
896
931
  # end
897
932
  #
898
- def remove_shipping_address(account_id:, shipping_address_id:)
899
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}", site_id: site_id, account_id: account_id, shipping_address_id: shipping_address_id)
900
- delete(path)
933
+ def remove_shipping_address(account_id:, shipping_address_id:, **options)
934
+ path = interpolate_path("/accounts/{account_id}/shipping_addresses/{shipping_address_id}", account_id: account_id, shipping_address_id: shipping_address_id)
935
+ delete(path, **options)
901
936
  end
902
937
 
903
938
  # List an account's subscriptions
904
939
  #
905
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_subscriptions list_account_subscriptions api documenation}
940
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_subscriptions list_account_subscriptions api documenation}
906
941
  #
907
942
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
908
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
943
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
909
944
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
910
945
  #
911
946
  # *Important notes:*
@@ -935,6 +970,7 @@ module Recurly
935
970
  # - When +state=in_trial+, only subscriptions that have a trial_started_at date earlier than now and a trial_ends_at date later than now will be returned.
936
971
  # - When +state=live+, only subscriptions that are in an active, canceled, or future state or are in trial will be returned.
937
972
  #
973
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
938
974
  # @return [Pager<Resources::Subscription>] A list of the account's subscriptions.
939
975
  # @example
940
976
  # subscriptions = @client.list_account_subscriptions(
@@ -946,16 +982,16 @@ module Recurly
946
982
  # end
947
983
  #
948
984
  def list_account_subscriptions(account_id:, **options)
949
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/subscriptions", site_id: site_id, account_id: account_id)
985
+ path = interpolate_path("/accounts/{account_id}/subscriptions", account_id: account_id)
950
986
  pager(path, **options)
951
987
  end
952
988
 
953
989
  # List an account's transactions
954
990
  #
955
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_transactions list_account_transactions api documenation}
991
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_transactions list_account_transactions api documenation}
956
992
  #
957
993
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
958
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
994
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
959
995
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
960
996
  #
961
997
  # *Important notes:*
@@ -981,6 +1017,7 @@ module Recurly
981
1017
  #
982
1018
  # @param type [String] Filter by type field. The value +payment+ will return both +purchase+ and +capture+ transactions.
983
1019
  # @param success [String] Filter by success field.
1020
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
984
1021
  # @return [Pager<Resources::Transaction>] A list of the account's transactions.
985
1022
  # @example
986
1023
  # transactions = @client.list_account_transactions(
@@ -992,16 +1029,16 @@ module Recurly
992
1029
  # end
993
1030
  #
994
1031
  def list_account_transactions(account_id:, **options)
995
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/transactions", site_id: site_id, account_id: account_id)
1032
+ path = interpolate_path("/accounts/{account_id}/transactions", account_id: account_id)
996
1033
  pager(path, **options)
997
1034
  end
998
1035
 
999
1036
  # List an account's child accounts
1000
1037
  #
1001
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_child_accounts list_child_accounts api documenation}
1038
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_child_accounts list_child_accounts api documenation}
1002
1039
  #
1003
1040
  # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+).
1004
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1041
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1005
1042
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1006
1043
  #
1007
1044
  # *Important notes:*
@@ -1025,10 +1062,12 @@ module Recurly
1025
1062
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
1026
1063
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1027
1064
  #
1028
- # @param subscriber [String] Filter accounts accounts with or without a subscription in the +active+,
1065
+ # @param email [String] Filter for accounts with this exact email address. A blank value will return accounts with both +null+ and +""+ email addresses. Note that multiple accounts can share one email address.
1066
+ # @param subscriber [Boolean] Filter for accounts with or without a subscription in the +active+,
1029
1067
  # +canceled+, or +future+ state.
1030
1068
  #
1031
1069
  # @param past_due [String] Filter for accounts with an invoice in the +past_due+ state.
1070
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1032
1071
  # @return [Pager<Resources::Account>] A list of an account's child accounts.
1033
1072
  # @example
1034
1073
  # child_accounts = @client.list_child_accounts(
@@ -1040,15 +1079,15 @@ module Recurly
1040
1079
  # end
1041
1080
  #
1042
1081
  def list_child_accounts(account_id:, **options)
1043
- path = interpolate_path("/sites/{site_id}/accounts/{account_id}/accounts", site_id: site_id, account_id: account_id)
1082
+ path = interpolate_path("/accounts/{account_id}/accounts", account_id: account_id)
1044
1083
  pager(path, **options)
1045
1084
  end
1046
1085
 
1047
1086
  # List a site's account acquisition data
1048
1087
  #
1049
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_acquisition list_account_acquisition api documenation}
1088
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_acquisition list_account_acquisition api documenation}
1050
1089
  #
1051
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1090
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1052
1091
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1053
1092
  #
1054
1093
  # *Important notes:*
@@ -1072,6 +1111,7 @@ module Recurly
1072
1111
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
1073
1112
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1074
1113
  #
1114
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1075
1115
  # @return [Pager<Resources::AccountAcquisition>] A list of the site's account acquisition data.
1076
1116
  # @example
1077
1117
  # acquisitions = @client.list_account_acquisition(limit: 200)
@@ -1080,15 +1120,15 @@ module Recurly
1080
1120
  # end
1081
1121
  #
1082
1122
  def list_account_acquisition(**options)
1083
- path = interpolate_path("/sites/{site_id}/acquisitions", site_id: site_id)
1123
+ path = interpolate_path("/acquisitions")
1084
1124
  pager(path, **options)
1085
1125
  end
1086
1126
 
1087
1127
  # List a site's coupons
1088
1128
  #
1089
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_coupons list_coupons api documenation}
1129
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_coupons list_coupons api documenation}
1090
1130
  #
1091
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1131
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1092
1132
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1093
1133
  #
1094
1134
  # *Important notes:*
@@ -1112,6 +1152,7 @@ module Recurly
1112
1152
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
1113
1153
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1114
1154
  #
1155
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1115
1156
  # @return [Pager<Resources::Coupon>] A list of the site's coupons.
1116
1157
  # @example
1117
1158
  # coupons = @client.list_coupons(limit: 200)
@@ -1120,15 +1161,16 @@ module Recurly
1120
1161
  # end
1121
1162
  #
1122
1163
  def list_coupons(**options)
1123
- path = interpolate_path("/sites/{site_id}/coupons", site_id: site_id)
1164
+ path = interpolate_path("/coupons")
1124
1165
  pager(path, **options)
1125
1166
  end
1126
1167
 
1127
1168
  # Create a new coupon
1128
1169
  #
1129
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_coupon create_coupon api documenation}
1170
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_coupon create_coupon api documenation}
1130
1171
  #
1131
1172
  # @param body [Requests::CouponCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CouponCreate}
1173
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1132
1174
  # @return [Resources::Coupon] A new coupon.
1133
1175
  # @example
1134
1176
  # begin
@@ -1153,16 +1195,17 @@ module Recurly
1153
1195
  # puts "ValidationError: #{e.recurly_error.params}"
1154
1196
  # end
1155
1197
  #
1156
- def create_coupon(body:)
1157
- path = interpolate_path("/sites/{site_id}/coupons", site_id: site_id)
1158
- post(path, body, Requests::CouponCreate)
1198
+ def create_coupon(body:, **options)
1199
+ path = interpolate_path("/coupons")
1200
+ post(path, body, Requests::CouponCreate, **options)
1159
1201
  end
1160
1202
 
1161
1203
  # Fetch a coupon
1162
1204
  #
1163
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_coupon get_coupon api documenation}
1205
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_coupon get_coupon api documenation}
1164
1206
  #
1165
1207
  # @param coupon_id [String] Coupon ID or code (use prefix: +code-+, e.g. +code-10off+).
1208
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1166
1209
  # @return [Resources::Coupon] A coupon.
1167
1210
  # @example
1168
1211
  # begin
@@ -1174,29 +1217,30 @@ module Recurly
1174
1217
  # puts "Resource Not Found"
1175
1218
  # end
1176
1219
  #
1177
- def get_coupon(coupon_id:)
1178
- path = interpolate_path("/sites/{site_id}/coupons/{coupon_id}", site_id: site_id, coupon_id: coupon_id)
1179
- get(path)
1220
+ def get_coupon(coupon_id:, **options)
1221
+ path = interpolate_path("/coupons/{coupon_id}", coupon_id: coupon_id)
1222
+ get(path, **options)
1180
1223
  end
1181
1224
 
1182
1225
  # Update an active coupon
1183
1226
  #
1184
- # {https://partner-docs.recurly.com/v2018-08-09#operation/update_coupon update_coupon api documenation}
1227
+ # {https://developers.recurly.com/api/v2019-10-10#operation/update_coupon update_coupon api documenation}
1185
1228
  #
1186
1229
  # @param coupon_id [String] Coupon ID or code (use prefix: +code-+, e.g. +code-10off+).
1187
1230
  # @param body [Requests::CouponUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CouponUpdate}
1231
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1188
1232
  # @return [Resources::Coupon] The updated coupon.
1189
- def update_coupon(coupon_id:, body:)
1190
- path = interpolate_path("/sites/{site_id}/coupons/{coupon_id}", site_id: site_id, coupon_id: coupon_id)
1191
- put(path, body, Requests::CouponUpdate)
1233
+ def update_coupon(coupon_id:, body:, **options)
1234
+ path = interpolate_path("/coupons/{coupon_id}", coupon_id: coupon_id)
1235
+ put(path, body, Requests::CouponUpdate, **options)
1192
1236
  end
1193
1237
 
1194
1238
  # List unique coupon codes associated with a bulk coupon
1195
1239
  #
1196
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_unique_coupon_codes list_unique_coupon_codes api documenation}
1240
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_unique_coupon_codes list_unique_coupon_codes api documenation}
1197
1241
  #
1198
1242
  # @param coupon_id [String] Coupon ID or code (use prefix: +code-+, e.g. +code-10off+).
1199
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1243
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1200
1244
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1201
1245
  #
1202
1246
  # *Important notes:*
@@ -1220,15 +1264,16 @@ module Recurly
1220
1264
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
1221
1265
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1222
1266
  #
1267
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1223
1268
  # @return [Pager<Resources::UniqueCouponCode>] A list of unique coupon codes that were generated
1224
1269
  def list_unique_coupon_codes(coupon_id:, **options)
1225
- path = interpolate_path("/sites/{site_id}/coupons/{coupon_id}/unique_coupon_codes", site_id: site_id, coupon_id: coupon_id)
1270
+ path = interpolate_path("/coupons/{coupon_id}/unique_coupon_codes", coupon_id: coupon_id)
1226
1271
  pager(path, **options)
1227
1272
  end
1228
1273
 
1229
1274
  # List a site's credit payments
1230
1275
  #
1231
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_credit_payments list_credit_payments api documenation}
1276
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_credit_payments list_credit_payments api documenation}
1232
1277
  #
1233
1278
  # @param limit [Integer] Limit number of records 1-200.
1234
1279
  # @param order [String] Sort order.
@@ -1242,6 +1287,7 @@ module Recurly
1242
1287
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
1243
1288
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1244
1289
  #
1290
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1245
1291
  # @return [Pager<Resources::CreditPayment>] A list of the site's credit payments.
1246
1292
  # @example
1247
1293
  # payments = @client.list_credit_payments(limit: 200)
@@ -1250,26 +1296,27 @@ module Recurly
1250
1296
  # end
1251
1297
  #
1252
1298
  def list_credit_payments(**options)
1253
- path = interpolate_path("/sites/{site_id}/credit_payments", site_id: site_id)
1299
+ path = interpolate_path("/credit_payments")
1254
1300
  pager(path, **options)
1255
1301
  end
1256
1302
 
1257
1303
  # Fetch a credit payment
1258
1304
  #
1259
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_credit_payment get_credit_payment api documenation}
1305
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_credit_payment get_credit_payment api documenation}
1260
1306
  #
1261
1307
  # @param credit_payment_id [String] Credit Payment ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
1308
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1262
1309
  # @return [Resources::CreditPayment] A credit payment.
1263
- def get_credit_payment(credit_payment_id:)
1264
- path = interpolate_path("/sites/{site_id}/credit_payments/{credit_payment_id}", site_id: site_id, credit_payment_id: credit_payment_id)
1265
- get(path)
1310
+ def get_credit_payment(credit_payment_id:, **options)
1311
+ path = interpolate_path("/credit_payments/{credit_payment_id}", credit_payment_id: credit_payment_id)
1312
+ get(path, **options)
1266
1313
  end
1267
1314
 
1268
1315
  # List a site's custom field definitions
1269
1316
  #
1270
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_custom_field_definitions list_custom_field_definitions api documenation}
1317
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_custom_field_definitions list_custom_field_definitions api documenation}
1271
1318
  #
1272
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1319
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1273
1320
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1274
1321
  #
1275
1322
  # *Important notes:*
@@ -1293,6 +1340,7 @@ module Recurly
1293
1340
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
1294
1341
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1295
1342
  #
1343
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1296
1344
  # @return [Pager<Resources::CustomFieldDefinition>] A list of the site's custom field definitions.
1297
1345
  # @example
1298
1346
  # custom_fields = @client.list_custom_field_definitions(limit: 200)
@@ -1301,26 +1349,27 @@ module Recurly
1301
1349
  # end
1302
1350
  #
1303
1351
  def list_custom_field_definitions(**options)
1304
- path = interpolate_path("/sites/{site_id}/custom_field_definitions", site_id: site_id)
1352
+ path = interpolate_path("/custom_field_definitions")
1305
1353
  pager(path, **options)
1306
1354
  end
1307
1355
 
1308
1356
  # Fetch an custom field definition
1309
1357
  #
1310
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_custom_field_definition get_custom_field_definition api documenation}
1358
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_custom_field_definition get_custom_field_definition api documenation}
1311
1359
  #
1312
1360
  # @param custom_field_definition_id [String] Custom Field Definition ID
1361
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1313
1362
  # @return [Resources::CustomFieldDefinition] An custom field definition.
1314
- def get_custom_field_definition(custom_field_definition_id:)
1315
- path = interpolate_path("/sites/{site_id}/custom_field_definitions/{custom_field_definition_id}", site_id: site_id, custom_field_definition_id: custom_field_definition_id)
1316
- get(path)
1363
+ def get_custom_field_definition(custom_field_definition_id:, **options)
1364
+ path = interpolate_path("/custom_field_definitions/{custom_field_definition_id}", custom_field_definition_id: custom_field_definition_id)
1365
+ get(path, **options)
1317
1366
  end
1318
1367
 
1319
1368
  # List a site's invoices
1320
1369
  #
1321
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_invoices list_invoices api documenation}
1370
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_invoices list_invoices api documenation}
1322
1371
  #
1323
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1372
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1324
1373
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1325
1374
  #
1326
1375
  # *Important notes:*
@@ -1350,6 +1399,7 @@ module Recurly
1350
1399
  # - +type=non-legacy+, only charge and credit invoices will be returned.
1351
1400
  # - +type=legacy+, only legacy invoices will be returned.
1352
1401
  #
1402
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1353
1403
  # @return [Pager<Resources::Invoice>] A list of the site's invoices.
1354
1404
  # @example
1355
1405
  # invoices = @client.list_invoices(limit: 200)
@@ -1358,15 +1408,16 @@ module Recurly
1358
1408
  # end
1359
1409
  #
1360
1410
  def list_invoices(**options)
1361
- path = interpolate_path("/sites/{site_id}/invoices", site_id: site_id)
1411
+ path = interpolate_path("/invoices")
1362
1412
  pager(path, **options)
1363
1413
  end
1364
1414
 
1365
1415
  # Fetch an invoice
1366
1416
  #
1367
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_invoice get_invoice api documenation}
1417
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_invoice get_invoice api documenation}
1368
1418
  #
1369
1419
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1420
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1370
1421
  # @return [Resources::Invoice] An invoice.
1371
1422
  # @example
1372
1423
  # begin
@@ -1378,28 +1429,30 @@ module Recurly
1378
1429
  # puts "Resource Not Found"
1379
1430
  # end
1380
1431
  #
1381
- def get_invoice(invoice_id:)
1382
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}", site_id: site_id, invoice_id: invoice_id)
1383
- get(path)
1432
+ def get_invoice(invoice_id:, **options)
1433
+ path = interpolate_path("/invoices/{invoice_id}", invoice_id: invoice_id)
1434
+ get(path, **options)
1384
1435
  end
1385
1436
 
1386
1437
  # Update an invoice
1387
1438
  #
1388
- # {https://partner-docs.recurly.com/v2018-08-09#operation/put_invoice put_invoice api documenation}
1439
+ # {https://developers.recurly.com/api/v2019-10-10#operation/put_invoice put_invoice api documenation}
1389
1440
  #
1390
1441
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1391
1442
  # @param body [Requests::InvoiceUpdatable] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceUpdatable}
1443
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1392
1444
  # @return [Resources::Invoice] An invoice.
1393
- def put_invoice(invoice_id:, body:)
1394
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}", site_id: site_id, invoice_id: invoice_id)
1395
- put(path, body, Requests::InvoiceUpdatable)
1445
+ def put_invoice(invoice_id:, body:, **options)
1446
+ path = interpolate_path("/invoices/{invoice_id}", invoice_id: invoice_id)
1447
+ put(path, body, Requests::InvoiceUpdatable, **options)
1396
1448
  end
1397
1449
 
1398
1450
  # Collect a pending or past due, automatic invoice
1399
1451
  #
1400
- # {https://partner-docs.recurly.com/v2018-08-09#operation/collect_invoice collect_invoice api documenation}
1452
+ # {https://developers.recurly.com/api/v2019-10-10#operation/collect_invoice collect_invoice api documenation}
1401
1453
  #
1402
1454
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1455
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1403
1456
  # @return [Resources::Invoice] The updated invoice.
1404
1457
  # @example
1405
1458
  # begin
@@ -1411,16 +1464,17 @@ module Recurly
1411
1464
  # puts "Resource Not Found"
1412
1465
  # end
1413
1466
  #
1414
- def collect_invoice(invoice_id:)
1415
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/collect", site_id: site_id, invoice_id: invoice_id)
1416
- put(path)
1467
+ def collect_invoice(invoice_id:, **options)
1468
+ path = interpolate_path("/invoices/{invoice_id}/collect", invoice_id: invoice_id)
1469
+ put(path, **options)
1417
1470
  end
1418
1471
 
1419
1472
  # Mark an open invoice as failed
1420
1473
  #
1421
- # {https://partner-docs.recurly.com/v2018-08-09#operation/fail_invoice fail_invoice api documenation}
1474
+ # {https://developers.recurly.com/api/v2019-10-10#operation/fail_invoice fail_invoice api documenation}
1422
1475
  #
1423
1476
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1477
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1424
1478
  # @return [Resources::Invoice] The updated invoice.
1425
1479
  # @example
1426
1480
  # begin
@@ -1432,16 +1486,17 @@ module Recurly
1432
1486
  # puts "Resource Not Found"
1433
1487
  # end
1434
1488
  #
1435
- def fail_invoice(invoice_id:)
1436
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/mark_failed", site_id: site_id, invoice_id: invoice_id)
1437
- put(path)
1489
+ def fail_invoice(invoice_id:, **options)
1490
+ path = interpolate_path("/invoices/{invoice_id}/mark_failed", invoice_id: invoice_id)
1491
+ put(path, **options)
1438
1492
  end
1439
1493
 
1440
1494
  # Mark an open invoice as successful
1441
1495
  #
1442
- # {https://partner-docs.recurly.com/v2018-08-09#operation/mark_invoice_successful mark_invoice_successful api documenation}
1496
+ # {https://developers.recurly.com/api/v2019-10-10#operation/mark_invoice_successful mark_invoice_successful api documenation}
1443
1497
  #
1444
1498
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1499
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1445
1500
  # @return [Resources::Invoice] The updated invoice.
1446
1501
  # @example
1447
1502
  # begin
@@ -1453,16 +1508,17 @@ module Recurly
1453
1508
  # puts "Resource Not Found"
1454
1509
  # end
1455
1510
  #
1456
- def mark_invoice_successful(invoice_id:)
1457
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/mark_successful", site_id: site_id, invoice_id: invoice_id)
1458
- put(path)
1511
+ def mark_invoice_successful(invoice_id:, **options)
1512
+ path = interpolate_path("/invoices/{invoice_id}/mark_successful", invoice_id: invoice_id)
1513
+ put(path, **options)
1459
1514
  end
1460
1515
 
1461
1516
  # Reopen a closed, manual invoice
1462
1517
  #
1463
- # {https://partner-docs.recurly.com/v2018-08-09#operation/reopen_invoice reopen_invoice api documenation}
1518
+ # {https://developers.recurly.com/api/v2019-10-10#operation/reopen_invoice reopen_invoice api documenation}
1464
1519
  #
1465
1520
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1521
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1466
1522
  # @return [Resources::Invoice] The updated invoice.
1467
1523
  # @example
1468
1524
  # begin
@@ -1474,17 +1530,29 @@ module Recurly
1474
1530
  # puts "Resource Not Found"
1475
1531
  # end
1476
1532
  #
1477
- def reopen_invoice(invoice_id:)
1478
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/reopen", site_id: site_id, invoice_id: invoice_id)
1479
- put(path)
1533
+ def reopen_invoice(invoice_id:, **options)
1534
+ path = interpolate_path("/invoices/{invoice_id}/reopen", invoice_id: invoice_id)
1535
+ put(path, **options)
1536
+ end
1537
+
1538
+ # Void a credit invoice.
1539
+ #
1540
+ # {https://developers.recurly.com/api/v2019-10-10#operation/void_invoice void_invoice api documenation}
1541
+ #
1542
+ # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1543
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1544
+ # @return [Resources::Invoice] The updated invoice.
1545
+ def void_invoice(invoice_id:, **options)
1546
+ path = interpolate_path("/invoices/{invoice_id}/void", invoice_id: invoice_id)
1547
+ put(path, **options)
1480
1548
  end
1481
1549
 
1482
1550
  # List an invoice's line items
1483
1551
  #
1484
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_invoice_line_items list_invoice_line_items api documenation}
1552
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_invoice_line_items list_invoice_line_items api documenation}
1485
1553
  #
1486
1554
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1487
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1555
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1488
1556
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1489
1557
  #
1490
1558
  # *Important notes:*
@@ -1511,18 +1579,19 @@ module Recurly
1511
1579
  # @param original [String] Filter by original field.
1512
1580
  # @param state [String] Filter by state field.
1513
1581
  # @param type [String] Filter by type field.
1582
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1514
1583
  # @return [Pager<Resources::LineItem>] A list of the invoice's line items.
1515
1584
  def list_invoice_line_items(invoice_id:, **options)
1516
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/line_items", site_id: site_id, invoice_id: invoice_id)
1585
+ path = interpolate_path("/invoices/{invoice_id}/line_items", invoice_id: invoice_id)
1517
1586
  pager(path, **options)
1518
1587
  end
1519
1588
 
1520
1589
  # Show the coupon redemptions applied to an invoice
1521
1590
  #
1522
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_invoice_coupon_redemptions list_invoice_coupon_redemptions api documenation}
1591
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_invoice_coupon_redemptions list_invoice_coupon_redemptions api documenation}
1523
1592
  #
1524
1593
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1525
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1594
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1526
1595
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1527
1596
  #
1528
1597
  # *Important notes:*
@@ -1544,6 +1613,7 @@ module Recurly
1544
1613
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
1545
1614
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1546
1615
  #
1616
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1547
1617
  # @return [Pager<Resources::CouponRedemption>] A list of the the coupon redemptions associated with the invoice.
1548
1618
  # @example
1549
1619
  # coupon_redemptions = @client.list_invoice_coupon_redemptions(
@@ -1555,27 +1625,29 @@ module Recurly
1555
1625
  # end
1556
1626
  #
1557
1627
  def list_invoice_coupon_redemptions(invoice_id:, **options)
1558
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/coupon_redemptions", site_id: site_id, invoice_id: invoice_id)
1628
+ path = interpolate_path("/invoices/{invoice_id}/coupon_redemptions", invoice_id: invoice_id)
1559
1629
  pager(path, **options)
1560
1630
  end
1561
1631
 
1562
1632
  # List an invoice's related credit or charge invoices
1563
1633
  #
1564
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_related_invoices list_related_invoices api documenation}
1634
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_related_invoices list_related_invoices api documenation}
1565
1635
  #
1566
1636
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1637
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1567
1638
  # @return [Pager<Resources::Invoice>] A list of the credit or charge invoices associated with the invoice.
1568
- def list_related_invoices(invoice_id:)
1569
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/related_invoices", site_id: site_id, invoice_id: invoice_id)
1570
- pager(path)
1639
+ def list_related_invoices(invoice_id:, **options)
1640
+ path = interpolate_path("/invoices/{invoice_id}/related_invoices", invoice_id: invoice_id)
1641
+ pager(path, **options)
1571
1642
  end
1572
1643
 
1573
1644
  # Refund an invoice
1574
1645
  #
1575
- # {https://partner-docs.recurly.com/v2018-08-09#operation/refund_invoice refund_invoice api documenation}
1646
+ # {https://developers.recurly.com/api/v2019-10-10#operation/refund_invoice refund_invoice api documenation}
1576
1647
  #
1577
1648
  # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+).
1578
1649
  # @param body [Requests::InvoiceRefund] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceRefund}
1650
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1579
1651
  # @return [Resources::Invoice] Returns the new credit invoice.
1580
1652
  # @example
1581
1653
  # begin
@@ -1594,16 +1666,16 @@ module Recurly
1594
1666
  # puts "ValidationError: #{e.recurly_error.params}"
1595
1667
  # end
1596
1668
  #
1597
- def refund_invoice(invoice_id:, body:)
1598
- path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/refund", site_id: site_id, invoice_id: invoice_id)
1599
- post(path, body, Requests::InvoiceRefund)
1669
+ def refund_invoice(invoice_id:, body:, **options)
1670
+ path = interpolate_path("/invoices/{invoice_id}/refund", invoice_id: invoice_id)
1671
+ post(path, body, Requests::InvoiceRefund, **options)
1600
1672
  end
1601
1673
 
1602
1674
  # List a site's line items
1603
1675
  #
1604
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_line_items list_line_items api documenation}
1676
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_line_items list_line_items api documenation}
1605
1677
  #
1606
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1678
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1607
1679
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1608
1680
  #
1609
1681
  # *Important notes:*
@@ -1630,17 +1702,19 @@ module Recurly
1630
1702
  # @param original [String] Filter by original field.
1631
1703
  # @param state [String] Filter by state field.
1632
1704
  # @param type [String] Filter by type field.
1705
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1633
1706
  # @return [Pager<Resources::LineItem>] A list of the site's line items.
1634
1707
  def list_line_items(**options)
1635
- path = interpolate_path("/sites/{site_id}/line_items", site_id: site_id)
1708
+ path = interpolate_path("/line_items")
1636
1709
  pager(path, **options)
1637
1710
  end
1638
1711
 
1639
1712
  # Fetch a line item
1640
1713
  #
1641
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_line_item get_line_item api documenation}
1714
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_line_item get_line_item api documenation}
1642
1715
  #
1643
1716
  # @param line_item_id [String] Line Item ID.
1717
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1644
1718
  # @return [Resources::LineItem] A line item.
1645
1719
  # @example
1646
1720
  # begin
@@ -1652,16 +1726,18 @@ module Recurly
1652
1726
  # puts "Resource Not Found"
1653
1727
  # end
1654
1728
  #
1655
- def get_line_item(line_item_id:)
1656
- path = interpolate_path("/sites/{site_id}/line_items/{line_item_id}", site_id: site_id, line_item_id: line_item_id)
1657
- get(path)
1729
+ def get_line_item(line_item_id:, **options)
1730
+ path = interpolate_path("/line_items/{line_item_id}", line_item_id: line_item_id)
1731
+ get(path, **options)
1658
1732
  end
1659
1733
 
1660
1734
  # Delete an uninvoiced line item
1661
1735
  #
1662
- # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_line_item remove_line_item api documenation}
1736
+ # {https://developers.recurly.com/api/v2019-10-10#operation/remove_line_item remove_line_item api documenation}
1663
1737
  #
1664
1738
  # @param line_item_id [String] Line Item ID.
1739
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1740
+ # @return [Empty] Line item deleted.
1665
1741
  # @example
1666
1742
  # begin
1667
1743
  # @client.remove_line_item(
@@ -1674,16 +1750,16 @@ module Recurly
1674
1750
  # puts "Resource Not Found"
1675
1751
  # end
1676
1752
  #
1677
- def remove_line_item(line_item_id:)
1678
- path = interpolate_path("/sites/{site_id}/line_items/{line_item_id}", site_id: site_id, line_item_id: line_item_id)
1679
- delete(path)
1753
+ def remove_line_item(line_item_id:, **options)
1754
+ path = interpolate_path("/line_items/{line_item_id}", line_item_id: line_item_id)
1755
+ delete(path, **options)
1680
1756
  end
1681
1757
 
1682
1758
  # List a site's plans
1683
1759
  #
1684
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_plans list_plans api documenation}
1760
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_plans list_plans api documenation}
1685
1761
  #
1686
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1762
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1687
1763
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1688
1764
  #
1689
1765
  # *Important notes:*
@@ -1708,6 +1784,7 @@ module Recurly
1708
1784
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1709
1785
  #
1710
1786
  # @param state [String] Filter by state.
1787
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1711
1788
  # @return [Pager<Resources::Plan>] A list of plans.
1712
1789
  # @example
1713
1790
  # plans = @client.list_plans(limit: 200)
@@ -1716,15 +1793,16 @@ module Recurly
1716
1793
  # end
1717
1794
  #
1718
1795
  def list_plans(**options)
1719
- path = interpolate_path("/sites/{site_id}/plans", site_id: site_id)
1796
+ path = interpolate_path("/plans")
1720
1797
  pager(path, **options)
1721
1798
  end
1722
1799
 
1723
1800
  # Create a plan
1724
1801
  #
1725
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_plan create_plan api documenation}
1802
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_plan create_plan api documenation}
1726
1803
  #
1727
1804
  # @param body [Requests::PlanCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PlanCreate}
1805
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1728
1806
  # @return [Resources::Plan] A plan.
1729
1807
  # @example
1730
1808
  # begin
@@ -1753,16 +1831,17 @@ module Recurly
1753
1831
  # puts "ValidationError: #{e.recurly_error.params}"
1754
1832
  # end
1755
1833
  #
1756
- def create_plan(body:)
1757
- path = interpolate_path("/sites/{site_id}/plans", site_id: site_id)
1758
- post(path, body, Requests::PlanCreate)
1834
+ def create_plan(body:, **options)
1835
+ path = interpolate_path("/plans")
1836
+ post(path, body, Requests::PlanCreate, **options)
1759
1837
  end
1760
1838
 
1761
1839
  # Fetch a plan
1762
1840
  #
1763
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_plan get_plan api documenation}
1841
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_plan get_plan api documenation}
1764
1842
  #
1765
1843
  # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+).
1844
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1766
1845
  # @return [Resources::Plan] A plan.
1767
1846
  # @example
1768
1847
  # begin
@@ -1774,40 +1853,42 @@ module Recurly
1774
1853
  # puts "Resource Not Found"
1775
1854
  # end
1776
1855
  #
1777
- def get_plan(plan_id:)
1778
- path = interpolate_path("/sites/{site_id}/plans/{plan_id}", site_id: site_id, plan_id: plan_id)
1779
- get(path)
1856
+ def get_plan(plan_id:, **options)
1857
+ path = interpolate_path("/plans/{plan_id}", plan_id: plan_id)
1858
+ get(path, **options)
1780
1859
  end
1781
1860
 
1782
1861
  # Update a plan
1783
1862
  #
1784
- # {https://partner-docs.recurly.com/v2018-08-09#operation/update_plan update_plan api documenation}
1863
+ # {https://developers.recurly.com/api/v2019-10-10#operation/update_plan update_plan api documenation}
1785
1864
  #
1786
1865
  # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+).
1787
1866
  # @param body [Requests::PlanUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PlanUpdate}
1867
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1788
1868
  # @return [Resources::Plan] A plan.
1789
- def update_plan(plan_id:, body:)
1790
- path = interpolate_path("/sites/{site_id}/plans/{plan_id}", site_id: site_id, plan_id: plan_id)
1791
- put(path, body, Requests::PlanUpdate)
1869
+ def update_plan(plan_id:, body:, **options)
1870
+ path = interpolate_path("/plans/{plan_id}", plan_id: plan_id)
1871
+ put(path, body, Requests::PlanUpdate, **options)
1792
1872
  end
1793
1873
 
1794
1874
  # Remove a plan
1795
1875
  #
1796
- # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_plan remove_plan api documenation}
1876
+ # {https://developers.recurly.com/api/v2019-10-10#operation/remove_plan remove_plan api documenation}
1797
1877
  #
1798
1878
  # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+).
1879
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1799
1880
  # @return [Resources::Plan] Plan deleted
1800
- def remove_plan(plan_id:)
1801
- path = interpolate_path("/sites/{site_id}/plans/{plan_id}", site_id: site_id, plan_id: plan_id)
1802
- delete(path)
1881
+ def remove_plan(plan_id:, **options)
1882
+ path = interpolate_path("/plans/{plan_id}", plan_id: plan_id)
1883
+ delete(path, **options)
1803
1884
  end
1804
1885
 
1805
1886
  # List a plan's add-ons
1806
1887
  #
1807
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_plan_add_ons list_plan_add_ons api documenation}
1888
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_plan_add_ons list_plan_add_ons api documenation}
1808
1889
  #
1809
1890
  # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+).
1810
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
1891
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1811
1892
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1812
1893
  #
1813
1894
  # *Important notes:*
@@ -1832,6 +1913,7 @@ module Recurly
1832
1913
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1833
1914
  #
1834
1915
  # @param state [String] Filter by state.
1916
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1835
1917
  # @return [Pager<Resources::AddOn>] A list of add-ons.
1836
1918
  # @example
1837
1919
  # add_ons = @client.list_plan_add_ons(
@@ -1843,28 +1925,30 @@ module Recurly
1843
1925
  # end
1844
1926
  #
1845
1927
  def list_plan_add_ons(plan_id:, **options)
1846
- path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons", site_id: site_id, plan_id: plan_id)
1928
+ path = interpolate_path("/plans/{plan_id}/add_ons", plan_id: plan_id)
1847
1929
  pager(path, **options)
1848
1930
  end
1849
1931
 
1850
1932
  # Create an add-on
1851
1933
  #
1852
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_plan_add_on create_plan_add_on api documenation}
1934
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_plan_add_on create_plan_add_on api documenation}
1853
1935
  #
1854
1936
  # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+).
1855
1937
  # @param body [Requests::AddOnCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AddOnCreate}
1938
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1856
1939
  # @return [Resources::AddOn] An add-on.
1857
- def create_plan_add_on(plan_id:, body:)
1858
- path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons", site_id: site_id, plan_id: plan_id)
1859
- post(path, body, Requests::AddOnCreate)
1940
+ def create_plan_add_on(plan_id:, body:, **options)
1941
+ path = interpolate_path("/plans/{plan_id}/add_ons", plan_id: plan_id)
1942
+ post(path, body, Requests::AddOnCreate, **options)
1860
1943
  end
1861
1944
 
1862
1945
  # Fetch a plan's add-on
1863
1946
  #
1864
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_plan_add_on get_plan_add_on api documenation}
1947
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_plan_add_on get_plan_add_on api documenation}
1865
1948
  #
1866
1949
  # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+).
1867
1950
  # @param add_on_id [String] Add-on ID or code (use prefix: +code-+, e.g. +code-gold+).
1951
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1868
1952
  # @return [Resources::AddOn] An add-on.
1869
1953
  # @example
1870
1954
  # begin
@@ -1878,41 +1962,43 @@ module Recurly
1878
1962
  # puts "Resource Not Found"
1879
1963
  # end
1880
1964
  #
1881
- def get_plan_add_on(plan_id:, add_on_id:)
1882
- path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons/{add_on_id}", site_id: site_id, plan_id: plan_id, add_on_id: add_on_id)
1883
- get(path)
1965
+ def get_plan_add_on(plan_id:, add_on_id:, **options)
1966
+ path = interpolate_path("/plans/{plan_id}/add_ons/{add_on_id}", plan_id: plan_id, add_on_id: add_on_id)
1967
+ get(path, **options)
1884
1968
  end
1885
1969
 
1886
1970
  # Update an add-on
1887
1971
  #
1888
- # {https://partner-docs.recurly.com/v2018-08-09#operation/update_plan_add_on update_plan_add_on api documenation}
1972
+ # {https://developers.recurly.com/api/v2019-10-10#operation/update_plan_add_on update_plan_add_on api documenation}
1889
1973
  #
1890
1974
  # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+).
1891
1975
  # @param add_on_id [String] Add-on ID or code (use prefix: +code-+, e.g. +code-gold+).
1892
1976
  # @param body [Requests::AddOnUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AddOnUpdate}
1977
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1893
1978
  # @return [Resources::AddOn] An add-on.
1894
- def update_plan_add_on(plan_id:, add_on_id:, body:)
1895
- path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons/{add_on_id}", site_id: site_id, plan_id: plan_id, add_on_id: add_on_id)
1896
- put(path, body, Requests::AddOnUpdate)
1979
+ def update_plan_add_on(plan_id:, add_on_id:, body:, **options)
1980
+ path = interpolate_path("/plans/{plan_id}/add_ons/{add_on_id}", plan_id: plan_id, add_on_id: add_on_id)
1981
+ put(path, body, Requests::AddOnUpdate, **options)
1897
1982
  end
1898
1983
 
1899
1984
  # Remove an add-on
1900
1985
  #
1901
- # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_plan_add_on remove_plan_add_on api documenation}
1986
+ # {https://developers.recurly.com/api/v2019-10-10#operation/remove_plan_add_on remove_plan_add_on api documenation}
1902
1987
  #
1903
1988
  # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+).
1904
1989
  # @param add_on_id [String] Add-on ID or code (use prefix: +code-+, e.g. +code-gold+).
1990
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1905
1991
  # @return [Resources::AddOn] Add-on deleted
1906
- def remove_plan_add_on(plan_id:, add_on_id:)
1907
- path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons/{add_on_id}", site_id: site_id, plan_id: plan_id, add_on_id: add_on_id)
1908
- delete(path)
1992
+ def remove_plan_add_on(plan_id:, add_on_id:, **options)
1993
+ path = interpolate_path("/plans/{plan_id}/add_ons/{add_on_id}", plan_id: plan_id, add_on_id: add_on_id)
1994
+ delete(path, **options)
1909
1995
  end
1910
1996
 
1911
1997
  # List a site's add-ons
1912
1998
  #
1913
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_add_ons list_add_ons api documenation}
1999
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_add_ons list_add_ons api documenation}
1914
2000
  #
1915
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
2001
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1916
2002
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1917
2003
  #
1918
2004
  # *Important notes:*
@@ -1937,28 +2023,77 @@ module Recurly
1937
2023
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
1938
2024
  #
1939
2025
  # @param state [String] Filter by state.
2026
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1940
2027
  # @return [Pager<Resources::AddOn>] A list of add-ons.
1941
2028
  def list_add_ons(**options)
1942
- path = interpolate_path("/sites/{site_id}/add_ons", site_id: site_id)
2029
+ path = interpolate_path("/add_ons")
1943
2030
  pager(path, **options)
1944
2031
  end
1945
2032
 
1946
2033
  # Fetch an add-on
1947
2034
  #
1948
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_add_on get_add_on api documenation}
2035
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_add_on get_add_on api documenation}
1949
2036
  #
1950
2037
  # @param add_on_id [String] Add-on ID or code (use prefix: +code-+, e.g. +code-gold+).
2038
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1951
2039
  # @return [Resources::AddOn] An add-on.
1952
- def get_add_on(add_on_id:)
1953
- path = interpolate_path("/sites/{site_id}/add_ons/{add_on_id}", site_id: site_id, add_on_id: add_on_id)
1954
- get(path)
2040
+ def get_add_on(add_on_id:, **options)
2041
+ path = interpolate_path("/add_ons/{add_on_id}", add_on_id: add_on_id)
2042
+ get(path, **options)
2043
+ end
2044
+
2045
+ # List a site's shipping methods
2046
+ #
2047
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_shipping_methods list_shipping_methods api documenation}
2048
+ #
2049
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
2050
+ # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
2051
+ #
2052
+ # *Important notes:*
2053
+ #
2054
+ # * The +ids+ parameter cannot be used with any other ordering or filtering
2055
+ # parameters (+limit+, +order+, +sort+, +begin_time+, +end_time+, etc)
2056
+ # * Invalid or unknown IDs will be ignored, so you should check that the
2057
+ # results correspond to your request.
2058
+ # * Records are returned in an arbitrary order. Since results are all
2059
+ # returned at once you can sort the records yourself.
2060
+ #
2061
+ # @param limit [Integer] Limit number of records 1-200.
2062
+ # @param order [String] Sort order.
2063
+ # @param sort [String] Sort field. You *really* only want to sort by +updated_at+ in ascending
2064
+ # order. In descending order updated records will move behind the cursor and could
2065
+ # prevent some records from being returned.
2066
+ #
2067
+ # @param begin_time [DateTime] Filter by begin_time when +sort=created_at+ or +sort=updated_at+.
2068
+ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
2069
+ #
2070
+ # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
2071
+ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
2072
+ #
2073
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2074
+ # @return [Pager<Resources::ShippingMethod>] A list of the site's shipping methods.
2075
+ def list_shipping_methods(**options)
2076
+ path = interpolate_path("/shipping_methods")
2077
+ pager(path, **options)
2078
+ end
2079
+
2080
+ # Fetch a shipping method
2081
+ #
2082
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_shipping_method get_shipping_method api documenation}
2083
+ #
2084
+ # @param id [String] Shipping Method ID or code (use prefix: +code-+, e.g. +code-usps_2-day+).
2085
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2086
+ # @return [Resources::ShippingMethod] A shipping_method.
2087
+ def get_shipping_method(id:, **options)
2088
+ path = interpolate_path("/shipping_methods/{id}", id: id)
2089
+ get(path, **options)
1955
2090
  end
1956
2091
 
1957
2092
  # List a site's subscriptions
1958
2093
  #
1959
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_subscriptions list_subscriptions api documenation}
2094
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_subscriptions list_subscriptions api documenation}
1960
2095
  #
1961
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
2096
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
1962
2097
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
1963
2098
  #
1964
2099
  # *Important notes:*
@@ -1988,6 +2123,7 @@ module Recurly
1988
2123
  # - When +state=in_trial+, only subscriptions that have a trial_started_at date earlier than now and a trial_ends_at date later than now will be returned.
1989
2124
  # - When +state=live+, only subscriptions that are in an active, canceled, or future state or are in trial will be returned.
1990
2125
  #
2126
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
1991
2127
  # @return [Pager<Resources::Subscription>] A list of the site's subscriptions.
1992
2128
  # @example
1993
2129
  # subscriptions = @client.list_subscriptions(limit: 200)
@@ -1996,15 +2132,16 @@ module Recurly
1996
2132
  # end
1997
2133
  #
1998
2134
  def list_subscriptions(**options)
1999
- path = interpolate_path("/sites/{site_id}/subscriptions", site_id: site_id)
2135
+ path = interpolate_path("/subscriptions")
2000
2136
  pager(path, **options)
2001
2137
  end
2002
2138
 
2003
2139
  # Create a new subscription
2004
2140
  #
2005
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_subscription create_subscription api documenation}
2141
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_subscription create_subscription api documenation}
2006
2142
  #
2007
2143
  # @param body [Requests::SubscriptionCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionCreate}
2144
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2008
2145
  # @return [Resources::Subscription] A subscription.
2009
2146
  # @example
2010
2147
  # begin
@@ -2027,16 +2164,17 @@ module Recurly
2027
2164
  # puts "ValidationError: #{e.recurly_error.params}"
2028
2165
  # end
2029
2166
  #
2030
- def create_subscription(body:)
2031
- path = interpolate_path("/sites/{site_id}/subscriptions", site_id: site_id)
2032
- post(path, body, Requests::SubscriptionCreate)
2167
+ def create_subscription(body:, **options)
2168
+ path = interpolate_path("/subscriptions")
2169
+ post(path, body, Requests::SubscriptionCreate, **options)
2033
2170
  end
2034
2171
 
2035
2172
  # Fetch a subscription
2036
2173
  #
2037
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_subscription get_subscription api documenation}
2174
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_subscription get_subscription api documenation}
2038
2175
  #
2039
2176
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2177
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2040
2178
  # @return [Resources::Subscription] A subscription.
2041
2179
  # @example
2042
2180
  # begin
@@ -2050,17 +2188,18 @@ module Recurly
2050
2188
  # puts "Resource Not Found"
2051
2189
  # end
2052
2190
  #
2053
- def get_subscription(subscription_id:)
2054
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}", site_id: site_id, subscription_id: subscription_id)
2055
- get(path)
2191
+ def get_subscription(subscription_id:, **options)
2192
+ path = interpolate_path("/subscriptions/{subscription_id}", subscription_id: subscription_id)
2193
+ get(path, **options)
2056
2194
  end
2057
2195
 
2058
2196
  # Modify a subscription
2059
2197
  #
2060
- # {https://partner-docs.recurly.com/v2018-08-09#operation/modify_subscription modify_subscription api documenation}
2198
+ # {https://developers.recurly.com/api/v2019-10-10#operation/modify_subscription modify_subscription api documenation}
2061
2199
  #
2062
2200
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2063
2201
  # @param body [Requests::SubscriptionUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionUpdate}
2202
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2064
2203
  # @return [Resources::Subscription] A subscription.
2065
2204
  # @example
2066
2205
  # begin
@@ -2079,14 +2218,14 @@ module Recurly
2079
2218
  # puts "ValidationError: #{e.recurly_error.params}"
2080
2219
  # end
2081
2220
  #
2082
- def modify_subscription(subscription_id:, body:)
2083
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}", site_id: site_id, subscription_id: subscription_id)
2084
- put(path, body, Requests::SubscriptionUpdate)
2221
+ def modify_subscription(subscription_id:, body:, **options)
2222
+ path = interpolate_path("/subscriptions/{subscription_id}", subscription_id: subscription_id)
2223
+ put(path, body, Requests::SubscriptionUpdate, **options)
2085
2224
  end
2086
2225
 
2087
2226
  # Terminate a subscription
2088
2227
  #
2089
- # {https://partner-docs.recurly.com/v2018-08-09#operation/terminate_subscription terminate_subscription api documenation}
2228
+ # {https://developers.recurly.com/api/v2019-10-10#operation/terminate_subscription terminate_subscription api documenation}
2090
2229
  #
2091
2230
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2092
2231
  # @param refund [String] The type of refund to perform:
@@ -2099,6 +2238,7 @@ module Recurly
2099
2238
  #
2100
2239
  # You may also terminate a subscription with no refund and then manually refund specific invoices.
2101
2240
  #
2241
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2102
2242
  # @return [Resources::Subscription] An expired subscription.
2103
2243
  # @example
2104
2244
  # begin
@@ -2113,15 +2253,16 @@ module Recurly
2113
2253
  # end
2114
2254
  #
2115
2255
  def terminate_subscription(subscription_id:, **options)
2116
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}", site_id: site_id, subscription_id: subscription_id)
2256
+ path = interpolate_path("/subscriptions/{subscription_id}", subscription_id: subscription_id)
2117
2257
  delete(path, **options)
2118
2258
  end
2119
2259
 
2120
2260
  # Cancel a subscription
2121
2261
  #
2122
- # {https://partner-docs.recurly.com/v2018-08-09#operation/cancel_subscription cancel_subscription api documenation}
2262
+ # {https://developers.recurly.com/api/v2019-10-10#operation/cancel_subscription cancel_subscription api documenation}
2123
2263
  #
2124
2264
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2265
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2125
2266
  # @return [Resources::Subscription] A canceled or failed subscription.
2126
2267
  # @example
2127
2268
  # begin
@@ -2135,16 +2276,17 @@ module Recurly
2135
2276
  # puts "Resource Not Found"
2136
2277
  # end
2137
2278
  #
2138
- def cancel_subscription(subscription_id:)
2139
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/cancel", site_id: site_id, subscription_id: subscription_id)
2140
- put(path)
2279
+ def cancel_subscription(subscription_id:, **options)
2280
+ path = interpolate_path("/subscriptions/{subscription_id}/cancel", subscription_id: subscription_id)
2281
+ put(path, **options)
2141
2282
  end
2142
2283
 
2143
2284
  # Reactivate a canceled subscription
2144
2285
  #
2145
- # {https://partner-docs.recurly.com/v2018-08-09#operation/reactivate_subscription reactivate_subscription api documenation}
2286
+ # {https://developers.recurly.com/api/v2019-10-10#operation/reactivate_subscription reactivate_subscription api documenation}
2146
2287
  #
2147
2288
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2289
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2148
2290
  # @return [Resources::Subscription] An active subscription.
2149
2291
  # @example
2150
2292
  # begin
@@ -2158,17 +2300,18 @@ module Recurly
2158
2300
  # puts "Resource Not Found"
2159
2301
  # end
2160
2302
  #
2161
- def reactivate_subscription(subscription_id:)
2162
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/reactivate", site_id: site_id, subscription_id: subscription_id)
2163
- put(path)
2303
+ def reactivate_subscription(subscription_id:, **options)
2304
+ path = interpolate_path("/subscriptions/{subscription_id}/reactivate", subscription_id: subscription_id)
2305
+ put(path, **options)
2164
2306
  end
2165
2307
 
2166
2308
  # Pause subscription
2167
2309
  #
2168
- # {https://partner-docs.recurly.com/v2018-08-09#operation/pause_subscription pause_subscription api documenation}
2310
+ # {https://developers.recurly.com/api/v2019-10-10#operation/pause_subscription pause_subscription api documenation}
2169
2311
  #
2170
2312
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2171
2313
  # @param body [Requests::SubscriptionPause] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionPause}
2314
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2172
2315
  # @return [Resources::Subscription] A subscription.
2173
2316
  # @example
2174
2317
  # begin
@@ -2186,16 +2329,17 @@ module Recurly
2186
2329
  # puts "Resource Not Found"
2187
2330
  # end
2188
2331
  #
2189
- def pause_subscription(subscription_id:, body:)
2190
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/pause", site_id: site_id, subscription_id: subscription_id)
2191
- put(path, body, Requests::SubscriptionPause)
2332
+ def pause_subscription(subscription_id:, body:, **options)
2333
+ path = interpolate_path("/subscriptions/{subscription_id}/pause", subscription_id: subscription_id)
2334
+ put(path, body, Requests::SubscriptionPause, **options)
2192
2335
  end
2193
2336
 
2194
2337
  # Resume subscription
2195
2338
  #
2196
- # {https://partner-docs.recurly.com/v2018-08-09#operation/resume_subscription resume_subscription api documenation}
2339
+ # {https://developers.recurly.com/api/v2019-10-10#operation/resume_subscription resume_subscription api documenation}
2197
2340
  #
2198
2341
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2342
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2199
2343
  # @return [Resources::Subscription] A subscription.
2200
2344
  # @example
2201
2345
  # begin
@@ -2209,16 +2353,17 @@ module Recurly
2209
2353
  # puts "Resource Not Found"
2210
2354
  # end
2211
2355
  #
2212
- def resume_subscription(subscription_id:)
2213
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/resume", site_id: site_id, subscription_id: subscription_id)
2214
- put(path)
2356
+ def resume_subscription(subscription_id:, **options)
2357
+ path = interpolate_path("/subscriptions/{subscription_id}/resume", subscription_id: subscription_id)
2358
+ put(path, **options)
2215
2359
  end
2216
2360
 
2217
2361
  # Fetch a subscription's pending change
2218
2362
  #
2219
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_subscription_change get_subscription_change api documenation}
2363
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_subscription_change get_subscription_change api documenation}
2220
2364
  #
2221
2365
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2366
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2222
2367
  # @return [Resources::SubscriptionChange] A subscription's pending change.
2223
2368
  # @example
2224
2369
  # begin
@@ -2232,17 +2377,18 @@ module Recurly
2232
2377
  # puts "Resource Not Found"
2233
2378
  # end
2234
2379
  #
2235
- def get_subscription_change(subscription_id:)
2236
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/change", site_id: site_id, subscription_id: subscription_id)
2237
- get(path)
2380
+ def get_subscription_change(subscription_id:, **options)
2381
+ path = interpolate_path("/subscriptions/{subscription_id}/change", subscription_id: subscription_id)
2382
+ get(path, **options)
2238
2383
  end
2239
2384
 
2240
2385
  # Create a new subscription change
2241
2386
  #
2242
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_subscription_change create_subscription_change api documenation}
2387
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_subscription_change create_subscription_change api documenation}
2243
2388
  #
2244
2389
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2245
2390
  # @param body [Requests::SubscriptionChangeCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionChangeCreate}
2391
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2246
2392
  # @return [Resources::SubscriptionChange] A subscription change.
2247
2393
  # @example
2248
2394
  # begin
@@ -2261,16 +2407,18 @@ module Recurly
2261
2407
  # puts "ValidationError: #{e.recurly_error.params}"
2262
2408
  # end
2263
2409
  #
2264
- def create_subscription_change(subscription_id:, body:)
2265
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/change", site_id: site_id, subscription_id: subscription_id)
2266
- post(path, body, Requests::SubscriptionChangeCreate)
2410
+ def create_subscription_change(subscription_id:, body:, **options)
2411
+ path = interpolate_path("/subscriptions/{subscription_id}/change", subscription_id: subscription_id)
2412
+ post(path, body, Requests::SubscriptionChangeCreate, **options)
2267
2413
  end
2268
2414
 
2269
2415
  # Delete the pending subscription change
2270
2416
  #
2271
- # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_subscription_change remove_subscription_change api documenation}
2417
+ # {https://developers.recurly.com/api/v2019-10-10#operation/remove_subscription_change remove_subscription_change api documenation}
2272
2418
  #
2273
2419
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2420
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2421
+ # @return [Empty] Subscription change was deleted.
2274
2422
  # @example
2275
2423
  # begin
2276
2424
  # @client.remove_subscription_change(
@@ -2283,17 +2431,17 @@ module Recurly
2283
2431
  # puts "Resource Not Found"
2284
2432
  # end
2285
2433
  #
2286
- def remove_subscription_change(subscription_id:)
2287
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/change", site_id: site_id, subscription_id: subscription_id)
2288
- delete(path)
2434
+ def remove_subscription_change(subscription_id:, **options)
2435
+ path = interpolate_path("/subscriptions/{subscription_id}/change", subscription_id: subscription_id)
2436
+ delete(path, **options)
2289
2437
  end
2290
2438
 
2291
2439
  # List a subscription's invoices
2292
2440
  #
2293
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_subscription_invoices list_subscription_invoices api documenation}
2441
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_subscription_invoices list_subscription_invoices api documenation}
2294
2442
  #
2295
2443
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2296
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
2444
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
2297
2445
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
2298
2446
  #
2299
2447
  # *Important notes:*
@@ -2323,6 +2471,7 @@ module Recurly
2323
2471
  # - +type=non-legacy+, only charge and credit invoices will be returned.
2324
2472
  # - +type=legacy+, only legacy invoices will be returned.
2325
2473
  #
2474
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2326
2475
  # @return [Pager<Resources::Invoice>] A list of the subscription's invoices.
2327
2476
  # @example
2328
2477
  # invoices = @client.list_subscription_invoices(
@@ -2334,16 +2483,16 @@ module Recurly
2334
2483
  # end
2335
2484
  #
2336
2485
  def list_subscription_invoices(subscription_id:, **options)
2337
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/invoices", site_id: site_id, subscription_id: subscription_id)
2486
+ path = interpolate_path("/subscriptions/{subscription_id}/invoices", subscription_id: subscription_id)
2338
2487
  pager(path, **options)
2339
2488
  end
2340
2489
 
2341
2490
  # List a subscription's line items
2342
2491
  #
2343
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_subscription_line_items list_subscription_line_items api documenation}
2492
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_subscription_line_items list_subscription_line_items api documenation}
2344
2493
  #
2345
2494
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2346
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
2495
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
2347
2496
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
2348
2497
  #
2349
2498
  # *Important notes:*
@@ -2370,6 +2519,7 @@ module Recurly
2370
2519
  # @param original [String] Filter by original field.
2371
2520
  # @param state [String] Filter by state field.
2372
2521
  # @param type [String] Filter by type field.
2522
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2373
2523
  # @return [Pager<Resources::LineItem>] A list of the subscription's line items.
2374
2524
  # @example
2375
2525
  # line_items = @client.list_subscription_line_items(
@@ -2381,16 +2531,16 @@ module Recurly
2381
2531
  # end
2382
2532
  #
2383
2533
  def list_subscription_line_items(subscription_id:, **options)
2384
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/line_items", site_id: site_id, subscription_id: subscription_id)
2534
+ path = interpolate_path("/subscriptions/{subscription_id}/line_items", subscription_id: subscription_id)
2385
2535
  pager(path, **options)
2386
2536
  end
2387
2537
 
2388
2538
  # Show the coupon redemptions for a subscription
2389
2539
  #
2390
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_subscription_coupon_redemptions list_subscription_coupon_redemptions api documenation}
2540
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_subscription_coupon_redemptions list_subscription_coupon_redemptions api documenation}
2391
2541
  #
2392
2542
  # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2393
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
2543
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
2394
2544
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
2395
2545
  #
2396
2546
  # *Important notes:*
@@ -2412,6 +2562,7 @@ module Recurly
2412
2562
  # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+.
2413
2563
  # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
2414
2564
  #
2565
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2415
2566
  # @return [Pager<Resources::CouponRedemption>] A list of the the coupon redemptions on a subscription.
2416
2567
  # @example
2417
2568
  # coupon_redemptions = @client.list_subscription_coupon_redemptions(
@@ -2423,15 +2574,15 @@ module Recurly
2423
2574
  # end
2424
2575
  #
2425
2576
  def list_subscription_coupon_redemptions(subscription_id:, **options)
2426
- path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/coupon_redemptions", site_id: site_id, subscription_id: subscription_id)
2577
+ path = interpolate_path("/subscriptions/{subscription_id}/coupon_redemptions", subscription_id: subscription_id)
2427
2578
  pager(path, **options)
2428
2579
  end
2429
2580
 
2430
2581
  # List a site's transactions
2431
2582
  #
2432
- # {https://partner-docs.recurly.com/v2018-08-09#operation/list_transactions list_transactions api documenation}
2583
+ # {https://developers.recurly.com/api/v2019-10-10#operation/list_transactions list_transactions api documenation}
2433
2584
  #
2434
- # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using
2585
+ # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
2435
2586
  # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
2436
2587
  #
2437
2588
  # *Important notes:*
@@ -2457,6 +2608,7 @@ module Recurly
2457
2608
  #
2458
2609
  # @param type [String] Filter by type field. The value +payment+ will return both +purchase+ and +capture+ transactions.
2459
2610
  # @param success [String] Filter by success field.
2611
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2460
2612
  # @return [Pager<Resources::Transaction>] A list of the site's transactions.
2461
2613
  # @example
2462
2614
  # transactions = @client.list_transactions(limit: 200)
@@ -2465,15 +2617,16 @@ module Recurly
2465
2617
  # end
2466
2618
  #
2467
2619
  def list_transactions(**options)
2468
- path = interpolate_path("/sites/{site_id}/transactions", site_id: site_id)
2620
+ path = interpolate_path("/transactions")
2469
2621
  pager(path, **options)
2470
2622
  end
2471
2623
 
2472
2624
  # Fetch a transaction
2473
2625
  #
2474
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_transaction get_transaction api documenation}
2626
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_transaction get_transaction api documenation}
2475
2627
  #
2476
2628
  # @param transaction_id [String] Transaction ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+).
2629
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2477
2630
  # @return [Resources::Transaction] A transaction.
2478
2631
  # @example
2479
2632
  # begin
@@ -2485,49 +2638,53 @@ module Recurly
2485
2638
  # puts "Resource Not Found"
2486
2639
  # end
2487
2640
  #
2488
- def get_transaction(transaction_id:)
2489
- path = interpolate_path("/sites/{site_id}/transactions/{transaction_id}", site_id: site_id, transaction_id: transaction_id)
2490
- get(path)
2641
+ def get_transaction(transaction_id:, **options)
2642
+ path = interpolate_path("/transactions/{transaction_id}", transaction_id: transaction_id)
2643
+ get(path, **options)
2491
2644
  end
2492
2645
 
2493
2646
  # Fetch a unique coupon code
2494
2647
  #
2495
- # {https://partner-docs.recurly.com/v2018-08-09#operation/get_unique_coupon_code get_unique_coupon_code api documenation}
2648
+ # {https://developers.recurly.com/api/v2019-10-10#operation/get_unique_coupon_code get_unique_coupon_code api documenation}
2496
2649
  #
2497
2650
  # @param unique_coupon_code_id [String] Unique Coupon Code ID or code (use prefix: +code-+, e.g. +code-abc-8dh2-def+).
2651
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2498
2652
  # @return [Resources::UniqueCouponCode] A unique coupon code.
2499
- def get_unique_coupon_code(unique_coupon_code_id:)
2500
- path = interpolate_path("/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}", site_id: site_id, unique_coupon_code_id: unique_coupon_code_id)
2501
- get(path)
2653
+ def get_unique_coupon_code(unique_coupon_code_id:, **options)
2654
+ path = interpolate_path("/unique_coupon_codes/{unique_coupon_code_id}", unique_coupon_code_id: unique_coupon_code_id)
2655
+ get(path, **options)
2502
2656
  end
2503
2657
 
2504
2658
  # Deactivate a unique coupon code
2505
2659
  #
2506
- # {https://partner-docs.recurly.com/v2018-08-09#operation/deactivate_unique_coupon_code deactivate_unique_coupon_code api documenation}
2660
+ # {https://developers.recurly.com/api/v2019-10-10#operation/deactivate_unique_coupon_code deactivate_unique_coupon_code api documenation}
2507
2661
  #
2508
2662
  # @param unique_coupon_code_id [String] Unique Coupon Code ID or code (use prefix: +code-+, e.g. +code-abc-8dh2-def+).
2663
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2509
2664
  # @return [Resources::UniqueCouponCode] A unique coupon code.
2510
- def deactivate_unique_coupon_code(unique_coupon_code_id:)
2511
- path = interpolate_path("/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}", site_id: site_id, unique_coupon_code_id: unique_coupon_code_id)
2512
- delete(path)
2665
+ def deactivate_unique_coupon_code(unique_coupon_code_id:, **options)
2666
+ path = interpolate_path("/unique_coupon_codes/{unique_coupon_code_id}", unique_coupon_code_id: unique_coupon_code_id)
2667
+ delete(path, **options)
2513
2668
  end
2514
2669
 
2515
2670
  # Restore a unique coupon code
2516
2671
  #
2517
- # {https://partner-docs.recurly.com/v2018-08-09#operation/reactivate_unique_coupon_code reactivate_unique_coupon_code api documenation}
2672
+ # {https://developers.recurly.com/api/v2019-10-10#operation/reactivate_unique_coupon_code reactivate_unique_coupon_code api documenation}
2518
2673
  #
2519
2674
  # @param unique_coupon_code_id [String] Unique Coupon Code ID or code (use prefix: +code-+, e.g. +code-abc-8dh2-def+).
2675
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2520
2676
  # @return [Resources::UniqueCouponCode] A unique coupon code.
2521
- def reactivate_unique_coupon_code(unique_coupon_code_id:)
2522
- path = interpolate_path("/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}/restore", site_id: site_id, unique_coupon_code_id: unique_coupon_code_id)
2523
- put(path)
2677
+ def reactivate_unique_coupon_code(unique_coupon_code_id:, **options)
2678
+ path = interpolate_path("/unique_coupon_codes/{unique_coupon_code_id}/restore", unique_coupon_code_id: unique_coupon_code_id)
2679
+ put(path, **options)
2524
2680
  end
2525
2681
 
2526
2682
  # Create a new purchase
2527
2683
  #
2528
- # {https://partner-docs.recurly.com/v2018-08-09#operation/create_purchase create_purchase api documenation}
2684
+ # {https://developers.recurly.com/api/v2019-10-10#operation/create_purchase create_purchase api documenation}
2529
2685
  #
2530
2686
  # @param body [Requests::PurchaseCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PurchaseCreate}
2687
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2531
2688
  # @return [Resources::InvoiceCollection] Returns the new invoices
2532
2689
  # @example
2533
2690
  # begin
@@ -2556,16 +2713,17 @@ module Recurly
2556
2713
  # puts "ValidationError: #{e.recurly_error.params}"
2557
2714
  # end
2558
2715
  #
2559
- def create_purchase(body:)
2560
- path = interpolate_path("/sites/{site_id}/purchases", site_id: site_id)
2561
- post(path, body, Requests::PurchaseCreate)
2716
+ def create_purchase(body:, **options)
2717
+ path = interpolate_path("/purchases")
2718
+ post(path, body, Requests::PurchaseCreate, **options)
2562
2719
  end
2563
2720
 
2564
2721
  # Preview a new purchase
2565
2722
  #
2566
- # {https://partner-docs.recurly.com/v2018-08-09#operation/preview_purchase preview_purchase api documenation}
2723
+ # {https://developers.recurly.com/api/v2019-10-10#operation/preview_purchase preview_purchase api documenation}
2567
2724
  #
2568
2725
  # @param body [Requests::PurchaseCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PurchaseCreate}
2726
+ # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+).
2569
2727
  # @return [Resources::InvoiceCollection] Returns preview of the new invoices
2570
2728
  # @example
2571
2729
  # begin
@@ -2594,9 +2752,9 @@ module Recurly
2594
2752
  # puts "ValidationError: #{e.recurly_error.params}"
2595
2753
  # end
2596
2754
  #
2597
- def preview_purchase(body:)
2598
- path = interpolate_path("/sites/{site_id}/purchases/preview", site_id: site_id)
2599
- post(path, body, Requests::PurchaseCreate)
2755
+ def preview_purchase(body:, **options)
2756
+ path = interpolate_path("/purchases/preview")
2757
+ post(path, body, Requests::PurchaseCreate, **options)
2600
2758
  end
2601
2759
  end
2602
2760
  end