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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ecbf1f0769f7a67b1c5f7f8b5ee0d25fdbea9c93a904b3dd8db5c8de4b2b71a
4
- data.tar.gz: 556898b14903f191423e71d67045cc36a957f85446e13d2cf82122d9b3c52806
3
+ metadata.gz: 83f25e1dee86f19b00a000d486f4aa1b6b9d272d0ace3406e957e5dd1b378c6c
4
+ data.tar.gz: d50f4e39c520d51451361401657cab79dd566adcdfea46d4adead9334e34feb3
5
5
  SHA512:
6
- metadata.gz: 92c6947d405a13ab65c52380fe7cbc57c10ee0f7118dab82d024488ce3878df8ff822522e8826471b7747d5064ca184c6b4ce91e1b835da762b2216c7981dcd9
7
- data.tar.gz: 1e221b69ff31a5a07157683572956095d49ea9a893388aeebd98b8d3caada461d24e9bb3f4cc94490d28cce7c80d5925c56d52361f7dcead00449166667170c2
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.2'
17
+ gem 'recurly', '~> 2.18.4'
18
18
  ```
19
19
 
20
20
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -36,6 +36,7 @@ module Recurly
36
36
  total_in_cents
37
37
  currency
38
38
  product_code
39
+ item_code
39
40
  start_date
40
41
  end_date
41
42
  created_at
data/lib/recurly/api.rb CHANGED
@@ -18,7 +18,7 @@ module Recurly
18
18
  @@base_uri = "https://api.recurly.com/v2/"
19
19
  @@valid_domains = [".recurly.com"]
20
20
 
21
- RECURLY_API_VERSION = '2.22'
21
+ RECURLY_API_VERSION = '2.24'
22
22
 
23
23
  FORMATS = Helper.hash_with_indifferent_read_access(
24
24
  'pdf' => 'application/pdf',
@@ -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
@@ -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} If you want to apply an existing shipping
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. Add multiple shipping addresses to {Account#shipping_addresses}. The last
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
 
@@ -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
- reload follow_link :cancel
188
+ params = timeframe.nil? ? {} : { 'timeframe': timeframe }
189
+ reload follow_link :cancel, params: params
188
190
  true
189
191
  end
190
192
 
@@ -1,6 +1,6 @@
1
1
  module Recurly
2
2
  module Version
3
- VERSION = "2.18.2"
3
+ VERSION = "2.18.4"
4
4
 
5
5
  class << self
6
6
  def inspect
data/lib/recurly.rb CHANGED
@@ -21,6 +21,7 @@ module Recurly
21
21
  require 'recurly/helper'
22
22
  require 'recurly/invoice'
23
23
  require 'recurly/invoice_collection'
24
+ require 'recurly/item'
24
25
  require 'recurly/js'
25
26
  require 'recurly/money'
26
27
  require 'recurly/measured_unit'
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.2
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-09-27 00:00:00.000000000 Z
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