recurly 2.18.7 → 2.18.12

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: bfc1b1631c0eff809f13744b592123e8f4e05b171ae9f8315532878ca54d693b
4
- data.tar.gz: 36f192d5fc2a23529acd0aea8f734a8a5e3b9913a079423eb8e6e11a8c4bd001
3
+ metadata.gz: ab953ada8e18c2ebc7904cf47374fa8329fe47521bf1de9c4ca1f12ee0f2d299
4
+ data.tar.gz: e33f2df2517dcdd4451bc54d252fe213911307b100b4a068306e522c83d1f235
5
5
  SHA512:
6
- metadata.gz: ab2406a05aa914d27d05638fc52956295da64aba4f1b3e065f06312d478aeec1d080a0741490f6f283ad7cd9f6e12be804312756ef693fde6d3ea25f46569474
7
- data.tar.gz: 97916a77c38c1dbf1308971f1ef021e32266c8c6981945c4764cf09e90c2a6a11bf61d6361ca0df2332426acfc5b3305c2c73e1ae1c4bf9aeba5fb6904ee4875
6
+ metadata.gz: d004aac02856f41e91b7014053bfd62abea73cb617b2da58b7a534148f4ee1aea4fa01428af04790baf29720b0e2a8e03b71c596a04d40eced328e1c56ab642c
7
+ data.tar.gz: b147adefd992da76cbfd3ba237a5df5eed9a87750154d646623d0c49045fd269d4f905a79c49e5621179eb6c00d8c492ed98e78f71c47b76cd49f816f64bdb10
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.7'
17
+ gem 'recurly', '~> 2.18.12'
18
18
  ```
19
19
 
20
20
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -40,6 +40,7 @@ module Recurly
40
40
  require 'recurly/gift_card'
41
41
  require 'recurly/purchase'
42
42
  require 'recurly/webhook'
43
+ require 'recurly/tier'
43
44
 
44
45
  @subdomain = nil
45
46
 
@@ -2,9 +2,11 @@ module Recurly
2
2
  class AddOn < Resource
3
3
  # @return [Plan]
4
4
  belongs_to :plan
5
+ has_many :tiers, class_name: :Tier, readonly: false
5
6
 
6
7
  define_attribute_methods %w(
7
8
  add_on_code
9
+ item_code
8
10
  name
9
11
  accounting_code
10
12
  default_quantity
@@ -19,10 +21,21 @@ module Recurly
19
21
  revenue_schedule_type
20
22
  created_at
21
23
  updated_at
24
+ tier_type
25
+ avalara_service_type
26
+ avalara_transaction_type
22
27
  )
23
28
  alias to_param add_on_code
24
29
  alias quantity default_quantity
25
30
 
31
+ def changed_attributes
32
+ attrs = super
33
+ if tiers.any?(&:changed?)
34
+ attrs['tiers'] = tiers.select(&:changed?)
35
+ end
36
+ attrs
37
+ end
38
+
26
39
  # Add-ons are only writeable and readable through {Plan} instances.
27
40
  embedded!
28
41
  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.25'
21
+ RECURLY_API_VERSION = '2.28'
22
22
 
23
23
  FORMATS = Helper.hash_with_indifferent_read_access(
24
24
  'pdf' => 'application/pdf',
@@ -8,6 +8,9 @@ module Recurly
8
8
  AMAZON_ATTRIBUTES = %w(amazon_billing_agreement_id amazon_region).freeze
9
9
  PAYPAL_ATTRIBUTES = %w(paypal_billing_agreement_id).freeze
10
10
  ROKU_ATTRIBUTES = %w(roku_billing_agreement_id last_four).freeze
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
11
14
 
12
15
  # @return [Account]
13
16
  belongs_to :account
@@ -36,32 +39,44 @@ module Recurly
36
39
  fraud_session_id
37
40
  three_d_secure_action_result_token_id
38
41
  transaction_type
39
- ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES
40
-
41
- # @return ["credit_card", "paypal", "amazon", "bank_account", "roku", nil] The type of billing info.
42
- attr_reader :type
42
+ mandate_reference
43
+ ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES | BACS_ATTRIBUTES | BECS_ATTRIBUTES
43
44
 
44
45
  # @return [String]
45
46
  def inspect
46
47
  attributes = self.class.attribute_names
47
48
  case type
48
49
  when 'credit_card'
49
- attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES)
50
+ attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
50
51
  attributes |= CREDIT_CARD_ATTRIBUTES
51
52
  when 'paypal'
52
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES)
53
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
53
54
  when 'amazon'
54
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES)
55
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
55
56
  when 'bank_account'
56
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES)
57
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
57
58
  attributes |= BANK_ACCOUNT_ATTRIBUTES
58
59
  when 'roku'
59
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES)
60
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
60
61
  attributes |= ROKU_ATTRIBUTES
62
+ when 'sepa'
63
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
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
61
71
  end
62
72
  super attributes
63
73
  end
64
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
+
65
80
  class << self
66
81
  # Overrides the inherited member_path method to allow for billing info's
67
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
  )
@@ -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
@@ -13,6 +13,7 @@ module Recurly
13
13
  add_on_type
14
14
  usage_type
15
15
  usage_percentage
16
+ add_on_source
16
17
  )
17
18
 
18
19
  attr_reader :subscription
@@ -28,6 +29,9 @@ module Recurly
28
29
  if add_on.unit_amount_in_cents
29
30
  self.unit_amount_in_cents = add_on.unit_amount_in_cents.to_i
30
31
  end
32
+ if add_on.respond_to? :add_on_source
33
+ self.add_on_source = add_on.add_on_source
34
+ end
31
35
  when Hash
32
36
  self.attributes = add_on
33
37
  when String, Symbol
@@ -7,6 +7,9 @@ module Recurly
7
7
  type
8
8
  tax_rate
9
9
  tax_in_cents
10
+ level
11
+ surcharge
12
+ billable
10
13
  )
11
14
 
12
15
  embedded! true
@@ -0,0 +1,17 @@
1
+ module Recurly
2
+ class Tier < Resource
3
+
4
+ belongs_to :add_on
5
+
6
+ define_attribute_methods %w(
7
+ ending_quantity
8
+ unit_amount_in_cents
9
+ )
10
+
11
+ def xml_keys
12
+ attributes.keys
13
+ end
14
+
15
+ embedded! true
16
+ end
17
+ 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.7"
3
+ VERSION = "2.18.12"
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.7
4
+ version: 2.18.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-20 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -249,6 +249,7 @@ files:
249
249
  - lib/recurly/subscription_add_on.rb
250
250
  - lib/recurly/tax_detail.rb
251
251
  - lib/recurly/tax_type.rb
252
+ - lib/recurly/tier.rb
252
253
  - lib/recurly/transaction.rb
253
254
  - lib/recurly/transaction/errors.rb
254
255
  - lib/recurly/usage.rb