recurly 2.7.1 → 2.7.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of recurly might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01d73b6f7d5228081f44229f4e0c5782a1d6b399
4
- data.tar.gz: 7c82dab6c9fc6ed08fe0cef7e33e3075e256ebe4
3
+ metadata.gz: 7482bc37f691fb0ec0e3994eb35afdd158e6eda4
4
+ data.tar.gz: d1e17655dbc980c1b9395e0a68ffdb3affd928a9
5
5
  SHA512:
6
- metadata.gz: a4caaecb4f59bc93ca198f6305f97ea5706b11eff4ac017ae042248091efc939d86742c0cbdc7577a952ebd28eb824a95a1bab091c3225e8096929d1051dcffa
7
- data.tar.gz: 396b7d4925744915764f975400c69c1e2835e191d54ebc14329fba9918b4d961dac7df0dab979efbdb02efc6d33770ef62dec8bd82022c87d117457e0b2b3fcc
6
+ metadata.gz: 3738606dbbc8983110f80991432dda663a429c88c070a12d3bd6ce7cca40360d060b82c01d30945d331ca791e1c6be8e36b647d5a14aa41f318b4b9811120f90
7
+ data.tar.gz: 92f45cbe76ca5f3efa8b37aed9bfa1154586af2d28f7e6f2dd7ea7cc038098ccd63a97568622032db2ab5654b7e24cdf2d76504d294437a8e7a26fc056e9fa5c
data/README.md CHANGED
@@ -12,7 +12,7 @@ Recurly is packaged as a Ruby gem. We recommend you install it with
12
12
  [Bundler](http://gembundler.com/) by adding the following line to your Gemfile:
13
13
 
14
14
  ``` ruby
15
- gem 'recurly', '~> 2.7.1'
15
+ gem 'recurly', '~> 2.7.2'
16
16
  ```
17
17
 
18
18
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
data/lib/recurly.rb CHANGED
@@ -19,6 +19,7 @@ module Recurly
19
19
  require 'recurly/measured_unit'
20
20
  require 'recurly/plan'
21
21
  require 'recurly/redemption'
22
+ require 'recurly/shipping_address'
22
23
  require 'recurly/subscription'
23
24
  require 'recurly/subscription_add_on'
24
25
  require 'recurly/transaction'
@@ -17,6 +17,7 @@ module Recurly
17
17
  has_many :subscriptions
18
18
  has_many :transactions
19
19
  has_many :redemptions
20
+ has_many :shipping_addresses, resource_class: :ShippingAddress, readonly: false
20
21
 
21
22
  # @return [BillingInfo, nil]
22
23
  has_one :billing_info, :readonly => false
data/lib/recurly/api.rb CHANGED
@@ -16,7 +16,7 @@ module Recurly
16
16
 
17
17
  @@base_uri = "https://api.recurly.com/v2/"
18
18
 
19
- RECURLY_API_VERSION = '2.3'
19
+ RECURLY_API_VERSION = '2.4'
20
20
 
21
21
  FORMATS = Helper.hash_with_indifferent_read_access(
22
22
  'pdf' => 'application/pdf',
@@ -17,7 +17,10 @@ module Recurly
17
17
  end
18
18
 
19
19
  def singularize word
20
- word.to_s.sub(/s$/, '').sub(/ie$/, 'y')
20
+ word = word.to_s
21
+ return "shipping_address" if word == "shipping_address"
22
+ return "shipping_address" if word == "shipping_addresses"
23
+ word.sub(/s$/, '').sub(/ie$/, 'y')
21
24
  end
22
25
 
23
26
  def underscore camel_cased_word
@@ -23,6 +23,9 @@ module Recurly
23
23
  # @return [Redemption]
24
24
  has_many :redemptions
25
25
 
26
+ # return [ShippingAddress]
27
+ has_one :shipping_address, resource_class: :ShippingAddress, readonly: true
28
+
26
29
  def redemption
27
30
  redemptions.first
28
31
  end
@@ -9,6 +9,7 @@ module Recurly
9
9
  class Redemption < Resource
10
10
  # @return [Coupon]
11
11
  belongs_to :coupon
12
+
12
13
  # @return [Account]
13
14
  belongs_to :account, :readonly => false
14
15
 
@@ -485,7 +485,7 @@ module Recurly
485
485
  # @param collection_name [Symbol] Association name.
486
486
  # @param options [Hash] A hash of association options.
487
487
  # @option options [true, false] :readonly Don't define a setter.
488
- # [String] :class_name Actual associated resource class name
488
+ # [String] :resource_class Actual associated resource class name
489
489
  # if not same as collection_name.
490
490
  def has_many collection_name, options = {}
491
491
  associations << Association.new(:has_many, collection_name.to_s, options)
@@ -511,7 +511,7 @@ module Recurly
511
511
  # @param member_name [Symbol] Association name.
512
512
  # @param options [Hash] A hash of association options.
513
513
  # @option options [true, false] :readonly Don't define a setter.
514
- # [String] :class_name Actual associated resource class name
514
+ # [String] :resource_class Actual associated resource class name
515
515
  # if not same as member_name.
516
516
  def has_one member_name, options = {}
517
517
  associations << Association.new(:has_one, member_name.to_s, options)
@@ -549,7 +549,7 @@ module Recurly
549
549
  # @param parent_name [Symbol] Association name.
550
550
  # @param options [Hash] A hash of association options.
551
551
  # @option options [true, false] :readonly Don't define a setter.
552
- # [String] :class_name Actual associated resource class name
552
+ # [String] :resource_class Actual associated resource class name
553
553
  # if not same as parent_name.
554
554
  def belongs_to parent_name, options = {}
555
555
  associations << Association.new(:belongs_to, parent_name.to_s, options)
@@ -783,7 +783,17 @@ module Recurly
783
783
  when Resource, Subscription::AddOns
784
784
  value.to_xml options.merge(:builder => node)
785
785
  when Array
786
- value.each { |e| node.add_element Helper.singularize(key), e }
786
+ value.each do |e|
787
+ if e.is_a? Recurly::Resource
788
+ # create a node to hold this resource
789
+ e_node = node.add_element Helper.singularize(key)
790
+ # serialize the resource into this node
791
+ e.to_xml(options.merge(builder: e_node))
792
+ else
793
+ # it's just a primitive value
794
+ node.add_element(Helper.singularize(key), e)
795
+ end
796
+ end
787
797
  when Hash, Recurly::Money
788
798
  value.each_pair { |k, v| node.add_element k.to_s, v }
789
799
  else
@@ -0,0 +1,20 @@
1
+ module Recurly
2
+ class ShippingAddress < Resource
3
+ define_attribute_methods %w(
4
+ id
5
+ address1
6
+ address2
7
+ first_name
8
+ last_name
9
+ city
10
+ state
11
+ zip
12
+ country
13
+ phone
14
+ nickname
15
+ company
16
+ email
17
+ )
18
+ alias to_param address1
19
+ end
20
+ end
@@ -28,6 +28,9 @@ module Recurly
28
28
  # @return [Redemption]
29
29
  has_many :redemptions
30
30
 
31
+ # return [ShippingAddress]
32
+ has_one :shipping_address, resource_class: :ShippingAddress, readonly: false
33
+
31
34
  define_attribute_methods %w(
32
35
  uuid
33
36
  state
@@ -63,6 +66,7 @@ module Recurly
63
66
  vat_reverse_charge_notes
64
67
  address
65
68
  revenue_schedule_type
69
+ shipping_address_id
66
70
  )
67
71
  alias to_param uuid
68
72
 
@@ -2,7 +2,7 @@ module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 7
5
- PATCH = 1
5
+ PATCH = 2
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
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.7.1
4
+ version: 2.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-04 00:00:00.000000000 Z
11
+ date: 2016-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -86,6 +86,7 @@ files:
86
86
  - lib/recurly/resource/errors.rb
87
87
  - lib/recurly/resource/pager.rb
88
88
  - lib/recurly/resource.rb
89
+ - lib/recurly/shipping_address.rb
89
90
  - lib/recurly/subscription/add_ons.rb
90
91
  - lib/recurly/subscription.rb
91
92
  - lib/recurly/subscription_add_on.rb