recurly 4.22.0 → 4.24.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 +1 -1
- data/CHANGELOG.md +19 -0
- data/GETTING_STARTED.md +1 -1
- data/lib/recurly/client/operations.rb +19 -0
- data/lib/recurly/errors/webhooks_errors.rb +5 -0
- data/lib/recurly/errors.rb +1 -0
- data/lib/recurly/resources/customer_permission.rb +30 -0
- data/lib/recurly/resources/entitlement.rb +30 -0
- data/lib/recurly/resources/entitlements.rb +26 -0
- data/lib/recurly/resources/granted_by.rb +18 -0
- data/lib/recurly/version.rb +1 -1
- data/lib/recurly/webhooks.rb +52 -0
- data/lib/recurly.rb +1 -0
- data/openapi/api.yaml +119 -0
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f585c84e359302293e13409b5162b2ad56241f342b0c9e9c2c4200f29782a32
|
4
|
+
data.tar.gz: d8908b9d5e9cefcce7a9fa6cfa0d75b69dcd8b885ac6ce6dacc2ec416f56c1a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d42081e4d4e095850d9b1158e8c798ab0cc11d9f9d68bb895ba77808a2d6f4f1a0bdfeac2c6394d704ea74add4df4ba63ca2eca70d1c05c1b3499e3c9bbbb76
|
7
|
+
data.tar.gz: 1bb51683c999694c1843c378754ba2fb6556d205db5f50ebf93cde4cb46997548cd31f3062b75f6b1db7d3bb575a3040ddea88276f1172fca424785e96b92304
|
data/.bumpversion.cfg
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [4.24.0](https://github.com/recurly/recurly-client-ruby/tree/4.24.0) (2022-11-03)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/4.23.0...4.24.0)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
## [4.23.0](https://github.com/recurly/recurly-client-ruby/tree/4.23.0) (2022-10-27)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/4.22.0...4.23.0)
|
14
|
+
|
15
|
+
|
16
|
+
**Merged Pull Requests**
|
17
|
+
|
18
|
+
- Generated Latest Changes for v2021-02-25 (Entitlements feature) [#804](https://github.com/recurly/recurly-client-ruby/pull/804) ([recurly-integrations](https://github.com/recurly-integrations))
|
19
|
+
|
20
|
+
|
21
|
+
|
3
22
|
## [4.22.0](https://github.com/recurly/recurly-client-ruby/tree/4.22.0) (2022-10-21)
|
4
23
|
|
5
24
|
[Full Changelog](https://github.com/recurly/recurly-client-ruby/compare/4.21.1...4.22.0)
|
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', '~> 4.
|
8
|
+
gem 'recurly', '~> 4.24'
|
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.
|
@@ -4091,5 +4091,24 @@ module Recurly
|
|
4091
4091
|
path = interpolate_path("/invoice_templates/{invoice_template_id}", invoice_template_id: invoice_template_id)
|
4092
4092
|
get(path, **options)
|
4093
4093
|
end
|
4094
|
+
|
4095
|
+
# Show all entitlements granted to an account
|
4096
|
+
#
|
4097
|
+
# {https://developers.recurly.com/api/v2021-02-25#operation/list_entitlements list_entitlements api documentation}
|
4098
|
+
#
|
4099
|
+
# @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+.
|
4100
|
+
# @param params [Hash] Optional query string parameters:
|
4101
|
+
# :state [String] Filter the entitlements based on the state of the applicable subscription.
|
4102
|
+
#
|
4103
|
+
# - When +state=active+, +state=canceled+, +state=expired+, or +state=future+, subscriptions with states that match the query and only those subscriptions will be returned.
|
4104
|
+
# - When no state is provided, subscriptions with active or canceled states will be returned.
|
4105
|
+
#
|
4106
|
+
#
|
4107
|
+
# @return [Pager<Resources::Entitlements>] A list of the entitlements granted to an account.
|
4108
|
+
#
|
4109
|
+
def list_entitlements(account_id:, **options)
|
4110
|
+
path = interpolate_path("/accounts/{account_id}/entitlements", account_id: account_id)
|
4111
|
+
pager(path, **options)
|
4112
|
+
end
|
4094
4113
|
end
|
4095
4114
|
end
|
data/lib/recurly/errors.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
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 CustomerPermission < Resource
|
8
|
+
|
9
|
+
# @!attribute code
|
10
|
+
# @return [String] Customer permission code.
|
11
|
+
define_attribute :code, String
|
12
|
+
|
13
|
+
# @!attribute description
|
14
|
+
# @return [String] Description of customer permission.
|
15
|
+
define_attribute :description, String
|
16
|
+
|
17
|
+
# @!attribute id
|
18
|
+
# @return [String] Customer permission ID.
|
19
|
+
define_attribute :id, String
|
20
|
+
|
21
|
+
# @!attribute name
|
22
|
+
# @return [String] Customer permission name.
|
23
|
+
define_attribute :name, String
|
24
|
+
|
25
|
+
# @!attribute object
|
26
|
+
# @return [String] It will always be "customer_permission".
|
27
|
+
define_attribute :object, String
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
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 Entitlement < Resource
|
8
|
+
|
9
|
+
# @!attribute created_at
|
10
|
+
# @return [DateTime] Time object was created.
|
11
|
+
define_attribute :created_at, DateTime
|
12
|
+
|
13
|
+
# @!attribute customer_permission
|
14
|
+
# @return [CustomerPermission]
|
15
|
+
define_attribute :customer_permission, :CustomerPermission
|
16
|
+
|
17
|
+
# @!attribute granted_by
|
18
|
+
# @return [Array[GrantedBy]] Subscription or item that granted the customer permission.
|
19
|
+
define_attribute :granted_by, Array, { :item_type => :GrantedBy }
|
20
|
+
|
21
|
+
# @!attribute object
|
22
|
+
# @return [String] Entitlement
|
23
|
+
define_attribute :object, String
|
24
|
+
|
25
|
+
# @!attribute updated_at
|
26
|
+
# @return [DateTime] Time the object was last updated
|
27
|
+
define_attribute :updated_at, DateTime
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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 Entitlements < Resource
|
8
|
+
|
9
|
+
# @!attribute data
|
10
|
+
# @return [Array[Entitlement]]
|
11
|
+
define_attribute :data, Array, { :item_type => :Entitlement }
|
12
|
+
|
13
|
+
# @!attribute has_more
|
14
|
+
# @return [Boolean] Indicates there are more results on subsequent pages.
|
15
|
+
define_attribute :has_more, :Boolean
|
16
|
+
|
17
|
+
# @!attribute next
|
18
|
+
# @return [String] Path to subsequent page of results.
|
19
|
+
define_attribute :next, String
|
20
|
+
|
21
|
+
# @!attribute object
|
22
|
+
# @return [String] Object Type
|
23
|
+
define_attribute :object, String
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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 GrantedBy < Resource
|
8
|
+
|
9
|
+
# @!attribute id
|
10
|
+
# @return [String] The ID of the subscription or external subscription that grants the permission to the account.
|
11
|
+
define_attribute :id, String
|
12
|
+
|
13
|
+
# @!attribute object
|
14
|
+
# @return [String] Object Type
|
15
|
+
define_attribute :object, String
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/recurly/version.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
module Recurly
|
2
|
+
module Webhooks
|
3
|
+
DEFAULT_TOLERANCE = 5 * 60 * 1000
|
4
|
+
|
5
|
+
# Verify webhook signature
|
6
|
+
#
|
7
|
+
# @param header [String] recurly-signature header from request
|
8
|
+
# @param secret [String] Shared secret for notification endpoint
|
9
|
+
# @param body [String] Request POST body
|
10
|
+
# @param tolerance [Integer] Allowed notification time drift in milliseconds
|
11
|
+
# @example
|
12
|
+
# begin
|
13
|
+
# Recurly::Webhooks.verify_signature(header,
|
14
|
+
# ENV['WEBHOOKS_KEY'],
|
15
|
+
# request.body)
|
16
|
+
# rescue Recurly::Errors::SignatureVerificationError => e
|
17
|
+
# puts e.message
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
def self.verify_signature(header, secret, body, tolerance: DEFAULT_TOLERANCE)
|
21
|
+
s_timestamp, *signatures = header.split(",")
|
22
|
+
timestamp = Integer(s_timestamp)
|
23
|
+
now = (Time.now.to_f * 1000).to_i
|
24
|
+
|
25
|
+
if (now - timestamp).abs > tolerance
|
26
|
+
raise Recurly::Errors::SignatureVerificationError.new(
|
27
|
+
"Notification (#{Time.at(timestamp / 1000.0)}) is more than #{tolerance / 1000.0}s out of date"
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
expected = OpenSSL::HMAC.hexdigest("sha256", secret, "#{timestamp}.#{body}")
|
32
|
+
|
33
|
+
unless signatures.any? { |s| secure_compare(expected, s) }
|
34
|
+
raise Recurly::Errors::SignatureVerificationError.new(
|
35
|
+
"No matching signatures found for payload"
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# https://github.com/rack/rack/blob/2-2-stable/lib/rack/utils.rb#L374
|
41
|
+
# https://github.com/heartcombo/devise/blob/4-1-stable/lib/devise.rb#L477
|
42
|
+
def self.secure_compare(a, b)
|
43
|
+
return false if a.bytesize != b.bytesize
|
44
|
+
l = a.unpack("C#{a.bytesize}")
|
45
|
+
|
46
|
+
res = 0
|
47
|
+
b.each_byte { |byte| res |= byte ^ l.shift }
|
48
|
+
res == 0
|
49
|
+
end
|
50
|
+
private_class_method :secure_compare
|
51
|
+
end
|
52
|
+
end
|
data/lib/recurly.rb
CHANGED
data/openapi/api.yaml
CHANGED
@@ -305,6 +305,8 @@ tags:
|
|
305
305
|
description: A purchase is a checkout containing at least one or more subscriptions
|
306
306
|
or one-time charges (line items) and supports both coupon and gift card redemptions.
|
307
307
|
All items purchased will be on one invoice and paid for with one transaction.
|
308
|
+
The purchases endpoint can also be used to immediately create a credit invoice
|
309
|
+
on an account, when Credit Invoices is enabled on your site.
|
308
310
|
- name: usage
|
309
311
|
x-displayName: Usage
|
310
312
|
description: Send Recurly your customer usage and we will automatically bill them
|
@@ -3773,6 +3775,8 @@ paths:
|
|
3773
3775
|
- line_item
|
3774
3776
|
operationId: create_line_item
|
3775
3777
|
summary: Create a new line item for the account
|
3778
|
+
description: When using the Credit Invoices feature, utilize the purchases endpoint
|
3779
|
+
in order to immediately post credit to a credit invoice.
|
3776
3780
|
parameters:
|
3777
3781
|
- "$ref": "#/components/parameters/account_id"
|
3778
3782
|
requestBody:
|
@@ -15065,6 +15069,35 @@ paths:
|
|
15065
15069
|
schema:
|
15066
15070
|
"$ref": "#/components/schemas/Error"
|
15067
15071
|
x-code-samples: []
|
15072
|
+
"/accounts/{account_id}/entitlements":
|
15073
|
+
parameters:
|
15074
|
+
- "$ref": "#/components/parameters/account_id"
|
15075
|
+
- "$ref": "#/components/parameters/filter_limited_subscription_state"
|
15076
|
+
get:
|
15077
|
+
tags:
|
15078
|
+
- account
|
15079
|
+
operationId: list_entitlements
|
15080
|
+
summary: Show all entitlements granted to an account
|
15081
|
+
responses:
|
15082
|
+
'200':
|
15083
|
+
description: A list of the entitlements granted to an account.
|
15084
|
+
content:
|
15085
|
+
application/json:
|
15086
|
+
schema:
|
15087
|
+
"$ref": "#/components/schemas/Entitlements"
|
15088
|
+
'404':
|
15089
|
+
description: Incorrect site or account ID.
|
15090
|
+
content:
|
15091
|
+
application/json:
|
15092
|
+
schema:
|
15093
|
+
"$ref": "#/components/schemas/Error"
|
15094
|
+
default:
|
15095
|
+
description: Unexpected error.
|
15096
|
+
content:
|
15097
|
+
application/json:
|
15098
|
+
schema:
|
15099
|
+
"$ref": "#/components/schemas/Error"
|
15100
|
+
x-code-samples: []
|
15068
15101
|
servers:
|
15069
15102
|
- url: https://v3.recurly.com
|
15070
15103
|
- url: https://v3.eu.recurly.com
|
@@ -15306,6 +15339,16 @@ components:
|
|
15306
15339
|
- When `state=live`, only subscriptions that are in an active, canceled, or future state or are in trial will be returned.
|
15307
15340
|
schema:
|
15308
15341
|
"$ref": "#/components/schemas/FilterSubscriptionStateEnum"
|
15342
|
+
filter_limited_subscription_state:
|
15343
|
+
name: state
|
15344
|
+
in: query
|
15345
|
+
description: |
|
15346
|
+
Filter the entitlements based on the state of the applicable subscription.
|
15347
|
+
|
15348
|
+
- When `state=active`, `state=canceled`, `state=expired`, or `state=future`, subscriptions with states that match the query and only those subscriptions will be returned.
|
15349
|
+
- When no state is provided, subscriptions with active or canceled states will be returned.
|
15350
|
+
schema:
|
15351
|
+
"$ref": "#/components/schemas/FilterLimitedSubscriptionStateEnum"
|
15309
15352
|
filter_begin_time:
|
15310
15353
|
name: begin_time
|
15311
15354
|
in: query
|
@@ -22093,6 +22136,75 @@ components:
|
|
22093
22136
|
maxItems: 200
|
22094
22137
|
items:
|
22095
22138
|
"$ref": "#/components/schemas/Plan"
|
22139
|
+
Entitlements:
|
22140
|
+
type: object
|
22141
|
+
description: A list of privileges granted to a customer through the purchase
|
22142
|
+
of a plan or item.
|
22143
|
+
properties:
|
22144
|
+
object:
|
22145
|
+
type: string
|
22146
|
+
title: Object Type
|
22147
|
+
has_more:
|
22148
|
+
type: boolean
|
22149
|
+
description: Indicates there are more results on subsequent pages.
|
22150
|
+
next:
|
22151
|
+
type: string
|
22152
|
+
description: Path to subsequent page of results.
|
22153
|
+
data:
|
22154
|
+
type: array
|
22155
|
+
items:
|
22156
|
+
"$ref": "#/components/schemas/Entitlement"
|
22157
|
+
Entitlement:
|
22158
|
+
type: object
|
22159
|
+
properties:
|
22160
|
+
object:
|
22161
|
+
type: string
|
22162
|
+
description: Entitlement
|
22163
|
+
customer_permission:
|
22164
|
+
"$ref": "#/components/schemas/CustomerPermission"
|
22165
|
+
granted_by:
|
22166
|
+
type: array
|
22167
|
+
description: Subscription or item that granted the customer permission.
|
22168
|
+
items:
|
22169
|
+
"$ref": "#/components/schemas/GrantedBy"
|
22170
|
+
created_at:
|
22171
|
+
type: string
|
22172
|
+
format: date-time
|
22173
|
+
description: Time object was created.
|
22174
|
+
updated_at:
|
22175
|
+
type: string
|
22176
|
+
format: date-time
|
22177
|
+
description: Time the object was last updated
|
22178
|
+
CustomerPermission:
|
22179
|
+
type: object
|
22180
|
+
properties:
|
22181
|
+
id:
|
22182
|
+
type: string
|
22183
|
+
description: Customer permission ID.
|
22184
|
+
code:
|
22185
|
+
type: string
|
22186
|
+
description: Customer permission code.
|
22187
|
+
name:
|
22188
|
+
type: string
|
22189
|
+
description: Customer permission name.
|
22190
|
+
description:
|
22191
|
+
type: string
|
22192
|
+
description: Description of customer permission.
|
22193
|
+
object:
|
22194
|
+
type: string
|
22195
|
+
description: It will always be "customer_permission".
|
22196
|
+
GrantedBy:
|
22197
|
+
type: object
|
22198
|
+
description: The subscription or external subscription that grants customer
|
22199
|
+
permissions.
|
22200
|
+
properties:
|
22201
|
+
object:
|
22202
|
+
type: string
|
22203
|
+
title: Object Type
|
22204
|
+
id:
|
22205
|
+
type: string
|
22206
|
+
description: The ID of the subscription or external subscription that grants
|
22207
|
+
the permission to the account.
|
22096
22208
|
InvoiceTemplateList:
|
22097
22209
|
type: object
|
22098
22210
|
properties:
|
@@ -22306,6 +22418,13 @@ components:
|
|
22306
22418
|
- future
|
22307
22419
|
- in_trial
|
22308
22420
|
- live
|
22421
|
+
FilterLimitedSubscriptionStateEnum:
|
22422
|
+
type: string
|
22423
|
+
enum:
|
22424
|
+
- active
|
22425
|
+
- canceled
|
22426
|
+
- expired
|
22427
|
+
- future
|
22309
22428
|
TrueEnum:
|
22310
22429
|
type: string
|
22311
22430
|
enum:
|
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: 4.
|
4
|
+
version: 4.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recurly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/recurly/errors.rb
|
142
142
|
- lib/recurly/errors/api_errors.rb
|
143
143
|
- lib/recurly/errors/network_errors.rb
|
144
|
+
- lib/recurly/errors/webhooks_errors.rb
|
144
145
|
- lib/recurly/http.rb
|
145
146
|
- lib/recurly/pager.rb
|
146
147
|
- lib/recurly/request.rb
|
@@ -239,16 +240,20 @@ files:
|
|
239
240
|
- lib/recurly/resources/credit_payment.rb
|
240
241
|
- lib/recurly/resources/custom_field.rb
|
241
242
|
- lib/recurly/resources/custom_field_definition.rb
|
243
|
+
- lib/recurly/resources/customer_permission.rb
|
242
244
|
- lib/recurly/resources/dunning_campaign.rb
|
243
245
|
- lib/recurly/resources/dunning_campaigns_bulk_update_response.rb
|
244
246
|
- lib/recurly/resources/dunning_cycle.rb
|
245
247
|
- lib/recurly/resources/dunning_interval.rb
|
248
|
+
- lib/recurly/resources/entitlement.rb
|
249
|
+
- lib/recurly/resources/entitlements.rb
|
246
250
|
- lib/recurly/resources/error.rb
|
247
251
|
- lib/recurly/resources/error_may_have_transaction.rb
|
248
252
|
- lib/recurly/resources/export_dates.rb
|
249
253
|
- lib/recurly/resources/export_file.rb
|
250
254
|
- lib/recurly/resources/export_files.rb
|
251
255
|
- lib/recurly/resources/fraud_info.rb
|
256
|
+
- lib/recurly/resources/granted_by.rb
|
252
257
|
- lib/recurly/resources/invoice.rb
|
253
258
|
- lib/recurly/resources/invoice_address.rb
|
254
259
|
- lib/recurly/resources/invoice_collection.rb
|
@@ -300,6 +305,7 @@ files:
|
|
300
305
|
- lib/recurly/schema/schema_factory.rb
|
301
306
|
- lib/recurly/schema/schema_validator.rb
|
302
307
|
- lib/recurly/version.rb
|
308
|
+
- lib/recurly/webhooks.rb
|
303
309
|
- openapi/api.yaml
|
304
310
|
- recurly.gemspec
|
305
311
|
- scripts/build
|
@@ -316,7 +322,7 @@ metadata:
|
|
316
322
|
changelog_uri: https://github.com/recurly/recurly-client-ruby/blob/master/CHANGELOG.md
|
317
323
|
documentation_uri: https://recurly.github.io/recurly-client-ruby/
|
318
324
|
homepage_uri: https://github.com/recurly/recurly-client-ruby
|
319
|
-
source_code_uri: https://github.com/recurly/recurly-client-ruby/tree/4.
|
325
|
+
source_code_uri: https://github.com/recurly/recurly-client-ruby/tree/4.24.0
|
320
326
|
post_install_message:
|
321
327
|
rdoc_options: []
|
322
328
|
require_paths:
|