recurly 2.18.8 → 2.18.13

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: eb193b463e44579e6acb5dd39eadefea0f9294de9a3bb1be484fb75f167ce4d6
4
- data.tar.gz: 0fa9c10e470b143e646695c52e5071104e1e419532db0874de4fc523136f4470
3
+ metadata.gz: 3082ab34c9230a6e05cde1c4ec775ed0282ef33dda4e40b71c0b8390f871b649
4
+ data.tar.gz: f813d757a646978eb1c53f2264f01cc32ce368ec783a615786d3888a3a052505
5
5
  SHA512:
6
- metadata.gz: 61495efe7cbe8592c8fc6b6e16484ef6ee1234b9c74e17cb703ad2c306c6b0b68b0ec03218c41cfd1bb7f25976aa3b6988f409419d0c94d0c503c24a972c6ca5
7
- data.tar.gz: a0a0000c8eda507308a6553cd119bcdd9bbda67e47648068992fc14106bf21220c2bb447eecb9cf88d8bdb2594d5880ef529cab0a181a430a486a9bb40cc9b0d
6
+ metadata.gz: 1876031b13b2459bb6477ef5970b59c84fa4476b7359dcf494fe95f2cce546fe1e71f2851dae7af2d94c6f4b701e11c5a34a630aba7b6f07458f926c36084cb4
7
+ data.tar.gz: 183b86f9f909569637630f278c94cf7c98f9b185fb08f7568c534c0f8b0bb1b6e4b73a9e0a15254bc06f17e56f38a3721395890ea952cede9cfc207be12dd1a3
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.8'
17
+ gem 'recurly', '~> 2.18.13'
18
18
  ```
19
19
 
20
20
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -2,6 +2,8 @@ module Recurly
2
2
  class AddOn < Resource
3
3
  # @return [Plan]
4
4
  belongs_to :plan
5
+ # @return [[Tier], []]
6
+ has_many :tiers, class_name: :Tier, readonly: false
5
7
 
6
8
  define_attribute_methods %w(
7
9
  add_on_code
@@ -21,11 +23,20 @@ module Recurly
21
23
  created_at
22
24
  updated_at
23
25
  tier_type
24
- tiers
26
+ avalara_service_type
27
+ avalara_transaction_type
25
28
  )
26
29
  alias to_param add_on_code
27
30
  alias quantity default_quantity
28
31
 
32
+ def changed_attributes
33
+ attrs = super
34
+ if tiers.any?(&:changed?)
35
+ attrs['tiers'] = tiers.select(&:changed?)
36
+ end
37
+ attrs
38
+ end
39
+
29
40
  # Add-ons are only writeable and readable through {Plan} instances.
30
41
  embedded!
31
42
  private_class_method :find
@@ -57,6 +57,8 @@ module Recurly
57
57
  original_adjustment_uuid
58
58
  shipping_address_id
59
59
  surcharge_in_cents
60
+ avalara_transaction_type
61
+ avalara_service_type
60
62
  )
61
63
  alias to_param uuid
62
64
 
@@ -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.26'
21
+ RECURLY_API_VERSION = '2.28'
22
22
 
23
23
  FORMATS = Helper.hash_with_indifferent_read_access(
24
24
  'pdf' => 'application/pdf',
@@ -9,6 +9,8 @@ module Recurly
9
9
  PAYPAL_ATTRIBUTES = %w(paypal_billing_agreement_id).freeze
10
10
  ROKU_ATTRIBUTES = %w(roku_billing_agreement_id last_four).freeze
11
11
  SEPA_ATTRIBUTES = %w(iban).freeze
12
+ BACS_ATTRIBUTES = %w(account_number sort_code type).freeze
13
+ BECS_ATTRIBUTES = %w(account_number bsb_code type).freeze
12
14
 
13
15
  # @return [Account]
14
16
  belongs_to :account
@@ -37,37 +39,44 @@ module Recurly
37
39
  fraud_session_id
38
40
  three_d_secure_action_result_token_id
39
41
  transaction_type
40
- iban
41
42
  mandate_reference
42
- ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES
43
-
44
- # @return ["credit_card", "paypal", "amazon", "bank_account", "roku", "sepa", nil] The type of billing info.
45
- attr_reader :type
43
+ ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES | BACS_ATTRIBUTES | BECS_ATTRIBUTES
46
44
 
47
45
  # @return [String]
48
46
  def inspect
49
47
  attributes = self.class.attribute_names
50
48
  case type
51
49
  when 'credit_card'
52
- attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES)
50
+ attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
53
51
  attributes |= CREDIT_CARD_ATTRIBUTES
54
52
  when 'paypal'
55
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES)
53
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
56
54
  when 'amazon'
57
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES)
55
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
58
56
  when 'bank_account'
59
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES)
57
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
60
58
  attributes |= BANK_ACCOUNT_ATTRIBUTES
61
59
  when 'roku'
62
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + SEPA_ATTRIBUTES)
60
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
63
61
  attributes |= ROKU_ATTRIBUTES
64
62
  when 'sepa'
65
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES)
63
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
66
64
  attributes |= SEPA_ATTRIBUTES
65
+ when 'bacs'
66
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BECS_ATTRIBUTES)
67
+ attributes |= BACS_ATTRIBUTES
68
+ when 'becs'
69
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES)
70
+ attributes |= BECS_ATTRIBUTES
67
71
  end
68
72
  super attributes
69
73
  end
70
74
 
75
+ # @return ["credit_card", "paypal", "amazon", "bank_account", "roku", "sepa", "bacs", "becs", nil] The type of billing info.
76
+ def type
77
+ self[:type] || @type
78
+ end
79
+
71
80
  class << self
72
81
  # Overrides the inherited member_path method to allow for billing info's
73
82
  # irregular URL structure.
@@ -110,6 +110,7 @@ module Recurly
110
110
  final_dunning_event
111
111
  gateway_code
112
112
  surcharge_in_cents
113
+ tax_details
113
114
  )
114
115
  alias to_param invoice_number_with_prefix
115
116
 
@@ -11,6 +11,8 @@ module Recurly
11
11
  accounting_code
12
12
  revenue_schedule_type
13
13
  state
14
+ avalara_transaction_type
15
+ avalara_service_type
14
16
  created_at
15
17
  updated_at
16
18
  deleted_at
@@ -32,6 +32,9 @@ module Recurly
32
32
  tax_code
33
33
  trial_requires_billing_info
34
34
  auto_renew
35
+ allow_any_item_on_subscriptions
36
+ avalara_transaction_type
37
+ avalara_service_type
35
38
  created_at
36
39
  updated_at
37
40
  )
@@ -824,9 +824,9 @@ module Recurly
824
824
 
825
825
  # Duck-typing here is problematic because of ActiveSupport's #to_xml.
826
826
  case value
827
- when Resource, Subscription::AddOns
827
+ when Resource
828
828
  value.to_xml options.merge(:builder => node)
829
- when Array
829
+ when Array, Subscription::AddOns
830
830
  value.each do |e|
831
831
  if e.is_a? Recurly::Resource
832
832
  # create a node to hold this resource
@@ -25,7 +25,12 @@ module Recurly
25
25
  def << add_on
26
26
  add_on = SubscriptionAddOn.new(add_on, @subscription)
27
27
 
28
- exist = @add_ons.find { |a| a.add_on_code == add_on.add_on_code }
28
+ exist = @add_ons.find do |a|
29
+ source1 = a.add_on_source || "plan_add_on"
30
+ source2 = add_on.add_on_source || "plan_add_on"
31
+ a.add_on_code == add_on.add_on_code && source1 == source2
32
+ end
33
+
29
34
  if exist
30
35
  exist.quantity ||= 1
31
36
  exist.quantity += add_on.quantity || 1
@@ -6,6 +6,9 @@ module Recurly
6
6
  # @return [Pager<Usage>, []]
7
7
  has_many :usage
8
8
 
9
+ # @return [[Tier], []]
10
+ has_many :tiers, class_name: :Tier, readonly: false
11
+
9
12
  define_attribute_methods %w(
10
13
  add_on_code
11
14
  quantity
@@ -13,6 +16,7 @@ module Recurly
13
16
  add_on_type
14
17
  usage_type
15
18
  usage_percentage
19
+ add_on_source
16
20
  )
17
21
 
18
22
  attr_reader :subscription
@@ -28,6 +32,10 @@ module Recurly
28
32
  if add_on.unit_amount_in_cents
29
33
  self.unit_amount_in_cents = add_on.unit_amount_in_cents.to_i
30
34
  end
35
+ if add_on.respond_to? :add_on_source
36
+ self.add_on_source = add_on.add_on_source
37
+ end
38
+ self.tiers = add_on.tiers if add_on.tiers.any?
31
39
  when Hash
32
40
  self.attributes = add_on
33
41
  when String, Symbol
@@ -7,6 +7,8 @@ module Recurly
7
7
  type
8
8
  tax_rate
9
9
  tax_in_cents
10
+ level
11
+ billable
10
12
  )
11
13
 
12
14
  embedded! true
@@ -2,12 +2,17 @@ module Recurly
2
2
  class Tier < Resource
3
3
 
4
4
  belongs_to :add_on
5
+ belongs_to :subscription_add_on
5
6
 
6
7
  define_attribute_methods %w(
7
8
  ending_quantity
8
9
  unit_amount_in_cents
9
10
  )
10
11
 
12
+ def xml_keys
13
+ attributes.keys
14
+ end
15
+
11
16
  embedded! true
12
17
  end
13
18
  end
@@ -70,6 +70,8 @@ module Recurly
70
70
  billing_country
71
71
  subscription_id
72
72
  manually_entered
73
+ avalara_transaction_type
74
+ avalara_service_type
73
75
  )
74
76
  alias to_param uuid
75
77
  alias fraud_info fraud
@@ -1,6 +1,6 @@
1
1
  module Recurly
2
2
  module Version
3
- VERSION = "2.18.8"
3
+ VERSION = "2.18.13"
4
4
 
5
5
  class << self
6
6
  def inspect
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.8
4
+ version: 2.18.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-27 00:00:00.000000000 Z
11
+ date: 2020-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri