recurly 3.4.1 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +1 -1
- data/.github/workflows/docs.yml +28 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +49 -12
- data/README.md +1 -1
- data/lib/recurly/client.rb +51 -30
- data/lib/recurly/client/operations.rb +12 -0
- data/lib/recurly/http.rb +2 -1
- data/lib/recurly/pager.rb +31 -12
- data/lib/recurly/requests/add_on_create.rb +13 -1
- data/lib/recurly/requests/add_on_update.rb +9 -1
- data/lib/recurly/requests/billing_info_create.rb +17 -1
- data/lib/recurly/requests/subscription_add_on_create.rb +5 -1
- data/lib/recurly/requests/subscription_add_on_tier.rb +18 -0
- data/lib/recurly/requests/subscription_add_on_update.rb +4 -0
- data/lib/recurly/requests/tier.rb +18 -0
- data/lib/recurly/resources/add_on.rb +8 -0
- data/lib/recurly/resources/subscription_add_on.rb +8 -0
- data/lib/recurly/resources/subscription_add_on_tier.rb +18 -0
- data/lib/recurly/resources/tier.rb +18 -0
- data/lib/recurly/version.rb +1 -1
- data/openapi/api.yaml +184 -4
- data/recurly.gemspec +8 -0
- data/scripts/changelog +2 -0
- data/scripts/release +5 -3
- metadata +14 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cb7459191e21c44fd4796091c9aba791fbc079c446aad569513bc3df26e5f10
|
4
|
+
data.tar.gz: 632a9ff4168fbdeeff508dc643920bf2290d225eaed28d5c7d0d92897495a26a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7981c548326df5a65652e8184410a959927ad0b0630c1da6f286965389bb27a71a3da51e7e9804589b3564a94a4e266fc54f686eca3cd6d1b0aa6af779c73694
|
7
|
+
data.tar.gz: 10b42ef5247e4ecad7112c8b9ca9f2e8cbee81bacc4c55a773e1e4d1bcdec42cf4f01847a83c6975f46f9d5c86bba9bdd97d4f0b10710f891be1be0f2c2ab437
|
data/.bumpversion.cfg
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
on:
|
2
|
+
release:
|
3
|
+
types:
|
4
|
+
- published
|
5
|
+
name: Documentation
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
name: Publish
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
|
13
|
+
- uses: ruby/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: '2.6'
|
16
|
+
|
17
|
+
- name: Build Library and Docs
|
18
|
+
run: ./scripts/build
|
19
|
+
|
20
|
+
- name: Deploy
|
21
|
+
if: success()
|
22
|
+
uses: crazy-max/ghaction-github-pages@v1
|
23
|
+
with:
|
24
|
+
target_branch: gh-pages
|
25
|
+
build_dir: ./doc
|
26
|
+
env:
|
27
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
28
|
+
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,40 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [3.5.0](https://github.com/recurly/recurly-client-ruby/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.4.1...HEAD)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Tue Apr 14 20:21:21 UTC 2020 Upgrade API version v2019-10-10 [\#585](https://github.com/recurly/recurly-client-ruby/pull/585) ([bhelx](https://github.com/bhelx))
|
10
|
+
- Set an Idempotency-Key header, retry GET requests after 5xx errors [\#579](https://github.com/recurly/recurly-client-ruby/pull/579) ([isaachall](https://github.com/isaachall))
|
11
|
+
- Adding \#first and \#count methods to Pager [\#560](https://github.com/recurly/recurly-client-ruby/pull/560) ([douglasmiller](https://github.com/douglasmiller))
|
12
|
+
|
13
|
+
**Fixed bugs:**
|
14
|
+
|
15
|
+
- Fixing the omission of query params [\#581](https://github.com/recurly/recurly-client-ruby/pull/581) ([douglasmiller](https://github.com/douglasmiller))
|
16
|
+
|
17
|
+
**Merged pull requests:**
|
18
|
+
|
19
|
+
- Release 3.5.0 [\#586](https://github.com/recurly/recurly-client-ruby/pull/586) ([douglasmiller](https://github.com/douglasmiller))
|
20
|
+
- Included the to-be released changes in the changelog [\#584](https://github.com/recurly/recurly-client-ruby/pull/584) ([douglasmiller](https://github.com/douglasmiller))
|
21
|
+
- Add 2.7 to test matrix [\#582](https://github.com/recurly/recurly-client-ruby/pull/582) ([bhelx](https://github.com/bhelx))
|
22
|
+
- Use github pages for docs [\#580](https://github.com/recurly/recurly-client-ruby/pull/580) ([bhelx](https://github.com/bhelx))
|
23
|
+
- Add project metadata to the gemspec [\#578](https://github.com/recurly/recurly-client-ruby/pull/578) ([orien](https://github.com/orien))
|
24
|
+
- Updating release script to be uniform across all clients [\#577](https://github.com/recurly/recurly-client-ruby/pull/577) ([douglasmiller](https://github.com/douglasmiller))
|
25
|
+
- Thu Mar 26 20:41:10 UTC 2020 Upgrade API version v2019-10-10 [\#573](https://github.com/recurly/recurly-client-ruby/pull/573) ([bhelx](https://github.com/bhelx))
|
26
|
+
|
27
|
+
## [3.4.1](https://github.com/recurly/recurly-client-ruby/tree/3.4.1) (2020-03-26)
|
28
|
+
|
29
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.4.0...3.4.1)
|
30
|
+
|
31
|
+
**Merged pull requests:**
|
32
|
+
|
33
|
+
- Release 3.4.1 [\#571](https://github.com/recurly/recurly-client-ruby/pull/571) ([bhelx](https://github.com/bhelx))
|
34
|
+
- Follow up bug fixes for \#568 [\#570](https://github.com/recurly/recurly-client-ruby/pull/570) ([bhelx](https://github.com/bhelx))
|
2
35
|
|
3
36
|
## [3.4.0](https://github.com/recurly/recurly-client-ruby/tree/3.4.0) (2020-03-23)
|
37
|
+
|
4
38
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.3.1...3.4.0)
|
5
39
|
|
6
40
|
**Implemented enhancements:**
|
@@ -12,6 +46,7 @@
|
|
12
46
|
- Release 3.4.0 [\#569](https://github.com/recurly/recurly-client-ruby/pull/569) ([bhelx](https://github.com/bhelx))
|
13
47
|
|
14
48
|
## [3.3.1](https://github.com/recurly/recurly-client-ruby/tree/3.3.1) (2020-03-20)
|
49
|
+
|
15
50
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.3.0...3.3.1)
|
16
51
|
|
17
52
|
**Merged pull requests:**
|
@@ -23,6 +58,7 @@
|
|
23
58
|
- Add request for stack trace in issue report [\#558](https://github.com/recurly/recurly-client-ruby/pull/558) ([bhelx](https://github.com/bhelx))
|
24
59
|
|
25
60
|
## [3.3.0](https://github.com/recurly/recurly-client-ruby/tree/3.3.0) (2020-02-20)
|
61
|
+
|
26
62
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.2.2...3.3.0)
|
27
63
|
|
28
64
|
**Merged pull requests:**
|
@@ -33,6 +69,7 @@
|
|
33
69
|
- Latest v2019-10-10 Changes [\#552](https://github.com/recurly/recurly-client-ruby/pull/552) ([bhelx](https://github.com/bhelx))
|
34
70
|
|
35
71
|
## [3.2.2](https://github.com/recurly/recurly-client-ruby/tree/3.2.2) (2020-02-03)
|
72
|
+
|
36
73
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.2.1...3.2.2)
|
37
74
|
|
38
75
|
**Merged pull requests:**
|
@@ -41,6 +78,7 @@
|
|
41
78
|
- Loosen version restriction on faraday [\#549](https://github.com/recurly/recurly-client-ruby/pull/549) ([bhelx](https://github.com/bhelx))
|
42
79
|
|
43
80
|
## [3.2.1](https://github.com/recurly/recurly-client-ruby/tree/3.2.1) (2019-12-10)
|
81
|
+
|
44
82
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.2.0...3.2.1)
|
45
83
|
|
46
84
|
**Fixed bugs:**
|
@@ -48,6 +86,7 @@
|
|
48
86
|
- Convert Array params to CSV strings [\#545](https://github.com/recurly/recurly-client-ruby/pull/545) ([douglasmiller](https://github.com/douglasmiller))
|
49
87
|
|
50
88
|
## [3.2.0](https://github.com/recurly/recurly-client-ruby/tree/3.2.0) (2019-12-03)
|
89
|
+
|
51
90
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.1.3...3.2.0)
|
52
91
|
|
53
92
|
**Fixed bugs:**
|
@@ -61,6 +100,7 @@
|
|
61
100
|
- Allow object attributes through [\#542](https://github.com/recurly/recurly-client-ruby/pull/542) ([bhelx](https://github.com/bhelx))
|
62
101
|
|
63
102
|
## [3.1.3](https://github.com/recurly/recurly-client-ruby/tree/3.1.3) (2019-12-02)
|
103
|
+
|
64
104
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.1.2...3.1.3)
|
65
105
|
|
66
106
|
**Fixed bugs:**
|
@@ -69,6 +109,7 @@
|
|
69
109
|
- Issue 540 error may have transaction [\#541](https://github.com/recurly/recurly-client-ruby/pull/541) ([bhelx](https://github.com/bhelx))
|
70
110
|
|
71
111
|
## [3.1.2](https://github.com/recurly/recurly-client-ruby/tree/3.1.2) (2019-12-02)
|
112
|
+
|
72
113
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.1.1...3.1.2)
|
73
114
|
|
74
115
|
**Fixed bugs:**
|
@@ -76,6 +117,7 @@
|
|
76
117
|
- Skip request property type validation for nil values [\#539](https://github.com/recurly/recurly-client-ruby/pull/539) ([bhelx](https://github.com/bhelx))
|
77
118
|
|
78
119
|
## [3.1.1](https://github.com/recurly/recurly-client-ruby/tree/3.1.1) (2019-11-27)
|
120
|
+
|
79
121
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.1.0...3.1.1)
|
80
122
|
|
81
123
|
**Fixed bugs:**
|
@@ -84,6 +126,7 @@
|
|
84
126
|
- Disable searching ancestors when looking up constants [\#537](https://github.com/recurly/recurly-client-ruby/pull/537) ([douglasmiller](https://github.com/douglasmiller))
|
85
127
|
|
86
128
|
## [3.1.0](https://github.com/recurly/recurly-client-ruby/tree/3.1.0) (2019-11-18)
|
129
|
+
|
87
130
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.0.0...3.1.0)
|
88
131
|
|
89
132
|
**Merged pull requests:**
|
@@ -93,6 +136,7 @@
|
|
93
136
|
- Generated Updates for API version v2019-10-10 [\#528](https://github.com/recurly/recurly-client-ruby/pull/528) ([bhelx](https://github.com/bhelx))
|
94
137
|
|
95
138
|
## [3.0.0](https://github.com/recurly/recurly-client-ruby/tree/3.0.0) (2019-10-09)
|
139
|
+
|
96
140
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.0.0.beta.5...3.0.0)
|
97
141
|
|
98
142
|
**Merged pull requests:**
|
@@ -116,6 +160,7 @@
|
|
116
160
|
- Latest v2018-08-09 Changes [\#484](https://github.com/recurly/recurly-client-ruby/pull/484) ([bhelx](https://github.com/bhelx))
|
117
161
|
|
118
162
|
## [3.0.0.beta.5](https://github.com/recurly/recurly-client-ruby/tree/3.0.0.beta.5) (2019-06-28)
|
163
|
+
|
119
164
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.0.0.beta.4...3.0.0.beta.5)
|
120
165
|
|
121
166
|
**Merged pull requests:**
|
@@ -128,28 +173,20 @@
|
|
128
173
|
- Add strict mode for json deserializer [\#469](https://github.com/recurly/recurly-client-ruby/pull/469) ([bhelx](https://github.com/bhelx))
|
129
174
|
|
130
175
|
## [3.0.0.beta.4](https://github.com/recurly/recurly-client-ruby/tree/3.0.0.beta.4) (2019-04-04)
|
131
|
-
|
176
|
+
|
177
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.0.0.beta.1...3.0.0.beta.4)
|
132
178
|
|
133
179
|
**Merged pull requests:**
|
134
180
|
|
135
181
|
- V3 Update v2018-08-09 [\#460](https://github.com/recurly/recurly-client-ruby/pull/460) ([aaron-suarez](https://github.com/aaron-suarez))
|
136
182
|
- Small fixes for private beta [\#458](https://github.com/recurly/recurly-client-ruby/pull/458) ([bhelx](https://github.com/bhelx))
|
137
183
|
- Use Net-http-persistent for persistent connection [\#408](https://github.com/recurly/recurly-client-ruby/pull/408) ([bhelx](https://github.com/bhelx))
|
138
|
-
|
139
|
-
## [3.0.0.beta.3](https://github.com/recurly/recurly-client-ruby/tree/3.0.0.beta.3) (2018-08-27)
|
140
|
-
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.0.0.beta.2...3.0.0.beta.3)
|
141
|
-
|
142
|
-
**Merged pull requests:**
|
143
|
-
|
144
184
|
- Update to API 2018-06-06 [\#407](https://github.com/recurly/recurly-client-ruby/pull/407) ([bhelx](https://github.com/bhelx))
|
145
185
|
- Regenerating the client [\#406](https://github.com/recurly/recurly-client-ruby/pull/406) ([drewish](https://github.com/drewish))
|
146
186
|
- V3 Pager can error [\#401](https://github.com/recurly/recurly-client-ruby/pull/401) ([drewish](https://github.com/drewish))
|
147
187
|
- \[V3\] Test more versions of ruby [\#397](https://github.com/recurly/recurly-client-ruby/pull/397) ([drewish](https://github.com/drewish))
|
148
188
|
- Allow faraday 0.12 for compatibility with oauth2 gem [\#396](https://github.com/recurly/recurly-client-ruby/pull/396) ([drewish](https://github.com/drewish))
|
149
189
|
|
150
|
-
## [3.0.0.beta.2](https://github.com/recurly/recurly-client-ruby/tree/3.0.0.beta.2) (2018-07-17)
|
151
|
-
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/3.0.0.beta.1...3.0.0.beta.2)
|
152
|
-
|
153
190
|
|
154
191
|
|
155
|
-
\* *This
|
192
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This repository houses the official ruby client for Recurly's V3 API.
|
|
7
7
|
|
8
8
|
## Reference Documentation
|
9
9
|
|
10
|
-
Getting Started Guide and reference documentation can be found on [
|
10
|
+
Getting Started Guide and reference documentation can be found on [Github Pages](https://recurly.github.io/recurly-client-ruby/).
|
11
11
|
|
12
12
|
## Contributing
|
13
13
|
|
data/lib/recurly/client.rb
CHANGED
@@ -2,6 +2,7 @@ require "logger"
|
|
2
2
|
require "erb"
|
3
3
|
require "net/https"
|
4
4
|
require "base64"
|
5
|
+
require "securerandom"
|
5
6
|
require_relative "./schema/json_parser"
|
6
7
|
require_relative "./schema/file_parser"
|
7
8
|
|
@@ -18,6 +19,8 @@ module Recurly
|
|
18
19
|
JSON_CONTENT_TYPE = "application/json"
|
19
20
|
MAX_RETRIES = 3
|
20
21
|
|
22
|
+
BASE36_ALPHABET = ("0".."9").to_a + ("a".."z").to_a
|
23
|
+
|
21
24
|
# Initialize a client. It requires an API key.
|
22
25
|
#
|
23
26
|
# @example
|
@@ -53,18 +56,12 @@ module Recurly
|
|
53
56
|
yield(self) if block_given?
|
54
57
|
end
|
55
58
|
|
56
|
-
def next_page(pager)
|
57
|
-
path = extract_path(pager.next)
|
58
|
-
request = Net::HTTP::Get.new path
|
59
|
-
set_headers(request)
|
60
|
-
http_response = run_request(request)
|
61
|
-
handle_response! request, http_response
|
62
|
-
end
|
63
|
-
|
64
59
|
protected
|
65
60
|
|
61
|
+
# Used by the operations.rb file to interpolate paths
|
62
|
+
attr_reader :site_id
|
63
|
+
|
66
64
|
def pager(path, **options)
|
67
|
-
path = scope_by_site(path, **options)
|
68
65
|
Pager.new(
|
69
66
|
client: self,
|
70
67
|
path: path,
|
@@ -72,9 +69,15 @@ module Recurly
|
|
72
69
|
)
|
73
70
|
end
|
74
71
|
|
72
|
+
def head(path, **options)
|
73
|
+
request = Net::HTTP::Head.new build_url(path, options)
|
74
|
+
set_headers(request, options[:headers])
|
75
|
+
http_response = run_request(request, options)
|
76
|
+
handle_response! request, http_response
|
77
|
+
end
|
78
|
+
|
75
79
|
def get(path, **options)
|
76
|
-
|
77
|
-
request = Net::HTTP::Get.new path
|
80
|
+
request = Net::HTTP::Get.new build_url(path, options)
|
78
81
|
set_headers(request, options[:headers])
|
79
82
|
http_response = run_request(request, options)
|
80
83
|
handle_response! request, http_response
|
@@ -82,8 +85,7 @@ module Recurly
|
|
82
85
|
|
83
86
|
def post(path, request_data, request_class, **options)
|
84
87
|
request_class.new(request_data).validate!
|
85
|
-
|
86
|
-
request = Net::HTTP::Post.new path
|
88
|
+
request = Net::HTTP::Post.new build_url(path, options)
|
87
89
|
request.set_content_type(JSON_CONTENT_TYPE)
|
88
90
|
set_headers(request, options[:headers])
|
89
91
|
request.body = JSON.dump(request_data)
|
@@ -92,8 +94,7 @@ module Recurly
|
|
92
94
|
end
|
93
95
|
|
94
96
|
def put(path, request_data = nil, request_class = nil, **options)
|
95
|
-
|
96
|
-
request = Net::HTTP::Put.new path
|
97
|
+
request = Net::HTTP::Put.new build_url(path, options)
|
97
98
|
request.set_content_type(JSON_CONTENT_TYPE)
|
98
99
|
set_headers(request, options[:headers])
|
99
100
|
if request_data
|
@@ -107,18 +108,12 @@ module Recurly
|
|
107
108
|
end
|
108
109
|
|
109
110
|
def delete(path, **options)
|
110
|
-
|
111
|
-
request = Net::HTTP::Delete.new path
|
111
|
+
request = Net::HTTP::Delete.new build_url(path, options)
|
112
112
|
set_headers(request, options[:headers])
|
113
113
|
http_response = run_request(request, options)
|
114
114
|
handle_response! request, http_response
|
115
115
|
end
|
116
116
|
|
117
|
-
protected
|
118
|
-
|
119
|
-
# Used by the operations.rb file to interpolate paths
|
120
|
-
attr_reader :site_id
|
121
|
-
|
122
117
|
private
|
123
118
|
|
124
119
|
# @return [Logger]
|
@@ -139,7 +134,15 @@ module Recurly
|
|
139
134
|
|
140
135
|
begin
|
141
136
|
http.start unless http.started?
|
142
|
-
http.request(request)
|
137
|
+
response = http.request(request)
|
138
|
+
|
139
|
+
# GETs are safe to retry after a server error, requests with an Idempotency-Key will return the prior response
|
140
|
+
if response.kind_of?(Net::HTTPServerError) && request.is_a?(Net::HTTP::Get)
|
141
|
+
retries += 1
|
142
|
+
response = http.request(request) if retries < MAX_RETRIES
|
143
|
+
end
|
144
|
+
|
145
|
+
response
|
143
146
|
rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::ECONNABORTED,
|
144
147
|
Errno::EPIPE, Errno::ETIMEDOUT, Net::OpenTimeout, EOFError, SocketError => ex
|
145
148
|
retries += 1
|
@@ -167,10 +170,23 @@ module Recurly
|
|
167
170
|
request["Authorization"] = "Basic #{Base64.encode64(@api_key)}".chomp
|
168
171
|
request["User-Agent"] = "Recurly/#{VERSION}; #{RUBY_DESCRIPTION}"
|
169
172
|
|
173
|
+
unless request.is_a?(Net::HTTP::Get) || request.is_a?(Net::HTTP::Head)
|
174
|
+
request["Idempotency-Key"] ||= generate_idempotency_key
|
175
|
+
end
|
176
|
+
|
170
177
|
# TODO this is undocumented until we finalize it
|
171
178
|
additional_headers.each { |header, v| request[header] = v } if additional_headers
|
172
179
|
end
|
173
180
|
|
181
|
+
# from https://github.com/rails/rails/blob/6-0-stable/activesupport/lib/active_support/core_ext/securerandom.rb
|
182
|
+
def generate_idempotency_key(n = 16)
|
183
|
+
SecureRandom.random_bytes(n).unpack("C*").map do |byte|
|
184
|
+
idx = byte % 64
|
185
|
+
idx = SecureRandom.random_number(36) if idx >= 36
|
186
|
+
BASE36_ALPHABET[idx]
|
187
|
+
end.join
|
188
|
+
end
|
189
|
+
|
174
190
|
def set_http_options(http, options)
|
175
191
|
http.open_timeout = options[:open_timeout] || 20
|
176
192
|
http.read_timeout = options[:read_timeout] || 60
|
@@ -251,18 +267,23 @@ module Recurly
|
|
251
267
|
@api_key = api_key
|
252
268
|
end
|
253
269
|
|
254
|
-
def
|
255
|
-
|
256
|
-
|
270
|
+
def build_url(path, options)
|
271
|
+
path = scope_by_site(path, options)
|
272
|
+
if options.any?
|
273
|
+
"#{path}?#{URI.encode_www_form(options)}"
|
257
274
|
else
|
258
275
|
path
|
259
276
|
end
|
260
277
|
end
|
261
278
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
279
|
+
def scope_by_site(path, **options)
|
280
|
+
if site = site_id || options[:site_id]
|
281
|
+
# Ensure that we are only including the site_id once because the Pager operations
|
282
|
+
# will use the cursor returned from the API which may already have these components
|
283
|
+
path.start_with?("/sites/#{site}") ? path : "/sites/#{site}#{path}"
|
284
|
+
else
|
285
|
+
path
|
286
|
+
end
|
266
287
|
end
|
267
288
|
|
268
289
|
def set_options(options)
|
@@ -1235,6 +1235,18 @@ module Recurly
|
|
1235
1235
|
put(path, body, Requests::CouponUpdate, **options)
|
1236
1236
|
end
|
1237
1237
|
|
1238
|
+
# Expire a coupon
|
1239
|
+
#
|
1240
|
+
# {https://developers.recurly.com/api/v2019-10-10#operation/deactivate_coupon deactivate_coupon api documenation}
|
1241
|
+
#
|
1242
|
+
# @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
|
+
# @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+.
|
1244
|
+
# @return [Resources::Coupon] The expired Coupon
|
1245
|
+
def deactivate_coupon(coupon_id:, **options)
|
1246
|
+
path = interpolate_path("/coupons/{coupon_id}", coupon_id: coupon_id)
|
1247
|
+
delete(path, **options)
|
1248
|
+
end
|
1249
|
+
|
1238
1250
|
# List unique coupon codes associated with a bulk coupon
|
1239
1251
|
#
|
1240
1252
|
# {https://developers.recurly.com/api/v2019-10-10#operation/list_unique_coupon_codes list_unique_coupon_codes api documenation}
|
data/lib/recurly/http.rb
CHANGED
@@ -4,7 +4,7 @@ module Recurly
|
|
4
4
|
attr_accessor :status, :body, :request,
|
5
5
|
:request_id, :rate_limit, :rate_limit_remaining,
|
6
6
|
:rate_limit_reset, :date, :proxy_metadata,
|
7
|
-
:content_type
|
7
|
+
:content_type, :total_records
|
8
8
|
|
9
9
|
def initialize(resp, request)
|
10
10
|
@request = Request.new(request.method, request.path, request.body)
|
@@ -13,6 +13,7 @@ module Recurly
|
|
13
13
|
@rate_limit = resp["x-ratelimit-limit"].to_i
|
14
14
|
@rate_limit_remaining = resp["x-ratelimit-remaining"].to_i
|
15
15
|
@rate_limit_reset = Time.at(resp["x-ratelimit-reset"].to_i).to_datetime
|
16
|
+
@total_records = resp["recurly-total-records"]&.to_i
|
16
17
|
if resp["content-type"]
|
17
18
|
@content_type = resp["content-type"].split(";").first
|
18
19
|
else
|
data/lib/recurly/pager.rb
CHANGED
@@ -7,7 +7,25 @@ module Recurly
|
|
7
7
|
@client = client
|
8
8
|
@path = path
|
9
9
|
@options = map_array_params(options)
|
10
|
-
|
10
|
+
rewind!
|
11
|
+
end
|
12
|
+
|
13
|
+
# Performs a request with the pager `limit` set to 1 and only returns the first
|
14
|
+
# result in the response.
|
15
|
+
def first
|
16
|
+
# Modify the @next url to set the :limit to 1
|
17
|
+
original_next = @next
|
18
|
+
@next = @path
|
19
|
+
fetch_next!(@options.merge(limit: 1))
|
20
|
+
# Restore the @next url to the original
|
21
|
+
@next = original_next
|
22
|
+
@data.first
|
23
|
+
end
|
24
|
+
|
25
|
+
# Makes a HEAD request to the API to determine how many total records exist.
|
26
|
+
def count
|
27
|
+
resource = @client.send(:head, self.next, @options)
|
28
|
+
resource.get_response.total_records
|
11
29
|
end
|
12
30
|
|
13
31
|
# Enumerates each "page" from the server.
|
@@ -84,7 +102,9 @@ module Recurly
|
|
84
102
|
def page_enumerator
|
85
103
|
Enumerator.new do |yielder|
|
86
104
|
loop do
|
87
|
-
|
105
|
+
# Pass in @options when requesting the first page (@data.empty?)
|
106
|
+
next_options = @data.empty? ? @options : {}
|
107
|
+
fetch_next!(next_options)
|
88
108
|
yielder << data
|
89
109
|
unless has_more?
|
90
110
|
rewind!
|
@@ -94,8 +114,9 @@ module Recurly
|
|
94
114
|
end
|
95
115
|
end
|
96
116
|
|
97
|
-
def fetch_next!
|
98
|
-
|
117
|
+
def fetch_next!(options)
|
118
|
+
path = extract_path(self.next)
|
119
|
+
page = @client.send(:get, path, options)
|
99
120
|
@data = page.data.map { |d| JSONParser.from_json(d) }
|
100
121
|
@has_more = page.has_more
|
101
122
|
@next = page.next
|
@@ -103,15 +124,13 @@ module Recurly
|
|
103
124
|
|
104
125
|
def rewind!
|
105
126
|
@data = []
|
106
|
-
@next =
|
127
|
+
@next = @path
|
107
128
|
end
|
108
129
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
"#{path}?#{URI.encode_www_form(options)}"
|
114
|
-
end
|
130
|
+
# Returns just the path and parameters so we can safely reuse the connection
|
131
|
+
def extract_path(uri_or_path)
|
132
|
+
uri = URI(uri_or_path)
|
133
|
+
uri.kind_of?(URI::HTTP) ? uri.request_uri : uri_or_path
|
115
134
|
end
|
116
135
|
|
117
136
|
# Converts array parameters to CSV strings to maintain consistency with
|
@@ -121,7 +140,7 @@ module Recurly
|
|
121
140
|
@options = params.map do |key, param|
|
122
141
|
new_param = param.is_a?(Array) ? param.join(",") : param
|
123
142
|
[key, new_param]
|
124
|
-
end
|
143
|
+
end.to_h
|
125
144
|
end
|
126
145
|
end
|
127
146
|
end
|
@@ -15,7 +15,7 @@ module Recurly
|
|
15
15
|
define_attribute :code, String
|
16
16
|
|
17
17
|
# @!attribute currencies
|
18
|
-
# @return [Array[AddOnPricing]] If `item_code`/`item_id` is part of the request and the item has a default currency then `currencies` is optional. If the item does not have a default currency, then `currencies` is required. If `item_code`/`item_id` is not present `currencies` is required.
|
18
|
+
# @return [Array[AddOnPricing]] * If `item_code`/`item_id` is part of the request and the item has a default currency then `currencies` is optional. If the item does not have a default currency, then `currencies` is required. If `item_code`/`item_id` is not present `currencies` is required. * If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `currencies` must be absent.
|
19
19
|
define_attribute :currencies, Array, { :item_type => :AddOnPricing }
|
20
20
|
|
21
21
|
# @!attribute default_quantity
|
@@ -38,6 +38,10 @@ module Recurly
|
|
38
38
|
# @return [String] Describes your add-on and will appear in subscribers' invoices. If `item_code`/`item_id` is part of the request then `name` must be absent. If `item_code`/`item_id` is not present `name` is required.
|
39
39
|
define_attribute :name, String
|
40
40
|
|
41
|
+
# @!attribute optional
|
42
|
+
# @return [Boolean] Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API.
|
43
|
+
define_attribute :optional, :Boolean
|
44
|
+
|
41
45
|
# @!attribute plan_id
|
42
46
|
# @return [String] Plan ID
|
43
47
|
define_attribute :plan_id, String
|
@@ -49,6 +53,14 @@ module Recurly
|
|
49
53
|
# @!attribute tax_code
|
50
54
|
# @return [String] Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If `item_code`/`item_id` is part of the request then `tax_code` must be absent.
|
51
55
|
define_attribute :tax_code, String
|
56
|
+
|
57
|
+
# @!attribute tier_type
|
58
|
+
# @return [String] The type of tiering used by the Add-on.
|
59
|
+
define_attribute :tier_type, String
|
60
|
+
|
61
|
+
# @!attribute tiers
|
62
|
+
# @return [Array[Tier]] At least one tier is required if `tier_type` is not 'flat'.
|
63
|
+
define_attribute :tiers, Array, { :item_type => :Tier }
|
52
64
|
end
|
53
65
|
end
|
54
66
|
end
|
@@ -15,7 +15,7 @@ module Recurly
|
|
15
15
|
define_attribute :code, String
|
16
16
|
|
17
17
|
# @!attribute currencies
|
18
|
-
# @return [Array[AddOnPricing]]
|
18
|
+
# @return [Array[AddOnPricing]] If the add-on's `tier_type` is `tiered`, `volume` or `stairstep`, then `currencies` must be absent.
|
19
19
|
define_attribute :currencies, Array, { :item_type => :AddOnPricing }
|
20
20
|
|
21
21
|
# @!attribute default_quantity
|
@@ -34,6 +34,10 @@ module Recurly
|
|
34
34
|
# @return [String] Describes your add-on and will appear in subscribers' invoices. If an `Item` is associated to the `AddOn` then `name` must be absent.
|
35
35
|
define_attribute :name, String
|
36
36
|
|
37
|
+
# @!attribute optional
|
38
|
+
# @return [Boolean] Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API.
|
39
|
+
define_attribute :optional, :Boolean
|
40
|
+
|
37
41
|
# @!attribute revenue_schedule_type
|
38
42
|
# @return [String] When this add-on is invoiced, the line item will use this revenue schedule. If an `Item` is associated to the `AddOn` then `revenue_schedule_type` must be absent in the request as the value will be set from the item.
|
39
43
|
define_attribute :revenue_schedule_type, String
|
@@ -41,6 +45,10 @@ module Recurly
|
|
41
45
|
# @!attribute tax_code
|
42
46
|
# @return [String] Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If an `Item` is associated to the `AddOn` then `tax code` must be absent.
|
43
47
|
define_attribute :tax_code, String
|
48
|
+
|
49
|
+
# @!attribute tiers
|
50
|
+
# @return [Array[Tier]] If tiers are provided in the request, all existing tiers on the Add-on will be removed and replaced by the tiers in the request.
|
51
|
+
define_attribute :tiers, Array, { :item_type => :Tier }
|
44
52
|
end
|
45
53
|
end
|
46
54
|
end
|
@@ -6,6 +6,14 @@ module Recurly
|
|
6
6
|
module Requests
|
7
7
|
class BillingInfoCreate < Request
|
8
8
|
|
9
|
+
# @!attribute account_number
|
10
|
+
# @return [String] The bank account number. (ACH only)
|
11
|
+
define_attribute :account_number, String
|
12
|
+
|
13
|
+
# @!attribute account_type
|
14
|
+
# @return [String] The bank account type. (ACH only)
|
15
|
+
define_attribute :account_type, String
|
16
|
+
|
9
17
|
# @!attribute address
|
10
18
|
# @return [Address]
|
11
19
|
define_attribute :address, :Address
|
@@ -39,7 +47,7 @@ module Recurly
|
|
39
47
|
define_attribute :gateway_token, String
|
40
48
|
|
41
49
|
# @!attribute iban
|
42
|
-
# @return [String] The International Bank Account Number, up to 34 alphanumeric characters comprising a country code; two check digits; and a number that includes the domestic bank account number, branch identifier, and potential routing information
|
50
|
+
# @return [String] The International Bank Account Number, up to 34 alphanumeric characters comprising a country code; two check digits; and a number that includes the domestic bank account number, branch identifier, and potential routing information. (SEPA only)
|
43
51
|
define_attribute :iban, String
|
44
52
|
|
45
53
|
# @!attribute ip_address
|
@@ -54,6 +62,10 @@ module Recurly
|
|
54
62
|
# @return [String] Expiration month
|
55
63
|
define_attribute :month, String
|
56
64
|
|
65
|
+
# @!attribute name_on_account
|
66
|
+
# @return [String] The name associated with the bank account.
|
67
|
+
define_attribute :name_on_account, String
|
68
|
+
|
57
69
|
# @!attribute number
|
58
70
|
# @return [String] Credit card number, spaces and dashes are accepted.
|
59
71
|
define_attribute :number, String
|
@@ -62,6 +74,10 @@ module Recurly
|
|
62
74
|
# @return [String] PayPal billing agreement ID
|
63
75
|
define_attribute :paypal_billing_agreement_id, String
|
64
76
|
|
77
|
+
# @!attribute routing_number
|
78
|
+
# @return [String] The bank's rounting number. (ACH only)
|
79
|
+
define_attribute :routing_number, String
|
80
|
+
|
65
81
|
# @!attribute three_d_secure_action_result_token_id
|
66
82
|
# @return [String] A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge.
|
67
83
|
define_attribute :three_d_secure_action_result_token_id, String
|
@@ -18,8 +18,12 @@ module Recurly
|
|
18
18
|
# @return [String] Revenue schedule type
|
19
19
|
define_attribute :revenue_schedule_type, String
|
20
20
|
|
21
|
+
# @!attribute tiers
|
22
|
+
# @return [Array[SubscriptionAddOnTier]] If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent.
|
23
|
+
define_attribute :tiers, Array, { :item_type => :SubscriptionAddOnTier }
|
24
|
+
|
21
25
|
# @!attribute unit_amount
|
22
|
-
# @return [Float] Optionally, override the add-on's default unit amount.
|
26
|
+
# @return [Float] * Optionally, override the add-on's default unit amount. * If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` must be absent.
|
23
27
|
define_attribute :unit_amount, Float
|
24
28
|
end
|
25
29
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file is automatically created by Recurly's OpenAPI generation process
|
2
|
+
# and thus any edits you make by hand will be lost. If you wish to make a
|
3
|
+
# change to this file, please create a Github issue explaining the changes you
|
4
|
+
# need and we will usher them to the appropriate places.
|
5
|
+
module Recurly
|
6
|
+
module Requests
|
7
|
+
class SubscriptionAddOnTier < Request
|
8
|
+
|
9
|
+
# @!attribute ending_quantity
|
10
|
+
# @return [Integer] Ending quantity
|
11
|
+
define_attribute :ending_quantity, Integer
|
12
|
+
|
13
|
+
# @!attribute unit_amount
|
14
|
+
# @return [Float] Unit amount
|
15
|
+
define_attribute :unit_amount, Float
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -22,6 +22,10 @@ module Recurly
|
|
22
22
|
# @return [String] Revenue schedule type
|
23
23
|
define_attribute :revenue_schedule_type, String
|
24
24
|
|
25
|
+
# @!attribute tiers
|
26
|
+
# @return [Array[SubscriptionAddOnTier]] If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent.
|
27
|
+
define_attribute :tiers, Array, { :item_type => :SubscriptionAddOnTier }
|
28
|
+
|
25
29
|
# @!attribute unit_amount
|
26
30
|
# @return [Float] Optionally, override the add-on's default unit amount.
|
27
31
|
define_attribute :unit_amount, Float
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file is automatically created by Recurly's OpenAPI generation process
|
2
|
+
# and thus any edits you make by hand will be lost. If you wish to make a
|
3
|
+
# change to this file, please create a Github issue explaining the changes you
|
4
|
+
# need and we will usher them to the appropriate places.
|
5
|
+
module Recurly
|
6
|
+
module Requests
|
7
|
+
class Tier < Request
|
8
|
+
|
9
|
+
# @!attribute currencies
|
10
|
+
# @return [Array[Pricing]] Tier pricing
|
11
|
+
define_attribute :currencies, Array, { :item_type => :Pricing }
|
12
|
+
|
13
|
+
# @!attribute ending_quantity
|
14
|
+
# @return [Integer] Ending quantity
|
15
|
+
define_attribute :ending_quantity, Integer
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -74,6 +74,14 @@ module Recurly
|
|
74
74
|
# @return [String] Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`.
|
75
75
|
define_attribute :tax_code, String
|
76
76
|
|
77
|
+
# @!attribute tier_type
|
78
|
+
# @return [String] The type of tiering used by the Add-on.
|
79
|
+
define_attribute :tier_type, String
|
80
|
+
|
81
|
+
# @!attribute tiers
|
82
|
+
# @return [Array[Tier]] Tiers
|
83
|
+
define_attribute :tiers, Array, { :item_type => :Tier }
|
84
|
+
|
77
85
|
# @!attribute updated_at
|
78
86
|
# @return [DateTime] Last updated at
|
79
87
|
define_attribute :updated_at, DateTime
|
@@ -34,6 +34,14 @@ module Recurly
|
|
34
34
|
# @return [String] Subscription ID
|
35
35
|
define_attribute :subscription_id, String
|
36
36
|
|
37
|
+
# @!attribute tier_type
|
38
|
+
# @return [String] The type of tiering used by the Add-on.
|
39
|
+
define_attribute :tier_type, String
|
40
|
+
|
41
|
+
# @!attribute tiers
|
42
|
+
# @return [Array[SubscriptionAddOnTier]] Empty unless `tier_type` is `tiered`, `volume`, or `stairstep`.
|
43
|
+
define_attribute :tiers, Array, { :item_type => :SubscriptionAddOnTier }
|
44
|
+
|
37
45
|
# @!attribute unit_amount
|
38
46
|
# @return [Float] This is priced in the subscription's currency.
|
39
47
|
define_attribute :unit_amount, Float
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file is automatically created by Recurly's OpenAPI generation process
|
2
|
+
# and thus any edits you make by hand will be lost. If you wish to make a
|
3
|
+
# change to this file, please create a Github issue explaining the changes you
|
4
|
+
# need and we will usher them to the appropriate places.
|
5
|
+
module Recurly
|
6
|
+
module Resources
|
7
|
+
class SubscriptionAddOnTier < Resource
|
8
|
+
|
9
|
+
# @!attribute ending_quantity
|
10
|
+
# @return [Integer] Ending quantity
|
11
|
+
define_attribute :ending_quantity, Integer
|
12
|
+
|
13
|
+
# @!attribute unit_amount
|
14
|
+
# @return [Float] Unit amount
|
15
|
+
define_attribute :unit_amount, Float
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file is automatically created by Recurly's OpenAPI generation process
|
2
|
+
# and thus any edits you make by hand will be lost. If you wish to make a
|
3
|
+
# change to this file, please create a Github issue explaining the changes you
|
4
|
+
# need and we will usher them to the appropriate places.
|
5
|
+
module Recurly
|
6
|
+
module Resources
|
7
|
+
class Tier < Resource
|
8
|
+
|
9
|
+
# @!attribute currencies
|
10
|
+
# @return [Array[Pricing]] Tier pricing
|
11
|
+
define_attribute :currencies, Array, { :item_type => :Pricing }
|
12
|
+
|
13
|
+
# @!attribute ending_quantity
|
14
|
+
# @return [Integer] Ending quantity
|
15
|
+
define_attribute :ending_quantity, Integer
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/recurly/version.rb
CHANGED
data/openapi/api.yaml
CHANGED
@@ -3998,6 +3998,11 @@ paths:
|
|
3998
3998
|
foreach($account_subscriptions as $sub) {
|
3999
3999
|
echo 'Account subscription: ' . $sub->getUuid() . PHP_EOL;
|
4000
4000
|
}
|
4001
|
+
- lang: Python
|
4002
|
+
source: |
|
4003
|
+
subscriptions = client.list_account_subscriptions(account.id, limit=200).items()
|
4004
|
+
for subscription in subscriptions:
|
4005
|
+
print(subscription.uuid)
|
4001
4006
|
"/sites/{site_id}/accounts/{account_id}/transactions":
|
4002
4007
|
get:
|
4003
4008
|
tags:
|
@@ -4582,6 +4587,35 @@ paths:
|
|
4582
4587
|
// probably re-raise and let our web framework and logger handle it
|
4583
4588
|
var_dump($e);
|
4584
4589
|
}
|
4590
|
+
delete:
|
4591
|
+
tags:
|
4592
|
+
- coupon
|
4593
|
+
operationId: deactivate_coupon
|
4594
|
+
summary: Expire a coupon
|
4595
|
+
parameters:
|
4596
|
+
- "$ref": "#/components/parameters/site_id"
|
4597
|
+
- "$ref": "#/components/parameters/coupon_id"
|
4598
|
+
description: Mark an existing Coupon as expired
|
4599
|
+
responses:
|
4600
|
+
'200':
|
4601
|
+
description: The expired Coupon
|
4602
|
+
content:
|
4603
|
+
application/json:
|
4604
|
+
schema:
|
4605
|
+
"$ref": "#/components/schemas/Coupon"
|
4606
|
+
'404':
|
4607
|
+
description: Incorrect site or coupon ID.
|
4608
|
+
content:
|
4609
|
+
application/json:
|
4610
|
+
schema:
|
4611
|
+
"$ref": "#/components/schemas/Error"
|
4612
|
+
default:
|
4613
|
+
description: Unexpected error.
|
4614
|
+
content:
|
4615
|
+
application/json:
|
4616
|
+
schema:
|
4617
|
+
"$ref": "#/components/schemas/Error"
|
4618
|
+
x-code-samples: []
|
4585
4619
|
"/sites/{site_id}/coupons/{coupon_id}/generate":
|
4586
4620
|
post:
|
4587
4621
|
tags:
|
@@ -12168,6 +12202,21 @@ components:
|
|
12168
12202
|
item:
|
12169
12203
|
"$ref": "#/components/schemas/ItemMini"
|
12170
12204
|
readOnly: true
|
12205
|
+
tier_type:
|
12206
|
+
type: string
|
12207
|
+
title: Tier type
|
12208
|
+
description: The type of tiering used by the Add-on.
|
12209
|
+
default: flat
|
12210
|
+
enum:
|
12211
|
+
- flat
|
12212
|
+
- tiered
|
12213
|
+
- stairstep
|
12214
|
+
- volume
|
12215
|
+
tiers:
|
12216
|
+
type: array
|
12217
|
+
title: Tiers
|
12218
|
+
items:
|
12219
|
+
"$ref": "#/components/schemas/Tier"
|
12171
12220
|
external_sku:
|
12172
12221
|
type: string
|
12173
12222
|
title: External SKU
|
@@ -12263,6 +12312,14 @@ components:
|
|
12263
12312
|
title: Default quantity
|
12264
12313
|
description: Default quantity for the hosted pages.
|
12265
12314
|
default: 1
|
12315
|
+
optional:
|
12316
|
+
type: boolean
|
12317
|
+
title: Optional
|
12318
|
+
description: Whether the add-on is optional for the customer to include
|
12319
|
+
in their purchase on the hosted payment page. If false, the add-on will
|
12320
|
+
be included when a subscription is created through the Recurly UI. However,
|
12321
|
+
the add-on will not be included when a subscription is created through
|
12322
|
+
the API.
|
12266
12323
|
tax_code:
|
12267
12324
|
type: string
|
12268
12325
|
title: Tax code
|
@@ -12279,10 +12336,29 @@ components:
|
|
12279
12336
|
items:
|
12280
12337
|
"$ref": "#/components/schemas/AddOnPricing"
|
12281
12338
|
minItems: 1
|
12282
|
-
description:
|
12339
|
+
description: |
|
12340
|
+
* If `item_code`/`item_id` is part of the request and the item
|
12283
12341
|
has a default currency then `currencies` is optional. If the item does
|
12284
12342
|
not have a default currency, then `currencies` is required. If `item_code`/`item_id`
|
12285
12343
|
is not present `currencies` is required.
|
12344
|
+
* If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`,
|
12345
|
+
then `currencies` must be absent.
|
12346
|
+
tier_type:
|
12347
|
+
type: string
|
12348
|
+
title: Tier type
|
12349
|
+
description: The type of tiering used by the Add-on.
|
12350
|
+
default: flat
|
12351
|
+
enum:
|
12352
|
+
- flat
|
12353
|
+
- tiered
|
12354
|
+
- stairstep
|
12355
|
+
- volume
|
12356
|
+
tiers:
|
12357
|
+
type: array
|
12358
|
+
title: Tiers
|
12359
|
+
items:
|
12360
|
+
"$ref": "#/components/schemas/Tier"
|
12361
|
+
description: At least one tier is required if `tier_type` is not 'flat'.
|
12286
12362
|
required:
|
12287
12363
|
- code
|
12288
12364
|
- name
|
@@ -12349,12 +12425,31 @@ components:
|
|
12349
12425
|
title: Default quantity
|
12350
12426
|
description: Default quantity for the hosted pages.
|
12351
12427
|
default: 1
|
12428
|
+
optional:
|
12429
|
+
type: boolean
|
12430
|
+
title: Optional
|
12431
|
+
description: Whether the add-on is optional for the customer to include
|
12432
|
+
in their purchase on the hosted payment page. If false, the add-on will
|
12433
|
+
be included when a subscription is created through the Recurly UI. However,
|
12434
|
+
the add-on will not be included when a subscription is created through
|
12435
|
+
the API.
|
12352
12436
|
currencies:
|
12353
12437
|
type: array
|
12354
12438
|
title: Add-on pricing
|
12355
12439
|
items:
|
12356
12440
|
"$ref": "#/components/schemas/AddOnPricing"
|
12357
12441
|
minItems: 1
|
12442
|
+
description: |
|
12443
|
+
If the add-on's `tier_type` is `tiered`, `volume` or `stairstep`,
|
12444
|
+
then `currencies` must be absent.
|
12445
|
+
tiers:
|
12446
|
+
type: array
|
12447
|
+
title: Tiers
|
12448
|
+
items:
|
12449
|
+
"$ref": "#/components/schemas/Tier"
|
12450
|
+
description: |
|
12451
|
+
If tiers are provided in the request, all existing tiers on the Add-on will be
|
12452
|
+
removed and replaced by the tiers in the request.
|
12358
12453
|
BillingInfo:
|
12359
12454
|
type: object
|
12360
12455
|
properties:
|
@@ -12519,11 +12614,29 @@ components:
|
|
12519
12614
|
maxLength: 22
|
12520
12615
|
iban:
|
12521
12616
|
type: string
|
12522
|
-
|
12617
|
+
maxLength: 34
|
12523
12618
|
description: The International Bank Account Number, up to 34 alphanumeric
|
12524
12619
|
characters comprising a country code; two check digits; and a number that
|
12525
12620
|
includes the domestic bank account number, branch identifier, and potential
|
12526
|
-
routing information
|
12621
|
+
routing information. (SEPA only)
|
12622
|
+
name_on_account:
|
12623
|
+
type: string
|
12624
|
+
maxLength: 255
|
12625
|
+
description: The name associated with the bank account.
|
12626
|
+
account_number:
|
12627
|
+
type: string
|
12628
|
+
maxLength: 255
|
12629
|
+
description: The bank account number. (ACH only)
|
12630
|
+
routing_number:
|
12631
|
+
type: string
|
12632
|
+
maxLength: 15
|
12633
|
+
description: The bank's rounting number. (ACH only)
|
12634
|
+
account_type:
|
12635
|
+
type: string
|
12636
|
+
enum:
|
12637
|
+
- checking
|
12638
|
+
- savings
|
12639
|
+
description: The bank account type. (ACH only)
|
12527
12640
|
Coupon:
|
12528
12641
|
type: object
|
12529
12642
|
properties:
|
@@ -14885,6 +14998,23 @@ components:
|
|
14885
14998
|
required:
|
14886
14999
|
- currency
|
14887
15000
|
- unit_amount
|
15001
|
+
Tier:
|
15002
|
+
type: object
|
15003
|
+
properties:
|
15004
|
+
ending_quantity:
|
15005
|
+
type: integer
|
15006
|
+
title: Ending quantity
|
15007
|
+
minimum: 1
|
15008
|
+
maximum: 999999999
|
15009
|
+
default: 999999999
|
15010
|
+
currencies:
|
15011
|
+
type: array
|
15012
|
+
title: Tier pricing
|
15013
|
+
items:
|
15014
|
+
"$ref": "#/components/schemas/Pricing"
|
15015
|
+
minItems: 1
|
15016
|
+
required:
|
15017
|
+
- currencies
|
14888
15018
|
Settings:
|
14889
15019
|
type: object
|
14890
15020
|
properties:
|
@@ -15486,6 +15616,23 @@ components:
|
|
15486
15616
|
format: float
|
15487
15617
|
title: Add-on unit price
|
15488
15618
|
description: This is priced in the subscription's currency.
|
15619
|
+
tier_type:
|
15620
|
+
type: string
|
15621
|
+
title: Tier type
|
15622
|
+
description: The type of tiering used by the Add-on.
|
15623
|
+
default: flat
|
15624
|
+
enum:
|
15625
|
+
- flat
|
15626
|
+
- tiered
|
15627
|
+
- stairstep
|
15628
|
+
- volume
|
15629
|
+
tiers:
|
15630
|
+
type: array
|
15631
|
+
title: Tiers
|
15632
|
+
items:
|
15633
|
+
"$ref": "#/components/schemas/SubscriptionAddOnTier"
|
15634
|
+
minItems: 1
|
15635
|
+
description: Empty unless `tier_type` is `tiered`, `volume`, or `stairstep`.
|
15489
15636
|
created_at:
|
15490
15637
|
type: string
|
15491
15638
|
format: date-time
|
@@ -15514,8 +15661,18 @@ components:
|
|
15514
15661
|
type: number
|
15515
15662
|
format: float
|
15516
15663
|
title: Unit amount
|
15517
|
-
description:
|
15664
|
+
description: |
|
15665
|
+
* Optionally, override the add-on's default unit amount.
|
15666
|
+
* If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` must be absent.
|
15518
15667
|
minimum: 0
|
15668
|
+
tiers:
|
15669
|
+
type: array
|
15670
|
+
title: Tiers
|
15671
|
+
items:
|
15672
|
+
"$ref": "#/components/schemas/SubscriptionAddOnTier"
|
15673
|
+
minItems: 1
|
15674
|
+
description: If the plan add-on's `tier_type` is `flat`, then `tiers` must
|
15675
|
+
be absent.
|
15519
15676
|
revenue_schedule_type:
|
15520
15677
|
type: string
|
15521
15678
|
title: Revenue schedule type
|
@@ -15548,6 +15705,14 @@ components:
|
|
15548
15705
|
title: Unit amount
|
15549
15706
|
description: Optionally, override the add-on's default unit amount.
|
15550
15707
|
minimum: 0
|
15708
|
+
tiers:
|
15709
|
+
type: array
|
15710
|
+
title: Tiers
|
15711
|
+
items:
|
15712
|
+
"$ref": "#/components/schemas/SubscriptionAddOnTier"
|
15713
|
+
minItems: 1
|
15714
|
+
description: If the plan add-on's `tier_type` is `flat`, then `tiers` must
|
15715
|
+
be absent.
|
15551
15716
|
revenue_schedule_type:
|
15552
15717
|
type: string
|
15553
15718
|
title: Revenue schedule type
|
@@ -15556,6 +15721,20 @@ components:
|
|
15556
15721
|
- evenly
|
15557
15722
|
- at_range_end
|
15558
15723
|
- at_range_start
|
15724
|
+
SubscriptionAddOnTier:
|
15725
|
+
type: object
|
15726
|
+
properties:
|
15727
|
+
ending_quantity:
|
15728
|
+
type: integer
|
15729
|
+
title: Ending quantity
|
15730
|
+
minimum: 1
|
15731
|
+
maximum: 999999999
|
15732
|
+
default: 999999999
|
15733
|
+
unit_amount:
|
15734
|
+
type: number
|
15735
|
+
format: float
|
15736
|
+
title: Unit amount
|
15737
|
+
minimum: 0
|
15559
15738
|
SubscriptionCancel:
|
15560
15739
|
type: object
|
15561
15740
|
properties:
|
@@ -16674,6 +16853,7 @@ components:
|
|
16674
16853
|
- Maestro
|
16675
16854
|
- MasterCard
|
16676
16855
|
- Test Card
|
16856
|
+
- Union Pay
|
16677
16857
|
- Unknown
|
16678
16858
|
- Visa
|
16679
16859
|
first_six:
|
data/recurly.gemspec
CHANGED
@@ -14,6 +14,14 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/recurly/recurly-client-ruby"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
+
spec.metadata = {
|
18
|
+
"bug_tracker_uri" => "#{spec.homepage}/issues",
|
19
|
+
"changelog_uri" => "#{spec.homepage}/blob/master/CHANGELOG.md",
|
20
|
+
"documentation_uri" => "https://dev.recurly.com/docs",
|
21
|
+
"homepage_uri" => spec.homepage,
|
22
|
+
"source_code_uri" => "#{spec.homepage}/tree/#{spec.version}",
|
23
|
+
}
|
24
|
+
|
17
25
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
26
|
f.match(%r{^(test|spec|features)/})
|
19
27
|
end
|
data/scripts/changelog
CHANGED
@@ -6,6 +6,8 @@ if [ -z "$GITHUB_TOKEN" ]; then
|
|
6
6
|
else
|
7
7
|
if [ "$1" == "--pending" ]; then
|
8
8
|
github_changelog_generator -t $GITHUB_TOKEN --unreleased-only -o "$2"
|
9
|
+
elif [ "$1" == "--release-tag" ]; then
|
10
|
+
github_changelog_generator -t $GITHUB_TOKEN --unreleased true --unreleased-label "$2"
|
9
11
|
else
|
10
12
|
github_changelog_generator -t $GITHUB_TOKEN
|
11
13
|
fi
|
data/scripts/release
CHANGED
@@ -5,8 +5,8 @@ set -e
|
|
5
5
|
RELEASED_LOG="/tmp/ruby-pending-changes.md"
|
6
6
|
THIS_VERSION=$(./scripts/bump --this-version)
|
7
7
|
|
8
|
-
#
|
9
|
-
./scripts/changelog
|
8
|
+
# Generate the changelog with changes in this release
|
9
|
+
./scripts/changelog --release-tag "$THIS_VERSION"
|
10
10
|
git add CHANGELOG.md
|
11
11
|
git commit -m "Update Changelog for Release $THIS_VERSION"
|
12
12
|
git push origin master
|
@@ -27,4 +27,6 @@ echo ":ruby: Ruby $THIS_VERSION Released :ruby:"
|
|
27
27
|
echo ":rubygems: Rubygems: https://rubygems.org/gems/recurly/versions/$THIS_VERSION"
|
28
28
|
echo "Release: https://github.com/recurly/recurly-client-ruby/releases/tag/$THIS_VERSION"
|
29
29
|
echo "Changelog:"
|
30
|
-
|
30
|
+
echo "\`\`\`"
|
31
|
+
cat "$RELEASED_LOG"
|
32
|
+
echo "\`\`\`"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recurly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recurly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- ".bumpversion.cfg"
|
119
119
|
- ".github/ISSUE_TEMPLATE/bug-report.md"
|
120
120
|
- ".github/ISSUE_TEMPLATE/question-or-other.md"
|
121
|
+
- ".github/workflows/docs.yml"
|
121
122
|
- ".github_changelog_generator"
|
122
123
|
- ".gitignore"
|
123
124
|
- ".rspec"
|
@@ -180,6 +181,7 @@ files:
|
|
180
181
|
- lib/recurly/requests/shipping_fee_create.rb
|
181
182
|
- lib/recurly/requests/shipping_purchase.rb
|
182
183
|
- lib/recurly/requests/subscription_add_on_create.rb
|
184
|
+
- lib/recurly/requests/subscription_add_on_tier.rb
|
183
185
|
- lib/recurly/requests/subscription_add_on_update.rb
|
184
186
|
- lib/recurly/requests/subscription_cancel.rb
|
185
187
|
- lib/recurly/requests/subscription_change_create.rb
|
@@ -191,6 +193,7 @@ files:
|
|
191
193
|
- lib/recurly/requests/subscription_shipping_purchase.rb
|
192
194
|
- lib/recurly/requests/subscription_shipping_update.rb
|
193
195
|
- lib/recurly/requests/subscription_update.rb
|
196
|
+
- lib/recurly/requests/tier.rb
|
194
197
|
- lib/recurly/resource.rb
|
195
198
|
- lib/recurly/resources.rb
|
196
199
|
- lib/recurly/resources/account.rb
|
@@ -241,9 +244,11 @@ files:
|
|
241
244
|
- lib/recurly/resources/site.rb
|
242
245
|
- lib/recurly/resources/subscription.rb
|
243
246
|
- lib/recurly/resources/subscription_add_on.rb
|
247
|
+
- lib/recurly/resources/subscription_add_on_tier.rb
|
244
248
|
- lib/recurly/resources/subscription_change.rb
|
245
249
|
- lib/recurly/resources/subscription_shipping.rb
|
246
250
|
- lib/recurly/resources/tax_info.rb
|
251
|
+
- lib/recurly/resources/tier.rb
|
247
252
|
- lib/recurly/resources/transaction.rb
|
248
253
|
- lib/recurly/resources/transaction_error.rb
|
249
254
|
- lib/recurly/resources/transaction_payment_gateway.rb
|
@@ -270,7 +275,12 @@ files:
|
|
270
275
|
homepage: https://github.com/recurly/recurly-client-ruby
|
271
276
|
licenses:
|
272
277
|
- MIT
|
273
|
-
metadata:
|
278
|
+
metadata:
|
279
|
+
bug_tracker_uri: https://github.com/recurly/recurly-client-ruby/issues
|
280
|
+
changelog_uri: https://github.com/recurly/recurly-client-ruby/blob/master/CHANGELOG.md
|
281
|
+
documentation_uri: https://dev.recurly.com/docs
|
282
|
+
homepage_uri: https://github.com/recurly/recurly-client-ruby
|
283
|
+
source_code_uri: https://github.com/recurly/recurly-client-ruby/tree/3.5.0
|
274
284
|
post_install_message:
|
275
285
|
rdoc_options: []
|
276
286
|
require_paths:
|
@@ -286,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
286
296
|
- !ruby/object:Gem::Version
|
287
297
|
version: '0'
|
288
298
|
requirements: []
|
289
|
-
rubygems_version: 3.0.
|
299
|
+
rubygems_version: 3.0.3
|
290
300
|
signing_key:
|
291
301
|
specification_version: 4
|
292
302
|
summary: The ruby client for Recurly's V3 API
|