recurly 3.5.0 → 3.10.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.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +5 -1
- data/CHANGELOG.md +73 -2
- data/GETTING_STARTED.md +61 -1
- data/lib/recurly/client.rb +79 -26
- data/lib/recurly/client/operations.rb +662 -57
- data/lib/recurly/errors/api_errors.rb +59 -17
- data/lib/recurly/requests/add_on_create.rb +24 -4
- data/lib/recurly/requests/add_on_update.rb +13 -1
- data/lib/recurly/requests/billing_info_create.rb +11 -3
- data/lib/recurly/requests/external_transaction.rb +26 -0
- data/lib/recurly/requests/measured_unit_create.rb +22 -0
- data/lib/recurly/requests/measured_unit_update.rb +22 -0
- data/lib/recurly/requests/plan_create.rb +8 -0
- data/lib/recurly/requests/plan_update.rb +8 -0
- data/lib/recurly/requests/shipping_method_create.rb +26 -0
- data/lib/recurly/requests/shipping_method_update.rb +26 -0
- data/lib/recurly/requests/subscription_add_on_create.rb +10 -2
- data/lib/recurly/requests/subscription_add_on_update.rb +11 -3
- data/lib/recurly/requests/subscription_change_create.rb +1 -1
- data/lib/recurly/requests/subscription_purchase.rb +4 -0
- data/lib/recurly/requests/usage_create.rb +26 -0
- data/lib/recurly/resources/add_on.rb +16 -0
- data/lib/recurly/resources/add_on_mini.rb +16 -0
- data/lib/recurly/resources/line_item.rb +1 -1
- data/lib/recurly/resources/measured_unit.rb +46 -0
- data/lib/recurly/resources/payment_method.rb +4 -0
- data/lib/recurly/resources/plan.rb +8 -0
- data/lib/recurly/resources/shipping_method.rb +4 -0
- data/lib/recurly/resources/subscription_add_on.rb +13 -1
- data/lib/recurly/resources/subscription_change.rb +4 -0
- data/lib/recurly/resources/subscription_change_preview.rb +74 -0
- data/lib/recurly/resources/transaction.rb +4 -0
- data/lib/recurly/resources/usage.rb +62 -0
- data/lib/recurly/version.rb +1 -1
- data/openapi/api.yaml +6242 -2891
- data/recurly.gemspec +1 -1
- data/scripts/format +5 -1
- metadata +13 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7d857cb4a3518eff0cb56f9518a8f93b2829ac45d65f4d6f429e10daa3eae5d
|
4
|
+
data.tar.gz: cb9e846114ce261826384d9b31c07e3bea034b66c9b620f282881bf54da4bbdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7fd02b347d535184984466a90f912175ee66c2430d3be37b709bb5111f54ee431a69d92973f1c956e54b6fbfaf541e273c3de32e0314fecdb2cb9bf1f118a37
|
7
|
+
data.tar.gz: 6b00f68f2b06058c1a6591cbee95b0f25cfb4cdfd269b627209464955dc3078fbbdedf66f3ca1df94e17382d0067345f6440cb0f00590e976d368654c5fd7a21
|
data/.bumpversion.cfg
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[bumpversion]
|
2
|
-
current_version = 3.
|
2
|
+
current_version = 3.10.0
|
3
3
|
parse = (?P<major>\d+)
|
4
4
|
\.(?P<minor>\d+)
|
5
5
|
\.(?P<patch>\d+)
|
@@ -10,3 +10,7 @@ serialize =
|
|
10
10
|
|
11
11
|
[bumpversion:file:lib/recurly/version.rb]
|
12
12
|
|
13
|
+
[bumpversion:file:GETTING_STARTED.md]
|
14
|
+
parse = (?P<major>\d+)\.(?P<minor>\d+)
|
15
|
+
serialize = {major}.{minor}
|
16
|
+
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,79 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [3.
|
3
|
+
## [3.10.0](https://github.com/recurly/recurly-client-ruby/tree/HEAD)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.
|
5
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.9.0...HEAD)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Latest Changes for 2019-10-10 \(usage, measured units, etc\) [\#621](https://github.com/recurly/recurly-client-ruby/pull/621) ([bhelx](https://github.com/bhelx))
|
10
|
+
- Adding hierarchical errors [\#610](https://github.com/recurly/recurly-client-ruby/pull/610) ([douglasmiller](https://github.com/douglasmiller))
|
11
|
+
|
12
|
+
**Merged pull requests:**
|
13
|
+
|
14
|
+
- Release 3.10.0 [\#623](https://github.com/recurly/recurly-client-ruby/pull/623) ([douglasmiller](https://github.com/douglasmiller))
|
15
|
+
|
16
|
+
## [3.9.0](https://github.com/recurly/recurly-client-ruby/tree/3.9.0) (2020-07-06)
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.8.0...3.9.0)
|
19
|
+
|
20
|
+
**Implemented enhancements:**
|
21
|
+
|
22
|
+
- Mon Jul 6 14:48:05 UTC 2020 Upgrade API version v2019-10-10 [\#608](https://github.com/recurly/recurly-client-ruby/pull/608) ([douglasmiller](https://github.com/douglasmiller))
|
23
|
+
|
24
|
+
**Merged pull requests:**
|
25
|
+
|
26
|
+
- Release 3.9.0 [\#609](https://github.com/recurly/recurly-client-ruby/pull/609) ([douglasmiller](https://github.com/douglasmiller))
|
27
|
+
|
28
|
+
## [3.8.0](https://github.com/recurly/recurly-client-ruby/tree/3.8.0) (2020-07-01)
|
29
|
+
|
30
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.7.0...3.8.0)
|
31
|
+
|
32
|
+
**Implemented enhancements:**
|
33
|
+
|
34
|
+
- Wed Jul 1 02:06:24 UTC 2020 Upgrade API version v2019-10-10 [\#605](https://github.com/recurly/recurly-client-ruby/pull/605) ([douglasmiller](https://github.com/douglasmiller))
|
35
|
+
|
36
|
+
**Merged pull requests:**
|
37
|
+
|
38
|
+
- Release 3.8.0 [\#606](https://github.com/recurly/recurly-client-ruby/pull/606) ([douglasmiller](https://github.com/douglasmiller))
|
39
|
+
|
40
|
+
## [3.7.0](https://github.com/recurly/recurly-client-ruby/tree/3.7.0) (2020-06-30)
|
41
|
+
|
42
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.6.0...3.7.0)
|
43
|
+
|
44
|
+
**Implemented enhancements:**
|
45
|
+
|
46
|
+
- Mon Jun 29 17:01:25 UTC 2020 Upgrade API version v2019-10-10 [\#601](https://github.com/recurly/recurly-client-ruby/pull/601) ([douglasmiller](https://github.com/douglasmiller))
|
47
|
+
|
48
|
+
**Fixed bugs:**
|
49
|
+
|
50
|
+
- Allow :headers to be included in operations [\#597](https://github.com/recurly/recurly-client-ruby/pull/597) ([douglasmiller](https://github.com/douglasmiller))
|
51
|
+
|
52
|
+
**Merged pull requests:**
|
53
|
+
|
54
|
+
- Release 3.7.0 [\#602](https://github.com/recurly/recurly-client-ruby/pull/602) ([douglasmiller](https://github.com/douglasmiller))
|
55
|
+
- Fix doc link [\#596](https://github.com/recurly/recurly-client-ruby/pull/596) ([bhelx](https://github.com/bhelx))
|
56
|
+
|
57
|
+
## [3.6.0](https://github.com/recurly/recurly-client-ruby/tree/3.6.0) (2020-06-01)
|
58
|
+
|
59
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.5.0...3.6.0)
|
60
|
+
|
61
|
+
**Implemented enhancements:**
|
62
|
+
|
63
|
+
- Latest Features [\#592](https://github.com/recurly/recurly-client-ruby/pull/592) ([bhelx](https://github.com/bhelx))
|
64
|
+
- Support the programmer passing their own logger [\#590](https://github.com/recurly/recurly-client-ruby/pull/590) ([bhelx](https://github.com/bhelx))
|
65
|
+
|
66
|
+
**Merged pull requests:**
|
67
|
+
|
68
|
+
- Release 3.6.0 [\#594](https://github.com/recurly/recurly-client-ruby/pull/594) ([bhelx](https://github.com/bhelx))
|
69
|
+
- Better format error message [\#593](https://github.com/recurly/recurly-client-ruby/pull/593) ([bhelx](https://github.com/bhelx))
|
70
|
+
- Let bump2version manage the getting started doc [\#591](https://github.com/recurly/recurly-client-ruby/pull/591) ([bhelx](https://github.com/bhelx))
|
71
|
+
- Document `Pager#first` and `Pager#count` [\#589](https://github.com/recurly/recurly-client-ruby/pull/589) ([bhelx](https://github.com/bhelx))
|
72
|
+
- Ensure that path parameters are not empty strings [\#587](https://github.com/recurly/recurly-client-ruby/pull/587) ([douglasmiller](https://github.com/douglasmiller))
|
73
|
+
|
74
|
+
## [3.5.0](https://github.com/recurly/recurly-client-ruby/tree/3.5.0) (2020-04-20)
|
75
|
+
|
76
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.4.1...3.5.0)
|
6
77
|
|
7
78
|
**Implemented enhancements:**
|
8
79
|
|
data/GETTING_STARTED.md
CHANGED
@@ -5,7 +5,7 @@ This repository houses the official ruby client for Recurly's V3 API.
|
|
5
5
|
In your Gemfile, add `recurly` as a dependency.
|
6
6
|
|
7
7
|
```ruby
|
8
|
-
gem 'recurly', '~> 3.
|
8
|
+
gem 'recurly', '~> 3.10'
|
9
9
|
```
|
10
10
|
|
11
11
|
> *Note*: We try to follow [semantic versioning](https://semver.org/) and will only apply breaking changes to major versions.
|
@@ -41,6 +41,27 @@ client = Recurly::Client.new(api_key: API_KEY2)
|
|
41
41
|
sub = client.get_subscription(subscription_id: 'abcd7890')
|
42
42
|
```
|
43
43
|
|
44
|
+
## Logging
|
45
|
+
|
46
|
+
The client constructor optionally accepts a logger provided by the programmer. The logger you pass should be an instance of ruby stdlib's [Logger](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html)
|
47
|
+
or follow the same interface. By default, the client creates a logger to `STDOUT` with level `WARN`.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
require 'logger'
|
51
|
+
|
52
|
+
# Create a logger to STDOUT
|
53
|
+
logger = Logger.new(STDOUT)
|
54
|
+
logger.level = Logger::INFO
|
55
|
+
|
56
|
+
# You could also use an existing logger
|
57
|
+
# If you are using Rails you may want to use your application's logger
|
58
|
+
logger = Rails.logger
|
59
|
+
|
60
|
+
client = Recurly::Client.new(api_key: API_KEY, logger: logger)
|
61
|
+
```
|
62
|
+
|
63
|
+
> *SECURITY WARNING*: The log level should never be set to DEBUG in production. This could potentially result in sensitive data in your logging system.
|
64
|
+
|
44
65
|
# Operations
|
45
66
|
|
46
67
|
The {Recurly::Client} contains every `operation` you can perform on the site as a list of methods. Each method is documented explaining
|
@@ -109,6 +130,45 @@ end
|
|
109
130
|
`limit` defaults to 20 items per page and can be set from 1 to 200. Choosing a lower limit means more network requests but smaller payloads.
|
110
131
|
We recommend keeping the default for most cases but increasing the limit if you are planning on iterating through many pages of items (e.g. all transactions in your site).
|
111
132
|
|
133
|
+
## Efficiently Fetch the First or Last Resource
|
134
|
+
|
135
|
+
The Pager class implements a first method which allows you to fetch just the first or last resource from the server. On top of being a convenient abstraction, this is implemented efficiently by only asking the server for the 1 item you want.
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
accounts = client.list_accounts(
|
139
|
+
subscriber: true,
|
140
|
+
order: :desc
|
141
|
+
)
|
142
|
+
|
143
|
+
last_subscriber = accounts.first
|
144
|
+
```
|
145
|
+
|
146
|
+
If you want to fetch the last account in this scenario, invert the order from descending `desc` to ascending `asc`:
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
accounts = client.list_accounts(
|
150
|
+
subscriber: true,
|
151
|
+
order: :asc
|
152
|
+
)
|
153
|
+
|
154
|
+
first_subscriber = accounts.first
|
155
|
+
```
|
156
|
+
|
157
|
+
## Counting Resources
|
158
|
+
|
159
|
+
The Pager class implements a `count` method which allows you to count the resources the pager would return. It does so by calling the endpoint with `HEAD` and parsing and returning the `Recurly-Total-Records` header. This method respects any filtering parameters you apply to the pager, but the sorting parameters will have no effect.
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
accounts = client.list_accounts(
|
163
|
+
subscriber: true,
|
164
|
+
begin_time: DateTime.new(2017,1,1)
|
165
|
+
)
|
166
|
+
|
167
|
+
# Calling count here will return an integer indicating
|
168
|
+
# the number of subscribers since 2017
|
169
|
+
count = accounts.count
|
170
|
+
# => 573
|
171
|
+
```
|
112
172
|
|
113
173
|
# Creating Resources
|
114
174
|
|
data/lib/recurly/client.rb
CHANGED
@@ -15,11 +15,12 @@ module Recurly
|
|
15
15
|
CA_FILE = File.join(File.dirname(__FILE__), "../data/ca-certificates.crt")
|
16
16
|
BINARY_TYPES = [
|
17
17
|
"application/pdf",
|
18
|
-
]
|
18
|
+
].freeze
|
19
19
|
JSON_CONTENT_TYPE = "application/json"
|
20
20
|
MAX_RETRIES = 3
|
21
|
-
|
22
|
-
BASE36_ALPHABET = ("0".."9").to_a + ("a".."z").to_a
|
21
|
+
LOG_LEVELS = %i(debug info warn error fatal).freeze
|
22
|
+
BASE36_ALPHABET = (("0".."9").to_a + ("a".."z").to_a).freeze
|
23
|
+
REQUEST_OPTIONS = [:headers].freeze
|
23
24
|
|
24
25
|
# Initialize a client. It requires an API key.
|
25
26
|
#
|
@@ -45,12 +46,31 @@ module Recurly
|
|
45
46
|
# sub = client.get_subscription(subscription_id: 'uuid-abcd7890')
|
46
47
|
#
|
47
48
|
# @param api_key [String] The private API key
|
48
|
-
# @param
|
49
|
-
|
50
|
-
def initialize(api_key:, site_id: nil, subdomain: nil, **options)
|
49
|
+
# @param logger [Logger] A logger to use. Defaults to creating a new STDOUT logger with level WARN.
|
50
|
+
def initialize(api_key:, site_id: nil, subdomain: nil, logger: nil)
|
51
51
|
set_site_id(site_id, subdomain)
|
52
52
|
set_api_key(api_key)
|
53
|
-
|
53
|
+
|
54
|
+
if logger.nil?
|
55
|
+
@logger = Logger.new(STDOUT).tap do |l|
|
56
|
+
l.level = Logger::WARN
|
57
|
+
end
|
58
|
+
else
|
59
|
+
unless LOG_LEVELS.all? { |lev| logger.respond_to?(lev) }
|
60
|
+
raise ArgumentError, "You must pass in a logger implementation that responds to the following messages: #{LOG_LEVELS}"
|
61
|
+
end
|
62
|
+
@logger = logger
|
63
|
+
end
|
64
|
+
|
65
|
+
if @logger.level < Logger::INFO
|
66
|
+
msg = <<-MSG
|
67
|
+
The Recurly logger should not be initialized
|
68
|
+
beyond the level INFO. It is currently configured to emit
|
69
|
+
headers and request / response bodies. This has the potential to leak
|
70
|
+
PII and other sensitive information and should never be used in production.
|
71
|
+
MSG
|
72
|
+
log_warn("SECURITY_WARNING", message: msg)
|
73
|
+
end
|
54
74
|
|
55
75
|
# execute block with this client if given
|
56
76
|
yield(self) if block_given?
|
@@ -100,7 +120,6 @@ module Recurly
|
|
100
120
|
if request_data
|
101
121
|
request_class.new(request_data).validate!
|
102
122
|
json_body = JSON.dump(request_data)
|
103
|
-
logger.info("PUT BODY #{json_body}")
|
104
123
|
request.body = json_body
|
105
124
|
end
|
106
125
|
http_response = run_request(request, options)
|
@@ -116,9 +135,6 @@ module Recurly
|
|
116
135
|
|
117
136
|
private
|
118
137
|
|
119
|
-
# @return [Logger]
|
120
|
-
attr_reader :logger
|
121
|
-
|
122
138
|
@connection_pool = Recurly::ConnectionPool.new
|
123
139
|
|
124
140
|
class << self
|
@@ -134,14 +150,37 @@ module Recurly
|
|
134
150
|
|
135
151
|
begin
|
136
152
|
http.start unless http.started?
|
153
|
+
log_attrs = {
|
154
|
+
method: request.method,
|
155
|
+
path: request.path,
|
156
|
+
}
|
157
|
+
if @logger.level < Logger::INFO
|
158
|
+
log_attrs[:request_body] = request.body
|
159
|
+
# No need to log the authorization header
|
160
|
+
headers = request.to_hash.reject { |k, _| k&.downcase == "authorization" }
|
161
|
+
log_attrs[:request_headers] = headers
|
162
|
+
end
|
163
|
+
|
164
|
+
log_info("Request", **log_attrs)
|
165
|
+
start = Time.now
|
137
166
|
response = http.request(request)
|
167
|
+
elapsed = Time.now - start
|
138
168
|
|
139
169
|
# GETs are safe to retry after a server error, requests with an Idempotency-Key will return the prior response
|
140
170
|
if response.kind_of?(Net::HTTPServerError) && request.is_a?(Net::HTTP::Get)
|
141
171
|
retries += 1
|
172
|
+
log_info("Retrying", retries: retries, **log_attrs)
|
173
|
+
start = Time.now
|
142
174
|
response = http.request(request) if retries < MAX_RETRIES
|
175
|
+
elapsed = Time.now - start
|
143
176
|
end
|
144
177
|
|
178
|
+
if @logger.level < Logger::INFO
|
179
|
+
log_attrs[:response_body] = response.body
|
180
|
+
log_attrs[:response_headers] = response.to_hash
|
181
|
+
end
|
182
|
+
log_info("Response", time_ms: (elapsed * 1_000).floor, status: response.code, **log_attrs)
|
183
|
+
|
145
184
|
response
|
146
185
|
rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::ECONNABORTED,
|
147
186
|
Errno::EPIPE, Errno::ETIMEDOUT, Net::OpenTimeout, EOFError, SocketError => ex
|
@@ -166,6 +205,9 @@ module Recurly
|
|
166
205
|
end
|
167
206
|
|
168
207
|
def set_headers(request, additional_headers = {})
|
208
|
+
# TODO this is undocumented until we finalize it
|
209
|
+
additional_headers.each { |header, v| request[header] = v } if additional_headers
|
210
|
+
|
169
211
|
request["Accept"] = "application/vnd.recurly.#{api_version}".chomp # got this method from operations.rb
|
170
212
|
request["Authorization"] = "Basic #{Base64.encode64(@api_key)}".chomp
|
171
213
|
request["User-Agent"] = "Recurly/#{VERSION}; #{RUBY_DESCRIPTION}"
|
@@ -173,9 +215,6 @@ module Recurly
|
|
173
215
|
unless request.is_a?(Net::HTTP::Get) || request.is_a?(Net::HTTP::Head)
|
174
216
|
request["Idempotency-Key"] ||= generate_idempotency_key
|
175
217
|
end
|
176
|
-
|
177
|
-
# TODO this is undocumented until we finalize it
|
178
|
-
additional_headers.each { |header, v| request[header] = v } if additional_headers
|
179
218
|
end
|
180
219
|
|
181
220
|
# from https://github.com/rails/rails/blob/6-0-stable/activesupport/lib/active_support/core_ext/securerandom.rb
|
@@ -190,8 +229,6 @@ module Recurly
|
|
190
229
|
def set_http_options(http, options)
|
191
230
|
http.open_timeout = options[:open_timeout] || 20
|
192
231
|
http.read_timeout = options[:read_timeout] || 60
|
193
|
-
|
194
|
-
http.set_debug_output(logger) if @log_level <= Logger::INFO && !http.started?
|
195
232
|
end
|
196
233
|
|
197
234
|
def handle_response!(request, http_response)
|
@@ -232,15 +269,15 @@ module Recurly
|
|
232
269
|
|
233
270
|
def read_headers(response)
|
234
271
|
if !@_ignore_deprecation_warning && response.headers["Recurly-Deprecated"]&.upcase == "TRUE"
|
235
|
-
|
272
|
+
log_warn("DEPRECTATION WARNING", message: "Your current API version \"#{api_version}\" is deprecated and will be sunset on #{response.headers["Recurly-Sunset-Date"]}")
|
236
273
|
end
|
237
274
|
response
|
238
275
|
end
|
239
276
|
|
240
|
-
def
|
277
|
+
def validate_path_parameters!(**options)
|
278
|
+
# Check to see that we are passing the correct data types
|
279
|
+
# This prevents a confusing error if the user passes in a non-primitive by mistake
|
241
280
|
options.each do |k, v|
|
242
|
-
# Check to see that we are passing the correct data types
|
243
|
-
# This prevents a confusing error if the user passes in a non-primitive by mistake
|
244
281
|
unless [String, Symbol, Integer, Float].include?(v.class)
|
245
282
|
message = "We cannot build the url with the given argument #{k}=#{v.inspect}."
|
246
283
|
if k =~ /_id$/
|
@@ -248,6 +285,17 @@ module Recurly
|
|
248
285
|
end
|
249
286
|
raise ArgumentError, message
|
250
287
|
end
|
288
|
+
end
|
289
|
+
# Check to make sure that parameters are not empty string values
|
290
|
+
empty_strings = options.select { |_, v| v.is_a?(String) && v.strip.empty? }
|
291
|
+
if empty_strings.any?
|
292
|
+
raise ArgumentError, "#{empty_strings.keys.join(", ")} cannot be an empty string"
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
def interpolate_path(path, **options)
|
297
|
+
validate_path_parameters!(options)
|
298
|
+
options.each do |k, v|
|
251
299
|
# We need to encode the values for the url
|
252
300
|
options[k] = ERB::Util.url_encode(v.to_s)
|
253
301
|
end
|
@@ -269,8 +317,9 @@ module Recurly
|
|
269
317
|
|
270
318
|
def build_url(path, options)
|
271
319
|
path = scope_by_site(path, options)
|
272
|
-
|
273
|
-
|
320
|
+
query_params = options.reject { |k, _| REQUEST_OPTIONS.include?(k.to_sym) }
|
321
|
+
if query_params.any?
|
322
|
+
"#{path}?#{URI.encode_www_form(query_params)}"
|
274
323
|
else
|
275
324
|
path
|
276
325
|
end
|
@@ -286,10 +335,14 @@ module Recurly
|
|
286
335
|
end
|
287
336
|
end
|
288
337
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
338
|
+
# Define a private `log_<level>` method for each log level
|
339
|
+
LOG_LEVELS.each do |level|
|
340
|
+
define_method "log_#{level}" do |tag, **attrs|
|
341
|
+
@logger.send(level, "Recurly") do
|
342
|
+
msg = attrs.each_pair.map { |k, v| "#{k}=#{v.inspect}" }.join(" ")
|
343
|
+
"[#{tag}] #{msg}"
|
344
|
+
end
|
345
|
+
end
|
293
346
|
end
|
294
347
|
end
|
295
348
|
end
|
@@ -30,6 +30,8 @@ module Recurly
|
|
30
30
|
# order. In descending order updated records will move behind the cursor and could
|
31
31
|
# prevent some records from being returned.
|
32
32
|
#
|
33
|
+
# @param state [String] Filter by state.
|
34
|
+
#
|
33
35
|
# @return [Pager<Resources::Site>] A list of sites.
|
34
36
|
# @example
|
35
37
|
# sites = @client.list_sites(limit: 200)
|
@@ -47,7 +49,18 @@ module Recurly
|
|
47
49
|
# {https://developers.recurly.com/api/v2019-10-10#operation/get_site get_site api documenation}
|
48
50
|
#
|
49
51
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
52
|
+
#
|
50
53
|
# @return [Resources::Site] A site.
|
54
|
+
# @example
|
55
|
+
# begin
|
56
|
+
# site = @client.get_site(site_id: site_id)
|
57
|
+
# puts "Got Site #{site}"
|
58
|
+
# rescue Recurly::Errors::NotFoundError
|
59
|
+
# # If the resource was not found, you may want to alert the user or
|
60
|
+
# # just return nil
|
61
|
+
# puts "Resource Not Found"
|
62
|
+
# end
|
63
|
+
#
|
51
64
|
def get_site(site_id:)
|
52
65
|
path = interpolate_path("/sites/{site_id}", site_id: site_id)
|
53
66
|
get(path)
|
@@ -75,10 +88,10 @@ module Recurly
|
|
75
88
|
# order. In descending order updated records will move behind the cursor and could
|
76
89
|
# prevent some records from being returned.
|
77
90
|
#
|
78
|
-
# @param begin_time [DateTime]
|
91
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
79
92
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
80
93
|
#
|
81
|
-
# @param end_time [DateTime]
|
94
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
82
95
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
83
96
|
#
|
84
97
|
# @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.
|
@@ -87,6 +100,7 @@ module Recurly
|
|
87
100
|
#
|
88
101
|
# @param past_due [String] Filter for accounts with an invoice in the +past_due+ state.
|
89
102
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
103
|
+
#
|
90
104
|
# @return [Pager<Resources::Account>] A list of the site's accounts.
|
91
105
|
# @example
|
92
106
|
# accounts = @client.list_accounts(limit: 200)
|
@@ -105,6 +119,7 @@ module Recurly
|
|
105
119
|
#
|
106
120
|
# @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
121
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
122
|
+
#
|
108
123
|
# @return [Resources::Account] An account.
|
109
124
|
# @example
|
110
125
|
# begin
|
@@ -153,6 +168,7 @@ module Recurly
|
|
153
168
|
#
|
154
169
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
155
170
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
171
|
+
#
|
156
172
|
# @return [Resources::Account] An account.
|
157
173
|
# @example
|
158
174
|
# begin
|
@@ -176,6 +192,7 @@ module Recurly
|
|
176
192
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
177
193
|
# @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
194
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
195
|
+
#
|
179
196
|
# @return [Resources::Account] An account.
|
180
197
|
# @example
|
181
198
|
# begin
|
@@ -205,6 +222,7 @@ module Recurly
|
|
205
222
|
#
|
206
223
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
207
224
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
225
|
+
#
|
208
226
|
# @return [Resources::Account] An account.
|
209
227
|
# @example
|
210
228
|
# begin
|
@@ -227,6 +245,7 @@ module Recurly
|
|
227
245
|
#
|
228
246
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
229
247
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
248
|
+
#
|
230
249
|
# @return [Resources::AccountAcquisition] An account's acquisition data.
|
231
250
|
# @example
|
232
251
|
# begin
|
@@ -250,7 +269,30 @@ module Recurly
|
|
250
269
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
251
270
|
# @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
271
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
272
|
+
#
|
253
273
|
# @return [Resources::AccountAcquisition] An account's updated acquisition data.
|
274
|
+
# @example
|
275
|
+
# begin
|
276
|
+
# acquisition_update = {
|
277
|
+
# campaign: "podcast-marketing",
|
278
|
+
# channel: "social_media",
|
279
|
+
# subchannel: "twitter",
|
280
|
+
# cost: {
|
281
|
+
# currency: "USD",
|
282
|
+
# amount: 0.50
|
283
|
+
# }
|
284
|
+
# }
|
285
|
+
# acquisition = @client.update_account_acquisition(
|
286
|
+
# account_id: account_id,
|
287
|
+
# body: acquisition_update
|
288
|
+
# )
|
289
|
+
# puts "Updated AccountAcqusition #{acquisition}"
|
290
|
+
# rescue Recurly::Errors::ValidationError => e
|
291
|
+
# # If the request was invalid, you may want to tell your user
|
292
|
+
# # why. You can find the invalid params and reasons in e.recurly_error.params
|
293
|
+
# puts "ValidationError: #{e.recurly_error.params}"
|
294
|
+
# end
|
295
|
+
#
|
254
296
|
def update_account_acquisition(account_id:, body:, **options)
|
255
297
|
path = interpolate_path("/accounts/{account_id}/acquisition", account_id: account_id)
|
256
298
|
put(path, body, Requests::AccountAcquisitionUpdatable, **options)
|
@@ -262,6 +304,7 @@ module Recurly
|
|
262
304
|
#
|
263
305
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
264
306
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
307
|
+
#
|
265
308
|
# @return [Resources::Empty] Acquisition data was succesfully deleted.
|
266
309
|
# @example
|
267
310
|
# begin
|
@@ -284,6 +327,7 @@ module Recurly
|
|
284
327
|
#
|
285
328
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
286
329
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
330
|
+
#
|
287
331
|
# @return [Resources::Account] An account.
|
288
332
|
# @example
|
289
333
|
# begin
|
@@ -306,6 +350,7 @@ module Recurly
|
|
306
350
|
#
|
307
351
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
308
352
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
353
|
+
#
|
309
354
|
# @return [Resources::AccountBalance] An account's balance.
|
310
355
|
# @example
|
311
356
|
# begin
|
@@ -328,6 +373,7 @@ module Recurly
|
|
328
373
|
#
|
329
374
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
330
375
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
376
|
+
#
|
331
377
|
# @return [Resources::BillingInfo] An account's billing information.
|
332
378
|
# @example
|
333
379
|
# begin
|
@@ -351,6 +397,7 @@ module Recurly
|
|
351
397
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
352
398
|
# @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
399
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
400
|
+
#
|
354
401
|
# @return [Resources::BillingInfo] Updated billing information.
|
355
402
|
# @example
|
356
403
|
# begin
|
@@ -380,6 +427,7 @@ module Recurly
|
|
380
427
|
#
|
381
428
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
382
429
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
430
|
+
#
|
383
431
|
# @return [Resources::Empty] Billing information deleted
|
384
432
|
# @example
|
385
433
|
# begin
|
@@ -417,13 +465,14 @@ module Recurly
|
|
417
465
|
# order. In descending order updated records will move behind the cursor and could
|
418
466
|
# prevent some records from being returned.
|
419
467
|
#
|
420
|
-
# @param begin_time [DateTime]
|
468
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
421
469
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
422
470
|
#
|
423
|
-
# @param end_time [DateTime]
|
471
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
424
472
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
425
473
|
#
|
426
474
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
475
|
+
#
|
427
476
|
# @return [Pager<Resources::CouponRedemption>] A list of the the coupon redemptions on an account.
|
428
477
|
# @example
|
429
478
|
# redemptions = @client.list_account_coupon_redemptions(
|
@@ -445,6 +494,7 @@ module Recurly
|
|
445
494
|
#
|
446
495
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
447
496
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
497
|
+
#
|
448
498
|
# @return [Resources::CouponRedemption] An active coupon redemption on an account.
|
449
499
|
# @example
|
450
500
|
# begin
|
@@ -468,6 +518,7 @@ module Recurly
|
|
468
518
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
469
519
|
# @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
520
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
521
|
+
#
|
471
522
|
# @return [Resources::CouponRedemption] Returns the new coupon redemption.
|
472
523
|
# @example
|
473
524
|
# begin
|
@@ -497,6 +548,7 @@ module Recurly
|
|
497
548
|
#
|
498
549
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
499
550
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
551
|
+
#
|
500
552
|
# @return [Resources::CouponRedemption] Coupon redemption deleted.
|
501
553
|
# @example
|
502
554
|
# begin
|
@@ -524,13 +576,14 @@ module Recurly
|
|
524
576
|
# order. In descending order updated records will move behind the cursor and could
|
525
577
|
# prevent some records from being returned.
|
526
578
|
#
|
527
|
-
# @param begin_time [DateTime]
|
579
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
528
580
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
529
581
|
#
|
530
|
-
# @param end_time [DateTime]
|
582
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
531
583
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
532
584
|
#
|
533
585
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
586
|
+
#
|
534
587
|
# @return [Pager<Resources::CreditPayment>] A list of the account's credit payments.
|
535
588
|
# @example
|
536
589
|
# payments = @client.list_account_credit_payments(
|
@@ -569,10 +622,10 @@ module Recurly
|
|
569
622
|
# order. In descending order updated records will move behind the cursor and could
|
570
623
|
# prevent some records from being returned.
|
571
624
|
#
|
572
|
-
# @param begin_time [DateTime]
|
625
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
573
626
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
574
627
|
#
|
575
|
-
# @param end_time [DateTime]
|
628
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
576
629
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
577
630
|
#
|
578
631
|
# @param type [String] Filter by type when:
|
@@ -582,6 +635,7 @@ module Recurly
|
|
582
635
|
# - +type=legacy+, only legacy invoices will be returned.
|
583
636
|
#
|
584
637
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
638
|
+
#
|
585
639
|
# @return [Pager<Resources::Invoice>] A list of the account's invoices.
|
586
640
|
# @example
|
587
641
|
# invoices = @client.list_account_invoices(
|
@@ -604,6 +658,7 @@ module Recurly
|
|
604
658
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
605
659
|
# @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
660
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
661
|
+
#
|
607
662
|
# @return [Resources::InvoiceCollection] Returns the new invoices.
|
608
663
|
# @example
|
609
664
|
# begin
|
@@ -634,6 +689,7 @@ module Recurly
|
|
634
689
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
635
690
|
# @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
691
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
692
|
+
#
|
637
693
|
# @return [Resources::InvoiceCollection] Returns the invoice previews.
|
638
694
|
# @example
|
639
695
|
# begin
|
@@ -680,16 +736,17 @@ module Recurly
|
|
680
736
|
# order. In descending order updated records will move behind the cursor and could
|
681
737
|
# prevent some records from being returned.
|
682
738
|
#
|
683
|
-
# @param begin_time [DateTime]
|
739
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
684
740
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
685
741
|
#
|
686
|
-
# @param end_time [DateTime]
|
742
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
687
743
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
688
744
|
#
|
689
745
|
# @param original [String] Filter by original field.
|
690
746
|
# @param state [String] Filter by state field.
|
691
747
|
# @param type [String] Filter by type field.
|
692
748
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
749
|
+
#
|
693
750
|
# @return [Pager<Resources::LineItem>] A list of the account's line items.
|
694
751
|
# @example
|
695
752
|
# line_items = @client.list_account_line_items(
|
@@ -712,6 +769,7 @@ module Recurly
|
|
712
769
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
713
770
|
# @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
771
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
772
|
+
#
|
715
773
|
# @return [Resources::LineItem] Returns the new line item.
|
716
774
|
# @example
|
717
775
|
# begin
|
@@ -754,6 +812,7 @@ module Recurly
|
|
754
812
|
# returned at once you can sort the records yourself.
|
755
813
|
#
|
756
814
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
815
|
+
#
|
757
816
|
# @return [Pager<Resources::AccountNote>] A list of an account's notes.
|
758
817
|
# @example
|
759
818
|
# account_notes = @client.list_account_notes(account_id: account_id, limit: 200)
|
@@ -773,6 +832,7 @@ module Recurly
|
|
773
832
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
774
833
|
# @param account_note_id [String] Account Note ID.
|
775
834
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
835
|
+
#
|
776
836
|
# @return [Resources::AccountNote] An account note.
|
777
837
|
# @example
|
778
838
|
# begin
|
@@ -815,13 +875,14 @@ module Recurly
|
|
815
875
|
# order. In descending order updated records will move behind the cursor and could
|
816
876
|
# prevent some records from being returned.
|
817
877
|
#
|
818
|
-
# @param begin_time [DateTime]
|
878
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
819
879
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
820
880
|
#
|
821
|
-
# @param end_time [DateTime]
|
881
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
822
882
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
823
883
|
#
|
824
884
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
885
|
+
#
|
825
886
|
# @return [Pager<Resources::ShippingAddress>] A list of an account's shipping addresses.
|
826
887
|
# @example
|
827
888
|
# shipping_addresses = @client.list_shipping_addresses(
|
@@ -844,7 +905,28 @@ module Recurly
|
|
844
905
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
845
906
|
# @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
907
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
908
|
+
#
|
847
909
|
# @return [Resources::ShippingAddress] Returns the new shipping address.
|
910
|
+
# @example
|
911
|
+
# begin
|
912
|
+
# shipping_address_create = {
|
913
|
+
# nickname: 'Work',
|
914
|
+
# street1: '900 Camp St',
|
915
|
+
# city: 'New Orleans',
|
916
|
+
# region: 'LA',
|
917
|
+
# country: 'US',
|
918
|
+
# postal_code: '70115',
|
919
|
+
# first_name: 'Joanna',
|
920
|
+
# last_name: 'Du Monde'
|
921
|
+
# }
|
922
|
+
# shipping_address = @client.create_shipping_address(account_id: account_id, body: shipping_address_create)
|
923
|
+
# puts "Created Shipping Address #{shipping_address}"
|
924
|
+
# rescue Recurly::Errors::NotFoundError
|
925
|
+
# # If the resource was not found, you may want to alert the user or
|
926
|
+
# # just return nil
|
927
|
+
# puts "Resource Not Found"
|
928
|
+
# end
|
929
|
+
#
|
848
930
|
def create_shipping_address(account_id:, body:, **options)
|
849
931
|
path = interpolate_path("/accounts/{account_id}/shipping_addresses", account_id: account_id)
|
850
932
|
post(path, body, Requests::ShippingAddressCreate, **options)
|
@@ -857,6 +939,7 @@ module Recurly
|
|
857
939
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
858
940
|
# @param shipping_address_id [String] Shipping Address ID.
|
859
941
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
942
|
+
#
|
860
943
|
# @return [Resources::ShippingAddress] A shipping address.
|
861
944
|
# @example
|
862
945
|
# begin
|
@@ -884,6 +967,7 @@ module Recurly
|
|
884
967
|
# @param shipping_address_id [String] Shipping Address ID.
|
885
968
|
# @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
969
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
970
|
+
#
|
887
971
|
# @return [Resources::ShippingAddress] The updated shipping address.
|
888
972
|
# @example
|
889
973
|
# begin
|
@@ -916,6 +1000,7 @@ module Recurly
|
|
916
1000
|
# @param account_id [String] Account ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-bob+.
|
917
1001
|
# @param shipping_address_id [String] Shipping Address ID.
|
918
1002
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1003
|
+
#
|
919
1004
|
# @return [Resources::Empty] Shipping address deleted.
|
920
1005
|
# @example
|
921
1006
|
# begin
|
@@ -958,10 +1043,10 @@ module Recurly
|
|
958
1043
|
# order. In descending order updated records will move behind the cursor and could
|
959
1044
|
# prevent some records from being returned.
|
960
1045
|
#
|
961
|
-
# @param begin_time [DateTime]
|
1046
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
962
1047
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
963
1048
|
#
|
964
|
-
# @param end_time [DateTime]
|
1049
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
965
1050
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
966
1051
|
#
|
967
1052
|
# @param state [String] Filter by state.
|
@@ -971,6 +1056,7 @@ module Recurly
|
|
971
1056
|
# - When +state=live+, only subscriptions that are in an active, canceled, or future state or are in trial will be returned.
|
972
1057
|
#
|
973
1058
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1059
|
+
#
|
974
1060
|
# @return [Pager<Resources::Subscription>] A list of the account's subscriptions.
|
975
1061
|
# @example
|
976
1062
|
# subscriptions = @client.list_account_subscriptions(
|
@@ -1009,15 +1095,16 @@ module Recurly
|
|
1009
1095
|
# order. In descending order updated records will move behind the cursor and could
|
1010
1096
|
# prevent some records from being returned.
|
1011
1097
|
#
|
1012
|
-
# @param begin_time [DateTime]
|
1098
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1013
1099
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1014
1100
|
#
|
1015
|
-
# @param end_time [DateTime]
|
1101
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1016
1102
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1017
1103
|
#
|
1018
1104
|
# @param type [String] Filter by type field. The value +payment+ will return both +purchase+ and +capture+ transactions.
|
1019
1105
|
# @param success [String] Filter by success field.
|
1020
1106
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1107
|
+
#
|
1021
1108
|
# @return [Pager<Resources::Transaction>] A list of the account's transactions.
|
1022
1109
|
# @example
|
1023
1110
|
# transactions = @client.list_account_transactions(
|
@@ -1056,10 +1143,10 @@ module Recurly
|
|
1056
1143
|
# order. In descending order updated records will move behind the cursor and could
|
1057
1144
|
# prevent some records from being returned.
|
1058
1145
|
#
|
1059
|
-
# @param begin_time [DateTime]
|
1146
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1060
1147
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1061
1148
|
#
|
1062
|
-
# @param end_time [DateTime]
|
1149
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1063
1150
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1064
1151
|
#
|
1065
1152
|
# @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.
|
@@ -1068,6 +1155,7 @@ module Recurly
|
|
1068
1155
|
#
|
1069
1156
|
# @param past_due [String] Filter for accounts with an invoice in the +past_due+ state.
|
1070
1157
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1158
|
+
#
|
1071
1159
|
# @return [Pager<Resources::Account>] A list of an account's child accounts.
|
1072
1160
|
# @example
|
1073
1161
|
# child_accounts = @client.list_child_accounts(
|
@@ -1105,13 +1193,14 @@ module Recurly
|
|
1105
1193
|
# order. In descending order updated records will move behind the cursor and could
|
1106
1194
|
# prevent some records from being returned.
|
1107
1195
|
#
|
1108
|
-
# @param begin_time [DateTime]
|
1196
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1109
1197
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1110
1198
|
#
|
1111
|
-
# @param end_time [DateTime]
|
1199
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1112
1200
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1113
1201
|
#
|
1114
1202
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1203
|
+
#
|
1115
1204
|
# @return [Pager<Resources::AccountAcquisition>] A list of the site's account acquisition data.
|
1116
1205
|
# @example
|
1117
1206
|
# acquisitions = @client.list_account_acquisition(limit: 200)
|
@@ -1146,13 +1235,14 @@ module Recurly
|
|
1146
1235
|
# order. In descending order updated records will move behind the cursor and could
|
1147
1236
|
# prevent some records from being returned.
|
1148
1237
|
#
|
1149
|
-
# @param begin_time [DateTime]
|
1238
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1150
1239
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1151
1240
|
#
|
1152
|
-
# @param end_time [DateTime]
|
1241
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1153
1242
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1154
1243
|
#
|
1155
1244
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1245
|
+
#
|
1156
1246
|
# @return [Pager<Resources::Coupon>] A list of the site's coupons.
|
1157
1247
|
# @example
|
1158
1248
|
# coupons = @client.list_coupons(limit: 200)
|
@@ -1171,6 +1261,7 @@ module Recurly
|
|
1171
1261
|
#
|
1172
1262
|
# @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
1263
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1264
|
+
#
|
1174
1265
|
# @return [Resources::Coupon] A new coupon.
|
1175
1266
|
# @example
|
1176
1267
|
# begin
|
@@ -1206,6 +1297,7 @@ module Recurly
|
|
1206
1297
|
#
|
1207
1298
|
# @param coupon_id [String] Coupon ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-10off+.
|
1208
1299
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1300
|
+
#
|
1209
1301
|
# @return [Resources::Coupon] A coupon.
|
1210
1302
|
# @example
|
1211
1303
|
# begin
|
@@ -1229,7 +1321,21 @@ module Recurly
|
|
1229
1321
|
# @param coupon_id [String] Coupon ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-10off+.
|
1230
1322
|
# @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
1323
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1324
|
+
#
|
1232
1325
|
# @return [Resources::Coupon] The updated coupon.
|
1326
|
+
# @example
|
1327
|
+
# begin
|
1328
|
+
# coupon_update = {
|
1329
|
+
# name: "New Coupon Name"
|
1330
|
+
# }
|
1331
|
+
# coupon = @client.update_coupon(coupon_id: coupon_id, body: coupon_update)
|
1332
|
+
# puts "Updated Coupon #{coupon}"
|
1333
|
+
# rescue Recurly::Errors::NotFoundError
|
1334
|
+
# # If the resource was not found, you may want to alert the user or
|
1335
|
+
# # just return nil
|
1336
|
+
# puts "Resource Not Found"
|
1337
|
+
# end
|
1338
|
+
#
|
1233
1339
|
def update_coupon(coupon_id:, body:, **options)
|
1234
1340
|
path = interpolate_path("/coupons/{coupon_id}", coupon_id: coupon_id)
|
1235
1341
|
put(path, body, Requests::CouponUpdate, **options)
|
@@ -1241,7 +1347,18 @@ module Recurly
|
|
1241
1347
|
#
|
1242
1348
|
# @param coupon_id [String] Coupon ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-10off+.
|
1243
1349
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1350
|
+
#
|
1244
1351
|
# @return [Resources::Coupon] The expired Coupon
|
1352
|
+
# @example
|
1353
|
+
# begin
|
1354
|
+
# coupon = @client.deactivate_coupon(coupon_id: coupon_id)
|
1355
|
+
# puts "Deactivated Coupon #{coupon}"
|
1356
|
+
# rescue Recurly::Errors::NotFoundError
|
1357
|
+
# # If the resource was not found, you may want to alert the user or
|
1358
|
+
# # just return nil
|
1359
|
+
# puts "Resource Not Found"
|
1360
|
+
# end
|
1361
|
+
#
|
1245
1362
|
def deactivate_coupon(coupon_id:, **options)
|
1246
1363
|
path = interpolate_path("/coupons/{coupon_id}", coupon_id: coupon_id)
|
1247
1364
|
delete(path, **options)
|
@@ -1270,14 +1387,16 @@ module Recurly
|
|
1270
1387
|
# order. In descending order updated records will move behind the cursor and could
|
1271
1388
|
# prevent some records from being returned.
|
1272
1389
|
#
|
1273
|
-
# @param begin_time [DateTime]
|
1390
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1274
1391
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1275
1392
|
#
|
1276
|
-
# @param end_time [DateTime]
|
1393
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1277
1394
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1278
1395
|
#
|
1279
1396
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1397
|
+
#
|
1280
1398
|
# @return [Pager<Resources::UniqueCouponCode>] A list of unique coupon codes that were generated
|
1399
|
+
#
|
1281
1400
|
def list_unique_coupon_codes(coupon_id:, **options)
|
1282
1401
|
path = interpolate_path("/coupons/{coupon_id}/unique_coupon_codes", coupon_id: coupon_id)
|
1283
1402
|
pager(path, **options)
|
@@ -1293,13 +1412,14 @@ module Recurly
|
|
1293
1412
|
# order. In descending order updated records will move behind the cursor and could
|
1294
1413
|
# prevent some records from being returned.
|
1295
1414
|
#
|
1296
|
-
# @param begin_time [DateTime]
|
1415
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1297
1416
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1298
1417
|
#
|
1299
|
-
# @param end_time [DateTime]
|
1418
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1300
1419
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1301
1420
|
#
|
1302
1421
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1422
|
+
#
|
1303
1423
|
# @return [Pager<Resources::CreditPayment>] A list of the site's credit payments.
|
1304
1424
|
# @example
|
1305
1425
|
# payments = @client.list_credit_payments(limit: 200)
|
@@ -1318,7 +1438,9 @@ module Recurly
|
|
1318
1438
|
#
|
1319
1439
|
# @param credit_payment_id [String] Credit Payment ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
1320
1440
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1441
|
+
#
|
1321
1442
|
# @return [Resources::CreditPayment] A credit payment.
|
1443
|
+
#
|
1322
1444
|
def get_credit_payment(credit_payment_id:, **options)
|
1323
1445
|
path = interpolate_path("/credit_payments/{credit_payment_id}", credit_payment_id: credit_payment_id)
|
1324
1446
|
get(path, **options)
|
@@ -1346,14 +1468,15 @@ module Recurly
|
|
1346
1468
|
# order. In descending order updated records will move behind the cursor and could
|
1347
1469
|
# prevent some records from being returned.
|
1348
1470
|
#
|
1349
|
-
# @param begin_time [DateTime]
|
1471
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1350
1472
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1351
1473
|
#
|
1352
|
-
# @param end_time [DateTime]
|
1474
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1353
1475
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1354
1476
|
#
|
1355
1477
|
# @param related_type [String] Filter by related type.
|
1356
1478
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1479
|
+
#
|
1357
1480
|
# @return [Pager<Resources::CustomFieldDefinition>] A list of the site's custom field definitions.
|
1358
1481
|
# @example
|
1359
1482
|
# custom_fields = @client.list_custom_field_definitions(limit: 200)
|
@@ -1372,7 +1495,20 @@ module Recurly
|
|
1372
1495
|
#
|
1373
1496
|
# @param custom_field_definition_id [String] Custom Field Definition ID
|
1374
1497
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1498
|
+
#
|
1375
1499
|
# @return [Resources::CustomFieldDefinition] An custom field definition.
|
1500
|
+
# @example
|
1501
|
+
# begin
|
1502
|
+
# custom_field_definition = @client.get_custom_field_definition(
|
1503
|
+
# custom_field_definition_id: custom_field_definition_id
|
1504
|
+
# )
|
1505
|
+
# puts "Got Custom Field Definition #{custom_field_definition}"
|
1506
|
+
# rescue Recurly::Errors::NotFoundError
|
1507
|
+
# # If the resource was not found, you may want to alert the user or
|
1508
|
+
# # just return nil
|
1509
|
+
# puts "Resource Not Found"
|
1510
|
+
# end
|
1511
|
+
#
|
1376
1512
|
def get_custom_field_definition(custom_field_definition_id:, **options)
|
1377
1513
|
path = interpolate_path("/custom_field_definitions/{custom_field_definition_id}", custom_field_definition_id: custom_field_definition_id)
|
1378
1514
|
get(path, **options)
|
@@ -1400,14 +1536,15 @@ module Recurly
|
|
1400
1536
|
# order. In descending order updated records will move behind the cursor and could
|
1401
1537
|
# prevent some records from being returned.
|
1402
1538
|
#
|
1403
|
-
# @param begin_time [DateTime]
|
1539
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1404
1540
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1405
1541
|
#
|
1406
|
-
# @param end_time [DateTime]
|
1542
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1407
1543
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1408
1544
|
#
|
1409
1545
|
# @param state [String] Filter by state.
|
1410
1546
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1547
|
+
#
|
1411
1548
|
# @return [Pager<Resources::Item>] A list of the site's items.
|
1412
1549
|
# @example
|
1413
1550
|
# items = @client.list_items(limit: 200)
|
@@ -1426,6 +1563,7 @@ module Recurly
|
|
1426
1563
|
#
|
1427
1564
|
# @param body [Requests::ItemCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ItemCreate}
|
1428
1565
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1566
|
+
#
|
1429
1567
|
# @return [Resources::Item] A new item.
|
1430
1568
|
# @example
|
1431
1569
|
# begin
|
@@ -1460,6 +1598,7 @@ module Recurly
|
|
1460
1598
|
#
|
1461
1599
|
# @param item_id [String] Item ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-red+.
|
1462
1600
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1601
|
+
#
|
1463
1602
|
# @return [Resources::Item] An item.
|
1464
1603
|
# @example
|
1465
1604
|
# begin
|
@@ -1483,6 +1622,7 @@ module Recurly
|
|
1483
1622
|
# @param item_id [String] Item ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-red+.
|
1484
1623
|
# @param body [Requests::ItemUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ItemUpdate}
|
1485
1624
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1625
|
+
#
|
1486
1626
|
# @return [Resources::Item] The updated item.
|
1487
1627
|
# @example
|
1488
1628
|
# begin
|
@@ -1512,6 +1652,7 @@ module Recurly
|
|
1512
1652
|
#
|
1513
1653
|
# @param item_id [String] Item ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-red+.
|
1514
1654
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1655
|
+
#
|
1515
1656
|
# @return [Resources::Item] An item.
|
1516
1657
|
# @example
|
1517
1658
|
# begin
|
@@ -1534,6 +1675,7 @@ module Recurly
|
|
1534
1675
|
#
|
1535
1676
|
# @param item_id [String] Item ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-red+.
|
1536
1677
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1678
|
+
#
|
1537
1679
|
# @return [Resources::Item] An item.
|
1538
1680
|
# @example
|
1539
1681
|
# begin
|
@@ -1550,6 +1692,101 @@ module Recurly
|
|
1550
1692
|
put(path, **options)
|
1551
1693
|
end
|
1552
1694
|
|
1695
|
+
# List a site's measured units
|
1696
|
+
#
|
1697
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/list_measured_unit list_measured_unit api documenation}
|
1698
|
+
#
|
1699
|
+
# @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using
|
1700
|
+
# commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+.
|
1701
|
+
#
|
1702
|
+
# *Important notes:*
|
1703
|
+
#
|
1704
|
+
# * The +ids+ parameter cannot be used with any other ordering or filtering
|
1705
|
+
# parameters (+limit+, +order+, +sort+, +begin_time+, +end_time+, etc)
|
1706
|
+
# * Invalid or unknown IDs will be ignored, so you should check that the
|
1707
|
+
# results correspond to your request.
|
1708
|
+
# * Records are returned in an arbitrary order. Since results are all
|
1709
|
+
# returned at once you can sort the records yourself.
|
1710
|
+
#
|
1711
|
+
# @param limit [Integer] Limit number of records 1-200.
|
1712
|
+
# @param order [String] Sort order.
|
1713
|
+
# @param sort [String] Sort field. You *really* only want to sort by +updated_at+ in ascending
|
1714
|
+
# order. In descending order updated records will move behind the cursor and could
|
1715
|
+
# prevent some records from being returned.
|
1716
|
+
#
|
1717
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1718
|
+
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1719
|
+
#
|
1720
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1721
|
+
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1722
|
+
#
|
1723
|
+
# @param state [String] Filter by state.
|
1724
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1725
|
+
#
|
1726
|
+
# @return [Pager<Resources::MeasuredUnit>] A list of the site's measured units.
|
1727
|
+
#
|
1728
|
+
def list_measured_unit(**options)
|
1729
|
+
path = interpolate_path("/measured_units")
|
1730
|
+
pager(path, **options)
|
1731
|
+
end
|
1732
|
+
|
1733
|
+
# Create a new measured unit
|
1734
|
+
#
|
1735
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/create_measured_unit create_measured_unit api documenation}
|
1736
|
+
#
|
1737
|
+
# @param body [Requests::MeasuredUnitCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::MeasuredUnitCreate}
|
1738
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1739
|
+
#
|
1740
|
+
# @return [Resources::MeasuredUnit] A new measured unit.
|
1741
|
+
#
|
1742
|
+
def create_measured_unit(body:, **options)
|
1743
|
+
path = interpolate_path("/measured_units")
|
1744
|
+
post(path, body, Requests::MeasuredUnitCreate, **options)
|
1745
|
+
end
|
1746
|
+
|
1747
|
+
# Fetch a measured unit
|
1748
|
+
#
|
1749
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/get_measured_unit get_measured_unit api documenation}
|
1750
|
+
#
|
1751
|
+
# @param measured_unit_id [String] Measured unit ID or name. For ID no prefix is used e.g. +e28zov4fw0v2+. For name use prefix +name-+, e.g. +name-Storage+.
|
1752
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1753
|
+
#
|
1754
|
+
# @return [Resources::MeasuredUnit] An item.
|
1755
|
+
#
|
1756
|
+
def get_measured_unit(measured_unit_id:, **options)
|
1757
|
+
path = interpolate_path("/measured_units/{measured_unit_id}", measured_unit_id: measured_unit_id)
|
1758
|
+
get(path, **options)
|
1759
|
+
end
|
1760
|
+
|
1761
|
+
# Update a measured unit
|
1762
|
+
#
|
1763
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/update_measured_unit update_measured_unit api documenation}
|
1764
|
+
#
|
1765
|
+
# @param measured_unit_id [String] Measured unit ID or name. For ID no prefix is used e.g. +e28zov4fw0v2+. For name use prefix +name-+, e.g. +name-Storage+.
|
1766
|
+
# @param body [Requests::MeasuredUnitUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::MeasuredUnitUpdate}
|
1767
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1768
|
+
#
|
1769
|
+
# @return [Resources::MeasuredUnit] The updated measured_unit.
|
1770
|
+
#
|
1771
|
+
def update_measured_unit(measured_unit_id:, body:, **options)
|
1772
|
+
path = interpolate_path("/measured_units/{measured_unit_id}", measured_unit_id: measured_unit_id)
|
1773
|
+
put(path, body, Requests::MeasuredUnitUpdate, **options)
|
1774
|
+
end
|
1775
|
+
|
1776
|
+
# Remove a measured unit
|
1777
|
+
#
|
1778
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/remove_measured_unit remove_measured_unit api documenation}
|
1779
|
+
#
|
1780
|
+
# @param measured_unit_id [String] Measured unit ID or name. For ID no prefix is used e.g. +e28zov4fw0v2+. For name use prefix +name-+, e.g. +name-Storage+.
|
1781
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1782
|
+
#
|
1783
|
+
# @return [Resources::MeasuredUnit] A measured unit.
|
1784
|
+
#
|
1785
|
+
def remove_measured_unit(measured_unit_id:, **options)
|
1786
|
+
path = interpolate_path("/measured_units/{measured_unit_id}", measured_unit_id: measured_unit_id)
|
1787
|
+
delete(path, **options)
|
1788
|
+
end
|
1789
|
+
|
1553
1790
|
# List a site's invoices
|
1554
1791
|
#
|
1555
1792
|
# {https://developers.recurly.com/api/v2019-10-10#operation/list_invoices list_invoices api documenation}
|
@@ -1572,10 +1809,10 @@ module Recurly
|
|
1572
1809
|
# order. In descending order updated records will move behind the cursor and could
|
1573
1810
|
# prevent some records from being returned.
|
1574
1811
|
#
|
1575
|
-
# @param begin_time [DateTime]
|
1812
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1576
1813
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1577
1814
|
#
|
1578
|
-
# @param end_time [DateTime]
|
1815
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1579
1816
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1580
1817
|
#
|
1581
1818
|
# @param type [String] Filter by type when:
|
@@ -1585,6 +1822,7 @@ module Recurly
|
|
1585
1822
|
# - +type=legacy+, only legacy invoices will be returned.
|
1586
1823
|
#
|
1587
1824
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1825
|
+
#
|
1588
1826
|
# @return [Pager<Resources::Invoice>] A list of the site's invoices.
|
1589
1827
|
# @example
|
1590
1828
|
# invoices = @client.list_invoices(limit: 200)
|
@@ -1603,6 +1841,7 @@ module Recurly
|
|
1603
1841
|
#
|
1604
1842
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1605
1843
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1844
|
+
#
|
1606
1845
|
# @return [Resources::Invoice] An invoice.
|
1607
1846
|
# @example
|
1608
1847
|
# begin
|
@@ -1626,7 +1865,22 @@ module Recurly
|
|
1626
1865
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1627
1866
|
# @param body [Requests::InvoiceUpdatable] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceUpdatable}
|
1628
1867
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1868
|
+
#
|
1629
1869
|
# @return [Resources::Invoice] An invoice.
|
1870
|
+
# @example
|
1871
|
+
# begin
|
1872
|
+
# invoice_update = {
|
1873
|
+
# customer_notes: "New Notes",
|
1874
|
+
# terms_and_conditions: "New Terms and Conditions"
|
1875
|
+
# }
|
1876
|
+
# invoice = @client.put_invoice(invoice_id: invoice_id, body: invoice_update)
|
1877
|
+
# puts "Updated invoice #{invoice}"
|
1878
|
+
# rescue Recurly::Errors::NotFoundError
|
1879
|
+
# # If the resource was not found, you may want to alert the user or
|
1880
|
+
# # just return nil
|
1881
|
+
# puts "Resource Not Found"
|
1882
|
+
# end
|
1883
|
+
#
|
1630
1884
|
def put_invoice(invoice_id:, body:, **options)
|
1631
1885
|
path = interpolate_path("/invoices/{invoice_id}", invoice_id: invoice_id)
|
1632
1886
|
put(path, body, Requests::InvoiceUpdatable, **options)
|
@@ -1638,6 +1892,7 @@ module Recurly
|
|
1638
1892
|
#
|
1639
1893
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1640
1894
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1895
|
+
#
|
1641
1896
|
# @return [Resources::BinaryFile] An invoice as a PDF.
|
1642
1897
|
# @example
|
1643
1898
|
# begin
|
@@ -1664,6 +1919,7 @@ module Recurly
|
|
1664
1919
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1665
1920
|
# @param body [Requests::InvoiceCollect] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceCollect}
|
1666
1921
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1922
|
+
#
|
1667
1923
|
# @return [Resources::Invoice] The updated invoice.
|
1668
1924
|
# @example
|
1669
1925
|
# begin
|
@@ -1686,6 +1942,7 @@ module Recurly
|
|
1686
1942
|
#
|
1687
1943
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1688
1944
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1945
|
+
#
|
1689
1946
|
# @return [Resources::Invoice] The updated invoice.
|
1690
1947
|
# @example
|
1691
1948
|
# begin
|
@@ -1708,6 +1965,7 @@ module Recurly
|
|
1708
1965
|
#
|
1709
1966
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1710
1967
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1968
|
+
#
|
1711
1969
|
# @return [Resources::Invoice] The updated invoice.
|
1712
1970
|
# @example
|
1713
1971
|
# begin
|
@@ -1730,6 +1988,7 @@ module Recurly
|
|
1730
1988
|
#
|
1731
1989
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1732
1990
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
1991
|
+
#
|
1733
1992
|
# @return [Resources::Invoice] The updated invoice.
|
1734
1993
|
# @example
|
1735
1994
|
# begin
|
@@ -1752,12 +2011,38 @@ module Recurly
|
|
1752
2011
|
#
|
1753
2012
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1754
2013
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2014
|
+
#
|
1755
2015
|
# @return [Resources::Invoice] The updated invoice.
|
2016
|
+
# @example
|
2017
|
+
# begin
|
2018
|
+
# invoice = @client.void_invoice(invoice_id: invoice_id)
|
2019
|
+
# puts "Voided invoice #{invoice}"
|
2020
|
+
# rescue Recurly::Errors::NotFoundError
|
2021
|
+
# # If the resource was not found, you may want to alert the user or
|
2022
|
+
# # just return nil
|
2023
|
+
# puts "Resource Not Found"
|
2024
|
+
# end
|
2025
|
+
#
|
1756
2026
|
def void_invoice(invoice_id:, **options)
|
1757
2027
|
path = interpolate_path("/invoices/{invoice_id}/void", invoice_id: invoice_id)
|
1758
2028
|
put(path, **options)
|
1759
2029
|
end
|
1760
2030
|
|
2031
|
+
# Record an external payment for a manual invoices.
|
2032
|
+
#
|
2033
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/record_external_transaction record_external_transaction api documenation}
|
2034
|
+
#
|
2035
|
+
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
2036
|
+
# @param body [Requests::ExternalTransaction] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ExternalTransaction}
|
2037
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2038
|
+
#
|
2039
|
+
# @return [Resources::Transaction] The recorded transaction.
|
2040
|
+
#
|
2041
|
+
def record_external_transaction(invoice_id:, body:, **options)
|
2042
|
+
path = interpolate_path("/invoices/{invoice_id}/transactions", invoice_id: invoice_id)
|
2043
|
+
post(path, body, Requests::ExternalTransaction, **options)
|
2044
|
+
end
|
2045
|
+
|
1761
2046
|
# List an invoice's line items
|
1762
2047
|
#
|
1763
2048
|
# {https://developers.recurly.com/api/v2019-10-10#operation/list_invoice_line_items list_invoice_line_items api documenation}
|
@@ -1781,17 +2066,27 @@ module Recurly
|
|
1781
2066
|
# order. In descending order updated records will move behind the cursor and could
|
1782
2067
|
# prevent some records from being returned.
|
1783
2068
|
#
|
1784
|
-
# @param begin_time [DateTime]
|
2069
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1785
2070
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1786
2071
|
#
|
1787
|
-
# @param end_time [DateTime]
|
2072
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1788
2073
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1789
2074
|
#
|
1790
2075
|
# @param original [String] Filter by original field.
|
1791
2076
|
# @param state [String] Filter by state field.
|
1792
2077
|
# @param type [String] Filter by type field.
|
1793
2078
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2079
|
+
#
|
1794
2080
|
# @return [Pager<Resources::LineItem>] A list of the invoice's line items.
|
2081
|
+
# @example
|
2082
|
+
# line_items = @client.list_invoice_line_items(
|
2083
|
+
# invoice_id: invoice_id,
|
2084
|
+
# limit: 200
|
2085
|
+
# )
|
2086
|
+
# line_items.each do |line_item|
|
2087
|
+
# puts "Line Item: #{line_item.id}"
|
2088
|
+
# end
|
2089
|
+
#
|
1795
2090
|
def list_invoice_line_items(invoice_id:, **options)
|
1796
2091
|
path = interpolate_path("/invoices/{invoice_id}/line_items", invoice_id: invoice_id)
|
1797
2092
|
pager(path, **options)
|
@@ -1818,13 +2113,14 @@ module Recurly
|
|
1818
2113
|
# order. In descending order updated records will move behind the cursor and could
|
1819
2114
|
# prevent some records from being returned.
|
1820
2115
|
#
|
1821
|
-
# @param begin_time [DateTime]
|
2116
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1822
2117
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1823
2118
|
#
|
1824
|
-
# @param end_time [DateTime]
|
2119
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1825
2120
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1826
2121
|
#
|
1827
2122
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2123
|
+
#
|
1828
2124
|
# @return [Pager<Resources::CouponRedemption>] A list of the the coupon redemptions associated with the invoice.
|
1829
2125
|
# @example
|
1830
2126
|
# coupon_redemptions = @client.list_invoice_coupon_redemptions(
|
@@ -1846,7 +2142,17 @@ module Recurly
|
|
1846
2142
|
#
|
1847
2143
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1848
2144
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2145
|
+
#
|
1849
2146
|
# @return [Pager<Resources::Invoice>] A list of the credit or charge invoices associated with the invoice.
|
2147
|
+
# @example
|
2148
|
+
# invoices = @client.list_related_invoices(
|
2149
|
+
# invoice_id: invoice_id,
|
2150
|
+
# limit: 200
|
2151
|
+
# )
|
2152
|
+
# invoices.each do |invoice|
|
2153
|
+
# puts "Invoice: #{invoice.number}"
|
2154
|
+
# end
|
2155
|
+
#
|
1850
2156
|
def list_related_invoices(invoice_id:, **options)
|
1851
2157
|
path = interpolate_path("/invoices/{invoice_id}/related_invoices", invoice_id: invoice_id)
|
1852
2158
|
pager(path, **options)
|
@@ -1859,6 +2165,7 @@ module Recurly
|
|
1859
2165
|
# @param invoice_id [String] Invoice ID or number. For ID no prefix is used e.g. +e28zov4fw0v2+. For number use prefix +number-+, e.g. +number-1000+.
|
1860
2166
|
# @param body [Requests::InvoiceRefund] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceRefund}
|
1861
2167
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2168
|
+
#
|
1862
2169
|
# @return [Resources::Invoice] Returns the new credit invoice.
|
1863
2170
|
# @example
|
1864
2171
|
# begin
|
@@ -1904,17 +2211,26 @@ module Recurly
|
|
1904
2211
|
# order. In descending order updated records will move behind the cursor and could
|
1905
2212
|
# prevent some records from being returned.
|
1906
2213
|
#
|
1907
|
-
# @param begin_time [DateTime]
|
2214
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1908
2215
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1909
2216
|
#
|
1910
|
-
# @param end_time [DateTime]
|
2217
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1911
2218
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1912
2219
|
#
|
1913
2220
|
# @param original [String] Filter by original field.
|
1914
2221
|
# @param state [String] Filter by state field.
|
1915
2222
|
# @param type [String] Filter by type field.
|
1916
2223
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2224
|
+
#
|
1917
2225
|
# @return [Pager<Resources::LineItem>] A list of the site's line items.
|
2226
|
+
# @example
|
2227
|
+
# line_items = @client.list_line_items(
|
2228
|
+
# limit: 200
|
2229
|
+
# )
|
2230
|
+
# line_items.each do |line_item|
|
2231
|
+
# puts "LineItem: #{line_item.id}"
|
2232
|
+
# end
|
2233
|
+
#
|
1918
2234
|
def list_line_items(**options)
|
1919
2235
|
path = interpolate_path("/line_items")
|
1920
2236
|
pager(path, **options)
|
@@ -1926,6 +2242,7 @@ module Recurly
|
|
1926
2242
|
#
|
1927
2243
|
# @param line_item_id [String] Line Item ID.
|
1928
2244
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2245
|
+
#
|
1929
2246
|
# @return [Resources::LineItem] A line item.
|
1930
2247
|
# @example
|
1931
2248
|
# begin
|
@@ -1948,6 +2265,7 @@ module Recurly
|
|
1948
2265
|
#
|
1949
2266
|
# @param line_item_id [String] Line Item ID.
|
1950
2267
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2268
|
+
#
|
1951
2269
|
# @return [Resources::Empty] Line item deleted.
|
1952
2270
|
# @example
|
1953
2271
|
# begin
|
@@ -1988,14 +2306,15 @@ module Recurly
|
|
1988
2306
|
# order. In descending order updated records will move behind the cursor and could
|
1989
2307
|
# prevent some records from being returned.
|
1990
2308
|
#
|
1991
|
-
# @param begin_time [DateTime]
|
2309
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
1992
2310
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1993
2311
|
#
|
1994
|
-
# @param end_time [DateTime]
|
2312
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
1995
2313
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
1996
2314
|
#
|
1997
2315
|
# @param state [String] Filter by state.
|
1998
2316
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2317
|
+
#
|
1999
2318
|
# @return [Pager<Resources::Plan>] A list of plans.
|
2000
2319
|
# @example
|
2001
2320
|
# plans = @client.list_plans(limit: 200)
|
@@ -2014,6 +2333,7 @@ module Recurly
|
|
2014
2333
|
#
|
2015
2334
|
# @param body [Requests::PlanCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PlanCreate}
|
2016
2335
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2336
|
+
#
|
2017
2337
|
# @return [Resources::Plan] A plan.
|
2018
2338
|
# @example
|
2019
2339
|
# begin
|
@@ -2053,6 +2373,7 @@ module Recurly
|
|
2053
2373
|
#
|
2054
2374
|
# @param plan_id [String] Plan ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2055
2375
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2376
|
+
#
|
2056
2377
|
# @return [Resources::Plan] A plan.
|
2057
2378
|
# @example
|
2058
2379
|
# begin
|
@@ -2076,7 +2397,21 @@ module Recurly
|
|
2076
2397
|
# @param plan_id [String] Plan ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2077
2398
|
# @param body [Requests::PlanUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PlanUpdate}
|
2078
2399
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2400
|
+
#
|
2079
2401
|
# @return [Resources::Plan] A plan.
|
2402
|
+
# @example
|
2403
|
+
# begin
|
2404
|
+
# plan_update = {
|
2405
|
+
# name: "Monthly Kombucha Subscription"
|
2406
|
+
# }
|
2407
|
+
# plan = @client.update_plan(plan_id: plan_id, body: plan_update)
|
2408
|
+
# puts "Updated plan #{plan}"
|
2409
|
+
# rescue Recurly::Errors::NotFoundError
|
2410
|
+
# # If the resource was not found, you may want to alert the user or
|
2411
|
+
# # just return nil
|
2412
|
+
# puts "Resource Not Found"
|
2413
|
+
# end
|
2414
|
+
#
|
2080
2415
|
def update_plan(plan_id:, body:, **options)
|
2081
2416
|
path = interpolate_path("/plans/{plan_id}", plan_id: plan_id)
|
2082
2417
|
put(path, body, Requests::PlanUpdate, **options)
|
@@ -2088,7 +2423,18 @@ module Recurly
|
|
2088
2423
|
#
|
2089
2424
|
# @param plan_id [String] Plan ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2090
2425
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2426
|
+
#
|
2091
2427
|
# @return [Resources::Plan] Plan deleted
|
2428
|
+
# @example
|
2429
|
+
# begin
|
2430
|
+
# plan = @client.remove_plan(plan_id: plan_id)
|
2431
|
+
# puts "Removed plan #{plan}"
|
2432
|
+
# rescue Recurly::Errors::NotFoundError
|
2433
|
+
# # If the resource was not found, you may want to alert the user or
|
2434
|
+
# # just return nil
|
2435
|
+
# puts "Resource Not Found"
|
2436
|
+
# end
|
2437
|
+
#
|
2092
2438
|
def remove_plan(plan_id:, **options)
|
2093
2439
|
path = interpolate_path("/plans/{plan_id}", plan_id: plan_id)
|
2094
2440
|
delete(path, **options)
|
@@ -2117,14 +2463,15 @@ module Recurly
|
|
2117
2463
|
# order. In descending order updated records will move behind the cursor and could
|
2118
2464
|
# prevent some records from being returned.
|
2119
2465
|
#
|
2120
|
-
# @param begin_time [DateTime]
|
2466
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
2121
2467
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2122
2468
|
#
|
2123
|
-
# @param end_time [DateTime]
|
2469
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
2124
2470
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2125
2471
|
#
|
2126
2472
|
# @param state [String] Filter by state.
|
2127
2473
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2474
|
+
#
|
2128
2475
|
# @return [Pager<Resources::AddOn>] A list of add-ons.
|
2129
2476
|
# @example
|
2130
2477
|
# add_ons = @client.list_plan_add_ons(
|
@@ -2147,7 +2494,29 @@ module Recurly
|
|
2147
2494
|
# @param plan_id [String] Plan ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2148
2495
|
# @param body [Requests::AddOnCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AddOnCreate}
|
2149
2496
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2497
|
+
#
|
2150
2498
|
# @return [Resources::AddOn] An add-on.
|
2499
|
+
# @example
|
2500
|
+
# begin
|
2501
|
+
# new_add_on = {
|
2502
|
+
# code: 'coffee_grinder',
|
2503
|
+
# name: 'A quality grinder for your beans',
|
2504
|
+
# default_quantity: 1,
|
2505
|
+
# currencies: [
|
2506
|
+
# {
|
2507
|
+
# currency: 'USD',
|
2508
|
+
# unit_amount: 10_000
|
2509
|
+
# }
|
2510
|
+
# ]
|
2511
|
+
# }
|
2512
|
+
# add_on = @client.create_plan_add_on(plan_id: plan_id, body: new_add_on)
|
2513
|
+
# puts "Created plan add-on #{add_on}"
|
2514
|
+
# rescue Recurly::Errors::NotFoundError
|
2515
|
+
# # If the resource was not found, you may want to alert the user or
|
2516
|
+
# # just return nil
|
2517
|
+
# puts "Resource Not Found"
|
2518
|
+
# end
|
2519
|
+
#
|
2151
2520
|
def create_plan_add_on(plan_id:, body:, **options)
|
2152
2521
|
path = interpolate_path("/plans/{plan_id}/add_ons", plan_id: plan_id)
|
2153
2522
|
post(path, body, Requests::AddOnCreate, **options)
|
@@ -2160,6 +2529,7 @@ module Recurly
|
|
2160
2529
|
# @param plan_id [String] Plan ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2161
2530
|
# @param add_on_id [String] Add-on ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2162
2531
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2532
|
+
#
|
2163
2533
|
# @return [Resources::AddOn] An add-on.
|
2164
2534
|
# @example
|
2165
2535
|
# begin
|
@@ -2186,7 +2556,25 @@ module Recurly
|
|
2186
2556
|
# @param add_on_id [String] Add-on ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2187
2557
|
# @param body [Requests::AddOnUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AddOnUpdate}
|
2188
2558
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2559
|
+
#
|
2189
2560
|
# @return [Resources::AddOn] An add-on.
|
2561
|
+
# @example
|
2562
|
+
# begin
|
2563
|
+
# add_on_update = {
|
2564
|
+
# name: "A quality grinder for your finest beans"
|
2565
|
+
# }
|
2566
|
+
# add_on = @client.update_plan_add_on(
|
2567
|
+
# plan_id: plan_id,
|
2568
|
+
# add_on_id: add_on_id,
|
2569
|
+
# body: add_on_update
|
2570
|
+
# )
|
2571
|
+
# puts "Updated add-on #{add_on}"
|
2572
|
+
# rescue Recurly::Errors::NotFoundError
|
2573
|
+
# # If the resource was not found, you may want to alert the user or
|
2574
|
+
# # just return nil
|
2575
|
+
# puts "Resource Not Found"
|
2576
|
+
# end
|
2577
|
+
#
|
2190
2578
|
def update_plan_add_on(plan_id:, add_on_id:, body:, **options)
|
2191
2579
|
path = interpolate_path("/plans/{plan_id}/add_ons/{add_on_id}", plan_id: plan_id, add_on_id: add_on_id)
|
2192
2580
|
put(path, body, Requests::AddOnUpdate, **options)
|
@@ -2199,7 +2587,21 @@ module Recurly
|
|
2199
2587
|
# @param plan_id [String] Plan ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2200
2588
|
# @param add_on_id [String] Add-on ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2201
2589
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2590
|
+
#
|
2202
2591
|
# @return [Resources::AddOn] Add-on deleted
|
2592
|
+
# @example
|
2593
|
+
# begin
|
2594
|
+
# add_on = @client.remove_plan_add_on(
|
2595
|
+
# plan_id: plan_id,
|
2596
|
+
# add_on_id: add_on_id
|
2597
|
+
# )
|
2598
|
+
# puts "Removed add-on #{add_on}"
|
2599
|
+
# rescue Recurly::Errors::NotFoundError
|
2600
|
+
# # If the resource was not found, you may want to alert the user or
|
2601
|
+
# # just return nil
|
2602
|
+
# puts "Resource Not Found"
|
2603
|
+
# end
|
2604
|
+
#
|
2203
2605
|
def remove_plan_add_on(plan_id:, add_on_id:, **options)
|
2204
2606
|
path = interpolate_path("/plans/{plan_id}/add_ons/{add_on_id}", plan_id: plan_id, add_on_id: add_on_id)
|
2205
2607
|
delete(path, **options)
|
@@ -2227,15 +2629,24 @@ module Recurly
|
|
2227
2629
|
# order. In descending order updated records will move behind the cursor and could
|
2228
2630
|
# prevent some records from being returned.
|
2229
2631
|
#
|
2230
|
-
# @param begin_time [DateTime]
|
2632
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
2231
2633
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2232
2634
|
#
|
2233
|
-
# @param end_time [DateTime]
|
2635
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
2234
2636
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2235
2637
|
#
|
2236
2638
|
# @param state [String] Filter by state.
|
2237
2639
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2640
|
+
#
|
2238
2641
|
# @return [Pager<Resources::AddOn>] A list of add-ons.
|
2642
|
+
# @example
|
2643
|
+
# add_ons = @client.list_add_ons(
|
2644
|
+
# limit: 200
|
2645
|
+
# )
|
2646
|
+
# add_ons.each do |add_on|
|
2647
|
+
# puts "AddOn: #{add_on.code}"
|
2648
|
+
# end
|
2649
|
+
#
|
2239
2650
|
def list_add_ons(**options)
|
2240
2651
|
path = interpolate_path("/add_ons")
|
2241
2652
|
pager(path, **options)
|
@@ -2247,7 +2658,18 @@ module Recurly
|
|
2247
2658
|
#
|
2248
2659
|
# @param add_on_id [String] Add-on ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
2249
2660
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2661
|
+
#
|
2250
2662
|
# @return [Resources::AddOn] An add-on.
|
2663
|
+
# @example
|
2664
|
+
# begin
|
2665
|
+
# add_on = @client.get_add_on(add_on_id: add_on_id)
|
2666
|
+
# puts "Got add-on #{add_on}"
|
2667
|
+
# rescue Recurly::Errors::NotFoundError
|
2668
|
+
# # If the resource was not found, you may want to alert the user or
|
2669
|
+
# # just return nil
|
2670
|
+
# puts "Resource Not Found"
|
2671
|
+
# end
|
2672
|
+
#
|
2251
2673
|
def get_add_on(add_on_id:, **options)
|
2252
2674
|
path = interpolate_path("/add_ons/{add_on_id}", add_on_id: add_on_id)
|
2253
2675
|
get(path, **options)
|
@@ -2275,31 +2697,85 @@ module Recurly
|
|
2275
2697
|
# order. In descending order updated records will move behind the cursor and could
|
2276
2698
|
# prevent some records from being returned.
|
2277
2699
|
#
|
2278
|
-
# @param begin_time [DateTime]
|
2700
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
2279
2701
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2280
2702
|
#
|
2281
|
-
# @param end_time [DateTime]
|
2703
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
2282
2704
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2283
2705
|
#
|
2284
2706
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2707
|
+
#
|
2285
2708
|
# @return [Pager<Resources::ShippingMethod>] A list of the site's shipping methods.
|
2709
|
+
# @example
|
2710
|
+
# shipping_methods = @client.list_shipping_methods(
|
2711
|
+
# limit: 200
|
2712
|
+
# )
|
2713
|
+
# shipping_methods.each do |shipping_method|
|
2714
|
+
# puts "Shipping Method: #{shipping_method.code}"
|
2715
|
+
# end
|
2716
|
+
#
|
2286
2717
|
def list_shipping_methods(**options)
|
2287
2718
|
path = interpolate_path("/shipping_methods")
|
2288
2719
|
pager(path, **options)
|
2289
2720
|
end
|
2290
2721
|
|
2722
|
+
# Create a new shipping method
|
2723
|
+
#
|
2724
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/create_shipping_method create_shipping_method api documenation}
|
2725
|
+
#
|
2726
|
+
# @param body [Requests::ShippingMethodCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingMethodCreate}
|
2727
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2728
|
+
#
|
2729
|
+
# @return [Resources::ShippingMethod] A new shipping method.
|
2730
|
+
#
|
2731
|
+
def create_shipping_method(body:, **options)
|
2732
|
+
path = interpolate_path("/shipping_methods")
|
2733
|
+
post(path, body, Requests::ShippingMethodCreate, **options)
|
2734
|
+
end
|
2735
|
+
|
2291
2736
|
# Fetch a shipping method
|
2292
2737
|
#
|
2293
2738
|
# {https://developers.recurly.com/api/v2019-10-10#operation/get_shipping_method get_shipping_method api documenation}
|
2294
2739
|
#
|
2295
2740
|
# @param id [String] Shipping Method ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-usps_2-day+.
|
2296
2741
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2297
|
-
#
|
2742
|
+
#
|
2743
|
+
# @return [Resources::ShippingMethod] A shipping method.
|
2744
|
+
#
|
2298
2745
|
def get_shipping_method(id:, **options)
|
2299
2746
|
path = interpolate_path("/shipping_methods/{id}", id: id)
|
2300
2747
|
get(path, **options)
|
2301
2748
|
end
|
2302
2749
|
|
2750
|
+
# Update an active Shipping Method
|
2751
|
+
#
|
2752
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/update_shipping_method update_shipping_method api documenation}
|
2753
|
+
#
|
2754
|
+
# @param shipping_method_id [String] Shipping Method ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-usps_2-day+.
|
2755
|
+
# @param body [Requests::ShippingMethodUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingMethodUpdate}
|
2756
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2757
|
+
#
|
2758
|
+
# @return [Resources::ShippingMethod] The updated shipping method.
|
2759
|
+
#
|
2760
|
+
def update_shipping_method(shipping_method_id:, body:, **options)
|
2761
|
+
path = interpolate_path("/shipping_methods/{shipping_method_id}", shipping_method_id: shipping_method_id)
|
2762
|
+
put(path, body, Requests::ShippingMethodUpdate, **options)
|
2763
|
+
end
|
2764
|
+
|
2765
|
+
# Deactivate a shipping method
|
2766
|
+
#
|
2767
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/deactivate_shipping_method deactivate_shipping_method api documenation}
|
2768
|
+
#
|
2769
|
+
# @param shipping_method_id [String] Shipping Method ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-usps_2-day+.
|
2770
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2771
|
+
#
|
2772
|
+
# @return [Resources::ShippingMethod] A shipping method.
|
2773
|
+
#
|
2774
|
+
def deactivate_shipping_method(shipping_method_id:, **options)
|
2775
|
+
path = interpolate_path("/shipping_methods/{shipping_method_id}", shipping_method_id: shipping_method_id)
|
2776
|
+
delete(path, **options)
|
2777
|
+
end
|
2778
|
+
|
2303
2779
|
# List a site's subscriptions
|
2304
2780
|
#
|
2305
2781
|
# {https://developers.recurly.com/api/v2019-10-10#operation/list_subscriptions list_subscriptions api documenation}
|
@@ -2322,10 +2798,10 @@ module Recurly
|
|
2322
2798
|
# order. In descending order updated records will move behind the cursor and could
|
2323
2799
|
# prevent some records from being returned.
|
2324
2800
|
#
|
2325
|
-
# @param begin_time [DateTime]
|
2801
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
2326
2802
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2327
2803
|
#
|
2328
|
-
# @param end_time [DateTime]
|
2804
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
2329
2805
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2330
2806
|
#
|
2331
2807
|
# @param state [String] Filter by state.
|
@@ -2335,6 +2811,7 @@ module Recurly
|
|
2335
2811
|
# - When +state=live+, only subscriptions that are in an active, canceled, or future state or are in trial will be returned.
|
2336
2812
|
#
|
2337
2813
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2814
|
+
#
|
2338
2815
|
# @return [Pager<Resources::Subscription>] A list of the site's subscriptions.
|
2339
2816
|
# @example
|
2340
2817
|
# subscriptions = @client.list_subscriptions(limit: 200)
|
@@ -2353,6 +2830,7 @@ module Recurly
|
|
2353
2830
|
#
|
2354
2831
|
# @param body [Requests::SubscriptionCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionCreate}
|
2355
2832
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2833
|
+
#
|
2356
2834
|
# @return [Resources::Subscription] A subscription.
|
2357
2835
|
# @example
|
2358
2836
|
# begin
|
@@ -2386,6 +2864,7 @@ module Recurly
|
|
2386
2864
|
#
|
2387
2865
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2388
2866
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2867
|
+
#
|
2389
2868
|
# @return [Resources::Subscription] A subscription.
|
2390
2869
|
# @example
|
2391
2870
|
# begin
|
@@ -2411,6 +2890,7 @@ module Recurly
|
|
2411
2890
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2412
2891
|
# @param body [Requests::SubscriptionUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionUpdate}
|
2413
2892
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2893
|
+
#
|
2414
2894
|
# @return [Resources::Subscription] A subscription.
|
2415
2895
|
# @example
|
2416
2896
|
# begin
|
@@ -2450,6 +2930,7 @@ module Recurly
|
|
2450
2930
|
# You may also terminate a subscription with no refund and then manually refund specific invoices.
|
2451
2931
|
#
|
2452
2932
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2933
|
+
#
|
2453
2934
|
# @return [Resources::Subscription] An expired subscription.
|
2454
2935
|
# @example
|
2455
2936
|
# begin
|
@@ -2475,6 +2956,7 @@ module Recurly
|
|
2475
2956
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2476
2957
|
# @param body [Requests::SubscriptionCancel] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionCancel}
|
2477
2958
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2959
|
+
#
|
2478
2960
|
# @return [Resources::Subscription] A canceled or failed subscription.
|
2479
2961
|
# @example
|
2480
2962
|
# begin
|
@@ -2499,6 +2981,7 @@ module Recurly
|
|
2499
2981
|
#
|
2500
2982
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2501
2983
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
2984
|
+
#
|
2502
2985
|
# @return [Resources::Subscription] An active subscription.
|
2503
2986
|
# @example
|
2504
2987
|
# begin
|
@@ -2524,6 +3007,7 @@ module Recurly
|
|
2524
3007
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2525
3008
|
# @param body [Requests::SubscriptionPause] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionPause}
|
2526
3009
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3010
|
+
#
|
2527
3011
|
# @return [Resources::Subscription] A subscription.
|
2528
3012
|
# @example
|
2529
3013
|
# begin
|
@@ -2552,6 +3036,7 @@ module Recurly
|
|
2552
3036
|
#
|
2553
3037
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2554
3038
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3039
|
+
#
|
2555
3040
|
# @return [Resources::Subscription] A subscription.
|
2556
3041
|
# @example
|
2557
3042
|
# begin
|
@@ -2576,7 +3061,9 @@ module Recurly
|
|
2576
3061
|
#
|
2577
3062
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2578
3063
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3064
|
+
#
|
2579
3065
|
# @return [Resources::Subscription] A subscription.
|
3066
|
+
#
|
2580
3067
|
def convert_trial(subscription_id:, **options)
|
2581
3068
|
path = interpolate_path("/subscriptions/{subscription_id}/convert_trial", subscription_id: subscription_id)
|
2582
3069
|
put(path, **options)
|
@@ -2588,6 +3075,7 @@ module Recurly
|
|
2588
3075
|
#
|
2589
3076
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2590
3077
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3078
|
+
#
|
2591
3079
|
# @return [Resources::SubscriptionChange] A subscription's pending change.
|
2592
3080
|
# @example
|
2593
3081
|
# begin
|
@@ -2613,6 +3101,7 @@ module Recurly
|
|
2613
3101
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2614
3102
|
# @param body [Requests::SubscriptionChangeCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionChangeCreate}
|
2615
3103
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3104
|
+
#
|
2616
3105
|
# @return [Resources::SubscriptionChange] A subscription change.
|
2617
3106
|
# @example
|
2618
3107
|
# begin
|
@@ -2642,6 +3131,7 @@ module Recurly
|
|
2642
3131
|
#
|
2643
3132
|
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2644
3133
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3134
|
+
#
|
2645
3135
|
# @return [Resources::Empty] Subscription change was deleted.
|
2646
3136
|
# @example
|
2647
3137
|
# begin
|
@@ -2660,6 +3150,21 @@ module Recurly
|
|
2660
3150
|
delete(path, **options)
|
2661
3151
|
end
|
2662
3152
|
|
3153
|
+
# Preview a new subscription change
|
3154
|
+
#
|
3155
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/preview_subscription_change preview_subscription_change api documenation}
|
3156
|
+
#
|
3157
|
+
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
3158
|
+
# @param body [Requests::SubscriptionChangeCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionChangeCreate}
|
3159
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3160
|
+
#
|
3161
|
+
# @return [Resources::SubscriptionChangePreview] A subscription change.
|
3162
|
+
#
|
3163
|
+
def preview_subscription_change(subscription_id:, body:, **options)
|
3164
|
+
path = interpolate_path("/subscriptions/{subscription_id}/change/preview", subscription_id: subscription_id)
|
3165
|
+
post(path, body, Requests::SubscriptionChangeCreate, **options)
|
3166
|
+
end
|
3167
|
+
|
2663
3168
|
# List a subscription's invoices
|
2664
3169
|
#
|
2665
3170
|
# {https://developers.recurly.com/api/v2019-10-10#operation/list_subscription_invoices list_subscription_invoices api documenation}
|
@@ -2683,10 +3188,10 @@ module Recurly
|
|
2683
3188
|
# order. In descending order updated records will move behind the cursor and could
|
2684
3189
|
# prevent some records from being returned.
|
2685
3190
|
#
|
2686
|
-
# @param begin_time [DateTime]
|
3191
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
2687
3192
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2688
3193
|
#
|
2689
|
-
# @param end_time [DateTime]
|
3194
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
2690
3195
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2691
3196
|
#
|
2692
3197
|
# @param type [String] Filter by type when:
|
@@ -2696,6 +3201,7 @@ module Recurly
|
|
2696
3201
|
# - +type=legacy+, only legacy invoices will be returned.
|
2697
3202
|
#
|
2698
3203
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3204
|
+
#
|
2699
3205
|
# @return [Pager<Resources::Invoice>] A list of the subscription's invoices.
|
2700
3206
|
# @example
|
2701
3207
|
# invoices = @client.list_subscription_invoices(
|
@@ -2734,16 +3240,17 @@ module Recurly
|
|
2734
3240
|
# order. In descending order updated records will move behind the cursor and could
|
2735
3241
|
# prevent some records from being returned.
|
2736
3242
|
#
|
2737
|
-
# @param begin_time [DateTime]
|
3243
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
2738
3244
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2739
3245
|
#
|
2740
|
-
# @param end_time [DateTime]
|
3246
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
2741
3247
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2742
3248
|
#
|
2743
3249
|
# @param original [String] Filter by original field.
|
2744
3250
|
# @param state [String] Filter by state field.
|
2745
3251
|
# @param type [String] Filter by type field.
|
2746
3252
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3253
|
+
#
|
2747
3254
|
# @return [Pager<Resources::LineItem>] A list of the subscription's line items.
|
2748
3255
|
# @example
|
2749
3256
|
# line_items = @client.list_subscription_line_items(
|
@@ -2780,13 +3287,14 @@ module Recurly
|
|
2780
3287
|
# order. In descending order updated records will move behind the cursor and could
|
2781
3288
|
# prevent some records from being returned.
|
2782
3289
|
#
|
2783
|
-
# @param begin_time [DateTime]
|
3290
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
2784
3291
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2785
3292
|
#
|
2786
|
-
# @param end_time [DateTime]
|
3293
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
2787
3294
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2788
3295
|
#
|
2789
3296
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3297
|
+
#
|
2790
3298
|
# @return [Pager<Resources::CouponRedemption>] A list of the the coupon redemptions on a subscription.
|
2791
3299
|
# @example
|
2792
3300
|
# coupon_redemptions = @client.list_subscription_coupon_redemptions(
|
@@ -2802,6 +3310,93 @@ module Recurly
|
|
2802
3310
|
pager(path, **options)
|
2803
3311
|
end
|
2804
3312
|
|
3313
|
+
# List a subscription add-on's usage records
|
3314
|
+
#
|
3315
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/list_usage list_usage api documenation}
|
3316
|
+
#
|
3317
|
+
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
3318
|
+
# @param add_on_id [String] Add-on ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
3319
|
+
# @param limit [Integer] Limit number of records 1-200.
|
3320
|
+
# @param order [String] Sort order.
|
3321
|
+
# @param sort [String] Sort field. You *really* only want to sort by +usage_timestamp+ in ascending
|
3322
|
+
# order. In descending order updated records will move behind the cursor and could
|
3323
|
+
# prevent some records from being returned.
|
3324
|
+
#
|
3325
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=usage_timestamp+ or +sort=recorded_timestamp+.
|
3326
|
+
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
3327
|
+
#
|
3328
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=usage_timestamp+ or +sort=recorded_timestamp+.
|
3329
|
+
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
3330
|
+
#
|
3331
|
+
# @param billing_status [String] Filter by usage record's billing status
|
3332
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3333
|
+
#
|
3334
|
+
# @return [Pager<Resources::Usage>] A list of the subscription add-on's usage records.
|
3335
|
+
#
|
3336
|
+
def list_usage(subscription_id:, add_on_id:, **options)
|
3337
|
+
path = interpolate_path("/subscriptions/{subscription_id}/add_ons/{add_on_id}/usage", subscription_id: subscription_id, add_on_id: add_on_id)
|
3338
|
+
pager(path, **options)
|
3339
|
+
end
|
3340
|
+
|
3341
|
+
# Log a usage record on this subscription add-on
|
3342
|
+
#
|
3343
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/create_usage create_usage api documenation}
|
3344
|
+
#
|
3345
|
+
# @param subscription_id [String] Subscription ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
3346
|
+
# @param add_on_id [String] Add-on ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-gold+.
|
3347
|
+
# @param body [Requests::UsageCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::UsageCreate}
|
3348
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3349
|
+
#
|
3350
|
+
# @return [Resources::Usage] The created usage record.
|
3351
|
+
#
|
3352
|
+
def create_usage(subscription_id:, add_on_id:, body:, **options)
|
3353
|
+
path = interpolate_path("/subscriptions/{subscription_id}/add_ons/{add_on_id}/usage", subscription_id: subscription_id, add_on_id: add_on_id)
|
3354
|
+
post(path, body, Requests::UsageCreate, **options)
|
3355
|
+
end
|
3356
|
+
|
3357
|
+
# Get a usage record
|
3358
|
+
#
|
3359
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/get_usage get_usage api documenation}
|
3360
|
+
#
|
3361
|
+
# @param usage_id [String] Usage Record ID.
|
3362
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3363
|
+
#
|
3364
|
+
# @return [Resources::Usage] The usage record.
|
3365
|
+
#
|
3366
|
+
def get_usage(usage_id:, **options)
|
3367
|
+
path = interpolate_path("/usage/{usage_id}", usage_id: usage_id)
|
3368
|
+
get(path, **options)
|
3369
|
+
end
|
3370
|
+
|
3371
|
+
# Update a usage record
|
3372
|
+
#
|
3373
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/update_usage update_usage api documenation}
|
3374
|
+
#
|
3375
|
+
# @param usage_id [String] Usage Record ID.
|
3376
|
+
# @param body [Requests::UsageCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::UsageCreate}
|
3377
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3378
|
+
#
|
3379
|
+
# @return [Resources::Usage] The updated usage record.
|
3380
|
+
#
|
3381
|
+
def update_usage(usage_id:, body:, **options)
|
3382
|
+
path = interpolate_path("/usage/{usage_id}", usage_id: usage_id)
|
3383
|
+
put(path, body, Requests::UsageCreate, **options)
|
3384
|
+
end
|
3385
|
+
|
3386
|
+
# Delete a usage record.
|
3387
|
+
#
|
3388
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/remove_usage remove_usage api documenation}
|
3389
|
+
#
|
3390
|
+
# @param usage_id [String] Usage Record ID.
|
3391
|
+
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3392
|
+
#
|
3393
|
+
# @return [Resources::Empty] Usage was successfully deleted.
|
3394
|
+
#
|
3395
|
+
def remove_usage(usage_id:, **options)
|
3396
|
+
path = interpolate_path("/usage/{usage_id}", usage_id: usage_id)
|
3397
|
+
delete(path, **options)
|
3398
|
+
end
|
3399
|
+
|
2805
3400
|
# List a site's transactions
|
2806
3401
|
#
|
2807
3402
|
# {https://developers.recurly.com/api/v2019-10-10#operation/list_transactions list_transactions api documenation}
|
@@ -2824,15 +3419,16 @@ module Recurly
|
|
2824
3419
|
# order. In descending order updated records will move behind the cursor and could
|
2825
3420
|
# prevent some records from being returned.
|
2826
3421
|
#
|
2827
|
-
# @param begin_time [DateTime]
|
3422
|
+
# @param begin_time [DateTime] Inclusively filter by begin_time when +sort=created_at+ or +sort=updated_at+.
|
2828
3423
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2829
3424
|
#
|
2830
|
-
# @param end_time [DateTime]
|
3425
|
+
# @param end_time [DateTime] Inclusively filter by end_time when +sort=created_at+ or +sort=updated_at+.
|
2831
3426
|
# *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
|
2832
3427
|
#
|
2833
3428
|
# @param type [String] Filter by type field. The value +payment+ will return both +purchase+ and +capture+ transactions.
|
2834
3429
|
# @param success [String] Filter by success field.
|
2835
3430
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3431
|
+
#
|
2836
3432
|
# @return [Pager<Resources::Transaction>] A list of the site's transactions.
|
2837
3433
|
# @example
|
2838
3434
|
# transactions = @client.list_transactions(limit: 200)
|
@@ -2851,6 +3447,7 @@ module Recurly
|
|
2851
3447
|
#
|
2852
3448
|
# @param transaction_id [String] Transaction ID or UUID. For ID no prefix is used e.g. +e28zov4fw0v2+. For UUID use prefix +uuid-+, e.g. +uuid-123457890+.
|
2853
3449
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3450
|
+
#
|
2854
3451
|
# @return [Resources::Transaction] A transaction.
|
2855
3452
|
# @example
|
2856
3453
|
# begin
|
@@ -2873,7 +3470,9 @@ module Recurly
|
|
2873
3470
|
#
|
2874
3471
|
# @param unique_coupon_code_id [String] Unique Coupon Code ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-abc-8dh2-def+.
|
2875
3472
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3473
|
+
#
|
2876
3474
|
# @return [Resources::UniqueCouponCode] A unique coupon code.
|
3475
|
+
#
|
2877
3476
|
def get_unique_coupon_code(unique_coupon_code_id:, **options)
|
2878
3477
|
path = interpolate_path("/unique_coupon_codes/{unique_coupon_code_id}", unique_coupon_code_id: unique_coupon_code_id)
|
2879
3478
|
get(path, **options)
|
@@ -2885,7 +3484,9 @@ module Recurly
|
|
2885
3484
|
#
|
2886
3485
|
# @param unique_coupon_code_id [String] Unique Coupon Code ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-abc-8dh2-def+.
|
2887
3486
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3487
|
+
#
|
2888
3488
|
# @return [Resources::UniqueCouponCode] A unique coupon code.
|
3489
|
+
#
|
2889
3490
|
def deactivate_unique_coupon_code(unique_coupon_code_id:, **options)
|
2890
3491
|
path = interpolate_path("/unique_coupon_codes/{unique_coupon_code_id}", unique_coupon_code_id: unique_coupon_code_id)
|
2891
3492
|
delete(path, **options)
|
@@ -2897,7 +3498,9 @@ module Recurly
|
|
2897
3498
|
#
|
2898
3499
|
# @param unique_coupon_code_id [String] Unique Coupon Code ID or code. For ID no prefix is used e.g. +e28zov4fw0v2+. For code use prefix +code-+, e.g. +code-abc-8dh2-def+.
|
2899
3500
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3501
|
+
#
|
2900
3502
|
# @return [Resources::UniqueCouponCode] A unique coupon code.
|
3503
|
+
#
|
2901
3504
|
def reactivate_unique_coupon_code(unique_coupon_code_id:, **options)
|
2902
3505
|
path = interpolate_path("/unique_coupon_codes/{unique_coupon_code_id}/restore", unique_coupon_code_id: unique_coupon_code_id)
|
2903
3506
|
put(path, **options)
|
@@ -2909,6 +3512,7 @@ module Recurly
|
|
2909
3512
|
#
|
2910
3513
|
# @param body [Requests::PurchaseCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PurchaseCreate}
|
2911
3514
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3515
|
+
#
|
2912
3516
|
# @return [Resources::InvoiceCollection] Returns the new invoices
|
2913
3517
|
# @example
|
2914
3518
|
# begin
|
@@ -2948,6 +3552,7 @@ module Recurly
|
|
2948
3552
|
#
|
2949
3553
|
# @param body [Requests::PurchaseCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PurchaseCreate}
|
2950
3554
|
# @param site_id [String] Site ID or subdomain. For ID no prefix is used e.g. +e28zov4fw0v2+. For subdomain use prefix +subdomain-+, e.g. +subdomain-recurly+.
|
3555
|
+
#
|
2951
3556
|
# @return [Resources::InvoiceCollection] Returns preview of the new invoices
|
2952
3557
|
# @example
|
2953
3558
|
# begin
|