recurly 2.18.2 → 2.18.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/recurly/adjustment.rb +1 -0
- data/lib/recurly/api.rb +1 -1
- data/lib/recurly/item.rb +37 -0
- data/lib/recurly/purchase.rb +15 -16
- data/lib/recurly/subscription.rb +4 -2
- data/lib/recurly/version.rb +1 -1
- data/lib/recurly.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83f25e1dee86f19b00a000d486f4aa1b6b9d272d0ace3406e957e5dd1b378c6c
|
4
|
+
data.tar.gz: d50f4e39c520d51451361401657cab79dd566adcdfea46d4adead9334e34feb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 977e9116f4842904d48ad5bd26927e75f0fbf7f8b86471bbf15208da3cc47a6895ea7b38dddf5eb040d6953626d749e1ccbc3feb7ae33bfaf7ff8cdfd5c1b1d4
|
7
|
+
data.tar.gz: 610d7903d45e8a4340c76170ad17667f70e5b004e0e90fe445c7ee674b196f9e006ecbbc5cd3ff32bf9ae1ea94a40f413905362af512e750e6cece72648cffa7
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Recurly is packaged as a Ruby gem. We recommend you install it with
|
|
14
14
|
[Bundler](http://gembundler.com/) by adding the following line to your Gemfile:
|
15
15
|
|
16
16
|
``` ruby
|
17
|
-
gem 'recurly', '~> 2.18.
|
17
|
+
gem 'recurly', '~> 2.18.4'
|
18
18
|
```
|
19
19
|
|
20
20
|
Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
|
data/lib/recurly/adjustment.rb
CHANGED
data/lib/recurly/api.rb
CHANGED
data/lib/recurly/item.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Recurly
|
2
|
+
class Item < Resource
|
3
|
+
# @return [[CustomField], []]
|
4
|
+
has_many :custom_fields, class_name: :CustomField, readonly: false
|
5
|
+
|
6
|
+
define_attribute_methods %w(
|
7
|
+
item_code
|
8
|
+
name
|
9
|
+
description
|
10
|
+
external_sku
|
11
|
+
accounting_code
|
12
|
+
revenue_schedule_type
|
13
|
+
state
|
14
|
+
created_at
|
15
|
+
updated_at
|
16
|
+
deleted_at
|
17
|
+
)
|
18
|
+
|
19
|
+
def changed_attributes
|
20
|
+
attrs = super
|
21
|
+
if custom_fields.any?(&:changed?)
|
22
|
+
attrs['custom_fields'] = custom_fields.select(&:changed?)
|
23
|
+
end
|
24
|
+
attrs
|
25
|
+
end
|
26
|
+
|
27
|
+
# method should be changed to use a link once it is added to api
|
28
|
+
# example:
|
29
|
+
# return false unless link? :reactivate
|
30
|
+
# reload follow_link :reactivate
|
31
|
+
def reactivate
|
32
|
+
reload API.put("#{uri}/reactivate")
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/lib/recurly/purchase.rb
CHANGED
@@ -21,11 +21,9 @@ module Recurly
|
|
21
21
|
# You can also pass in adjustments and invoicing data to be added to the invoice.
|
22
22
|
#
|
23
23
|
# There are multiple ways to set the shipping addresses:
|
24
|
-
# 1. Use {Purchase#shipping_address_id}
|
24
|
+
# 1. Use {Purchase#shipping_address_id} if you want to apply an existing shipping
|
25
25
|
# address to all subscriptions, adjustments, and shipping fees in this purchase.
|
26
|
-
# 2.
|
27
|
-
# address in the list will apply to all subscriptions and adjustments
|
28
|
-
# in this purchase.
|
26
|
+
# 2. Use {Purchase#shipping_address} if you want to add and apply a single shipping address.
|
29
27
|
# 3. Use {Subscription#shipping_address_id} or {Subscription#shipping_address}
|
30
28
|
# to set a shipping address for only the subscription.
|
31
29
|
# 4. Use {Adjustment#shipping_address_id} or {Adjustment#shipping_address}
|
@@ -45,18 +43,6 @@ module Recurly
|
|
45
43
|
# collection_method: :automatic,
|
46
44
|
# account: {
|
47
45
|
# account_code: SecureRandom.uuid,
|
48
|
-
# shipping_addresses: [
|
49
|
-
# {
|
50
|
-
# first_name: 'Benjamin',
|
51
|
-
# last_name: 'Du Monde',
|
52
|
-
# address1: '400 Dolores St.',
|
53
|
-
# city: 'San Francisco',
|
54
|
-
# state: 'CA',
|
55
|
-
# zip: '94110',
|
56
|
-
# country: 'US',
|
57
|
-
# nickname: 'Home'
|
58
|
-
# }
|
59
|
-
# ],
|
60
46
|
# billing_info: {
|
61
47
|
# first_name: 'Benjamin',
|
62
48
|
# last_name: 'Du Monde',
|
@@ -84,6 +70,16 @@ module Recurly
|
|
84
70
|
# revenue_schedule_type: :at_invoice
|
85
71
|
# }
|
86
72
|
# ],
|
73
|
+
# shipping_address: {
|
74
|
+
# first_name: 'Benjamin',
|
75
|
+
# last_name: 'Du Monde',
|
76
|
+
# address1: '400 Dolores St.',
|
77
|
+
# city: 'San Francisco',
|
78
|
+
# state: 'CA',
|
79
|
+
# zip: '94110',
|
80
|
+
# country: 'US',
|
81
|
+
# nickname: 'Home'
|
82
|
+
# },
|
87
83
|
# shipping_fees: [
|
88
84
|
# {
|
89
85
|
# shipping_method_code: 'fast_fast_fast',
|
@@ -123,6 +119,9 @@ module Recurly
|
|
123
119
|
# @return [GiftCard, nil]
|
124
120
|
has_one :gift_card, class_name: :GiftCard, readonly: false
|
125
121
|
|
122
|
+
# @return [ShippingAddress, nil]
|
123
|
+
has_one :shipping_address, class_name: :ShippingAddress, readonly: false
|
124
|
+
|
126
125
|
# @return [[Subscription], nil]
|
127
126
|
has_many :subscriptions, class_name: :Subscription, readonly: false
|
128
127
|
|
data/lib/recurly/subscription.rb
CHANGED
@@ -176,15 +176,17 @@ module Recurly
|
|
176
176
|
|
177
177
|
# Cancel a subscription so that it will not renew.
|
178
178
|
#
|
179
|
+
# @param [String] optional timeframe. Choose one of "bill_date" or "term_end"
|
179
180
|
# @return [true, false] +true+ when successful, +false+ when unable to
|
180
181
|
# (e.g., the subscription is not active).
|
181
182
|
# @example
|
182
183
|
# account = Account.find account_code
|
183
184
|
# subscription = account.subscriptions.first
|
184
185
|
# subscription.cancel # => true
|
185
|
-
def cancel
|
186
|
+
def cancel(timeframe = nil)
|
186
187
|
return false unless link? :cancel
|
187
|
-
|
188
|
+
params = timeframe.nil? ? {} : { 'timeframe': timeframe }
|
189
|
+
reload follow_link :cancel, params: params
|
188
190
|
true
|
189
191
|
end
|
190
192
|
|
data/lib/recurly/version.rb
CHANGED
data/lib/recurly.rb
CHANGED
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: 2.18.
|
4
|
+
version: 2.18.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recurly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -228,6 +228,7 @@ files:
|
|
228
228
|
- lib/recurly/helper.rb
|
229
229
|
- lib/recurly/invoice.rb
|
230
230
|
- lib/recurly/invoice_collection.rb
|
231
|
+
- lib/recurly/item.rb
|
231
232
|
- lib/recurly/js.rb
|
232
233
|
- lib/recurly/juris_detail.rb
|
233
234
|
- lib/recurly/measured_unit.rb
|