recurly 2.18.22 → 2.18.25

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: 89370fbc69e2a1dc5dc317f45c0b3be37fad9b22d7fd0186416312f6cdfbe68c
4
- data.tar.gz: 34a070a7121166d2e810bbf27313d792e657f681c74ce9139938e52cc4924f85
3
+ metadata.gz: e839992756de200d39aeea7db58e3dd1827be4461867ee88f0de37780be0319c
4
+ data.tar.gz: 7eb0158dcb3f59d3c43c1ed2e716b38d1e1675ac740779ab950c34a7eff252d5
5
5
  SHA512:
6
- metadata.gz: a56882820ac3dd3cc339e5d9e0d23ab3d17c425754199f6ed7e39b8cddb75ab5c4760a5ccc4b948552f85005ce8ea1256b5e4dd29bd57747bc7e5b2476081e71
7
- data.tar.gz: 89dde5248e08a6f9b2d521df965c5de159fd73d5e96518a8d4e78e878de50b44f464aebbef0aaf3aa493622bb1919de18f7ab48b98bae29615267a0575688152
6
+ metadata.gz: 4da7d36ac2cb946b79e38fd6b68802f25d3e183612bd09671ecf3949158dfcea411d77809ed5b09030a60867d330535da097bede92324c24b622fc0bb89071ec
7
+ data.tar.gz: 91ea3f84276470d86bebe852ae7fbc254f50b02ff72ec11dad5847aeb000e4b379320c49e75bd7c18fc4df0e11f711fee55c2aaed406ebe3c3e5d11c7e0d8186
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.22'
17
+ gem 'recurly', '~> 2.18.25'
18
18
  ```
19
19
 
20
20
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -57,6 +57,9 @@ module Recurly
57
57
  # @return [AccountAcquisition, nil]
58
58
  has_one :account_acquisition, class_name: :AccountAcquisition, readonly: false
59
59
 
60
+ # @return [InvoiceTemplate, nil]
61
+ belongs_to :invoice_template, class_name: :InvoiceTemplate, readonly: true
62
+
60
63
  # Get's the first redemption given a coupon code
61
64
  # @deprecated Use #{redemptions} instead
62
65
  # @param coupon_code [String] The coupon code for the redemption
@@ -96,6 +99,7 @@ module Recurly
96
99
  preferred_locale
97
100
  transaction_type
98
101
  dunning_campaign_id
102
+ invoice_template_uuid
99
103
  )
100
104
  alias to_param account_code
101
105
 
@@ -11,6 +11,7 @@ module Recurly
11
11
  define_attribute_methods %w(
12
12
  past_due
13
13
  balance_in_cents
14
+ processing_prepayment_balance_in_cents
14
15
  )
15
16
 
16
17
  # This object does not represent a model on the server side
@@ -4,6 +4,8 @@ module Recurly
4
4
  belongs_to :plan
5
5
  # @return [[Tier], []]
6
6
  has_many :tiers, class_name: :Tier, readonly: false
7
+ # @return [[PercentageTier], []]
8
+ has_many :percentage_tiers, class_name: :CurrencyPercentageTier, readonly: false
7
9
 
8
10
  define_attribute_methods %w(
9
11
  add_on_code
@@ -24,6 +26,7 @@ module Recurly
24
26
  created_at
25
27
  updated_at
26
28
  tier_type
29
+ usage_timeframe
27
30
  external_sku
28
31
  avalara_service_type
29
32
  avalara_transaction_type
@@ -35,6 +38,8 @@ module Recurly
35
38
  attrs = super
36
39
  if tiers.any?(&:changed?)
37
40
  attrs['tiers'] = tiers.select(&:changed?)
41
+ elsif percentage_tiers.any?(&:changed?)
42
+ attrs['percentage_tiers'] = percentage_tiers.select(&:changed?)
38
43
  end
39
44
  attrs
40
45
  end
@@ -51,6 +51,7 @@ module Recurly
51
51
  tax_region
52
52
  tax_rate
53
53
  tax_exempt
54
+ tax_inclusive
54
55
  tax_code
55
56
  tax_details
56
57
  tax_types
@@ -61,6 +62,7 @@ module Recurly
61
62
  surcharge_in_cents
62
63
  avalara_transaction_type
63
64
  avalara_service_type
65
+ refundable_total_in_cents
64
66
  )
65
67
  alias to_param uuid
66
68
 
@@ -11,6 +11,7 @@ module Recurly
11
11
  SEPA_ATTRIBUTES = %w(iban last_two).freeze
12
12
  BACS_ATTRIBUTES = %w(account_number sort_code type).freeze
13
13
  BECS_ATTRIBUTES = %w(account_number bsb_code type).freeze
14
+ VENMO_ATTRIBUTES = %w(username).freeze
14
15
 
15
16
  # @return [Account]
16
17
  belongs_to :account
@@ -46,7 +47,8 @@ module Recurly
46
47
  primary_payment_method
47
48
  backup_payment_method
48
49
  cc_bin_country
49
- ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES | BACS_ATTRIBUTES | BECS_ATTRIBUTES
50
+ online_banking_payment_type
51
+ ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES | BACS_ATTRIBUTES | BECS_ATTRIBUTES | VENMO_ATTRIBUTES
50
52
 
51
53
  # Verify an account's stored billing info
52
54
  #
@@ -62,27 +64,30 @@ module Recurly
62
64
  attributes = self.class.attribute_names
63
65
  case type
64
66
  when 'credit_card'
65
- attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
67
+ attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
66
68
  attributes |= CREDIT_CARD_ATTRIBUTES
67
69
  when 'paypal'
68
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
70
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
69
71
  when 'amazon'
70
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
72
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
71
73
  when 'bank_account'
72
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
74
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
73
75
  attributes |= BANK_ACCOUNT_ATTRIBUTES
74
76
  when 'roku'
75
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
77
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
76
78
  attributes |= ROKU_ATTRIBUTES
77
79
  when 'sepa'
78
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
80
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
79
81
  attributes |= SEPA_ATTRIBUTES
80
82
  when 'bacs'
81
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BECS_ATTRIBUTES)
83
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
82
84
  attributes |= BACS_ATTRIBUTES
83
85
  when 'becs'
84
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES)
86
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + VENMO_ATTRIBUTES)
85
87
  attributes |= BECS_ATTRIBUTES
88
+ when 'venmo'
89
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
90
+ attributes |= VENMO_ATTRIBUTES
86
91
  end
87
92
  super attributes
88
93
  end
@@ -0,0 +1,17 @@
1
+ module Recurly
2
+ class CurrencyPercentageTier < Resource
3
+
4
+ belongs_to :add_on
5
+ has_many :tiers, class_name: :PercentageTier, readonly: false
6
+
7
+ define_attribute_methods %w(
8
+ currency
9
+ )
10
+
11
+ def xml_keys
12
+ attributes.keys
13
+ end
14
+
15
+ embedded! true
16
+ end
17
+ end
@@ -116,6 +116,7 @@ module Recurly
116
116
  tax_details
117
117
  billing_info_uuid
118
118
  dunning_campaign_id
119
+ refundable_total_in_cents
119
120
  )
120
121
  alias to_param invoice_number_with_prefix
121
122
 
@@ -0,0 +1,14 @@
1
+ module Recurly
2
+ class InvoiceTemplate < Resource
3
+ has_many :accounts, class_name: :Account, readonly: true
4
+
5
+ define_attribute_methods %w(
6
+ uuid
7
+ name
8
+ code
9
+ description
10
+ created_at
11
+ updated_at
12
+ )
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ module Recurly
2
+ class PercentageTier < Resource
3
+
4
+ belongs_to :currency_percentage_tier
5
+
6
+ define_attribute_methods %w(
7
+ ending_amount_in_cents
8
+ usage_percentage
9
+ )
10
+
11
+ def xml_keys
12
+ attributes.keys
13
+ end
14
+
15
+ embedded! true
16
+ end
17
+ end
data/lib/recurly/plan.rb CHANGED
@@ -4,6 +4,9 @@ module Recurly
4
4
  # @return [Pager<AddOn>, []]
5
5
  has_many :add_ons
6
6
 
7
+ # @return [[PlanRampInterval], nil]
8
+ has_many :ramp_intervals, class_name: :PlanRampInterval
9
+
7
10
  define_attribute_methods %w(
8
11
  plan_code
9
12
  name
@@ -21,6 +24,8 @@ module Recurly
21
24
  unit_amount_in_cents
22
25
  plan_interval_length
23
26
  plan_interval_unit
27
+ pricing_model
28
+ ramp_intervals
24
29
  trial_interval_length
25
30
  trial_interval_unit
26
31
  total_billing_cycles
@@ -0,0 +1,10 @@
1
+ module Recurly
2
+ class PlanRampInterval < Resource
3
+ belongs_to :plan
4
+
5
+ define_attribute_methods %w(
6
+ starting_billing_cycle
7
+ unit_amount_in_cents
8
+ )
9
+ end
10
+ end
@@ -754,8 +754,8 @@ module Recurly
754
754
  if association
755
755
  value = fetch_associated(key, value)
756
756
  # FIXME: More explicit; less magic.
757
- elsif value && key.end_with?('_in_cents') && !respond_to?(:currency)
758
- value = Money.new(value, self, key) unless value.is_a?(Money)
757
+ elsif add_money_tag?(key, value)
758
+ value = Money.new(value, self, key)
759
759
  end
760
760
 
761
761
  attributes[key] = value
@@ -1118,5 +1118,15 @@ module Recurly
1118
1118
  def xml_keys
1119
1119
  changed_attributes.keys.sort
1120
1120
  end
1121
+
1122
+ def add_money_tag?(key, value)
1123
+ value &&
1124
+ key.end_with?('_in_cents') &&
1125
+ !respond_to?(:currency) &&
1126
+ !value.is_a?(Money) &&
1127
+ !is_a?(PercentageTier)&&
1128
+ !is_a?(SubAddOnPercentageTier)&&
1129
+ !is_a?(SubscriptionRampInterval)
1130
+ end
1121
1131
  end
1122
1132
  end
@@ -0,0 +1,17 @@
1
+ module Recurly
2
+ class SubAddOnPercentageTier < Resource
3
+
4
+ belongs_to :subscription_add_on
5
+
6
+ define_attribute_methods %w(
7
+ ending_amount_in_cents
8
+ usage_percentage
9
+ )
10
+
11
+ def xml_keys
12
+ attributes.keys
13
+ end
14
+
15
+ embedded! true
16
+ end
17
+ end
@@ -23,6 +23,9 @@ module Recurly
23
23
  # @return [[CustomField], []]
24
24
  has_many :custom_fields, class_name: :CustomField, readonly: false
25
25
 
26
+ # @return [[SubscriptionRampInterval], nil]
27
+ has_many :ramp_intervals, class_name: :SubscriptionRampInterval
28
+
26
29
  # @return [Account]
27
30
  belongs_to :account
28
31
 
@@ -63,6 +66,7 @@ module Recurly
63
66
  subscription_add_ons
64
67
  coupon_code
65
68
  coupon_codes
69
+ ramp_intervals
66
70
  total_billing_cycles
67
71
  remaining_billing_cycles
68
72
  net_terms
@@ -72,6 +76,7 @@ module Recurly
72
76
  tax_type
73
77
  tax_region
74
78
  tax_rate
79
+ tax_inclusive
75
80
  bulk
76
81
  bank_account_authorized_at
77
82
  terms_and_conditions
@@ -9,6 +9,9 @@ module Recurly
9
9
  # @return [[Tier], []]
10
10
  has_many :tiers, class_name: :Tier, readonly: false
11
11
 
12
+ # @return [[PercentageTier], []]
13
+ has_many :percentage_tiers, class_name: :SubAddOnPercentageTier, readonly: false
14
+
12
15
  define_attribute_methods %w(
13
16
  add_on_code
14
17
  quantity
@@ -16,6 +19,7 @@ module Recurly
16
19
  add_on_type
17
20
  usage_type
18
21
  usage_percentage
22
+ usage_timeframe
19
23
  add_on_source
20
24
  )
21
25
 
@@ -36,6 +40,7 @@ module Recurly
36
40
  self.add_on_source = add_on.add_on_source
37
41
  end
38
42
  self.tiers = add_on.tiers if add_on.tiers.any?
43
+ self.percentage_tiers = add_on.percentage_tiers if add_on.percentage_tiers.any?
39
44
  when Hash
40
45
  self.attributes = add_on
41
46
  when String, Symbol
@@ -0,0 +1,10 @@
1
+ module Recurly
2
+ class SubscriptionRampInterval < Resource
3
+ belongs_to :subscription
4
+
5
+ define_attribute_methods %w(
6
+ starting_billing_cycle
7
+ unit_amount_in_cents
8
+ )
9
+ end
10
+ end
@@ -1,6 +1,6 @@
1
1
  module Recurly
2
2
  module Version
3
- VERSION = "2.18.22"
3
+ VERSION = "2.18.25"
4
4
 
5
5
  class << self
6
6
  def inspect
@@ -8,7 +8,7 @@ module Recurly
8
8
  end
9
9
 
10
10
  def add_element name, value = nil
11
- root.add_child(node = ::Nokogiri::XML::Element.new(name, root))
11
+ root.add_child(node = ::Nokogiri::XML::Element.new(name, root.document))
12
12
  node << value if value
13
13
  node
14
14
  end
data/lib/recurly.rb CHANGED
@@ -27,11 +27,13 @@ module Recurly
27
27
  require 'recurly/measured_unit'
28
28
  require 'recurly/note'
29
29
  require 'recurly/plan'
30
+ require 'recurly/plan_ramp_interval'
30
31
  require 'recurly/redemption'
31
32
  require 'recurly/shipping_fee'
32
33
  require 'recurly/shipping_method'
33
34
  require 'recurly/subscription'
34
35
  require 'recurly/subscription_add_on'
36
+ require 'recurly/subscription_ramp_interval'
35
37
  require 'recurly/transaction'
36
38
  require 'recurly/usage'
37
39
  require 'recurly/version'
@@ -44,6 +46,10 @@ module Recurly
44
46
  require 'recurly/tier'
45
47
  require 'recurly/dunning_campaign'
46
48
  require 'recurly/dunning_cycle'
49
+ require 'recurly/invoice_template'
50
+ require 'recurly/percentage_tier'
51
+ require 'recurly/currency_percentage_tier'
52
+ require 'recurly/sub_add_on_percentage_tier'
47
53
 
48
54
  @subdomain = nil
49
55
 
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.22
4
+ version: 2.18.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-27 00:00:00.000000000 Z
11
+ date: 2022-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -139,6 +139,7 @@ files:
139
139
  - lib/recurly/billing_info.rb
140
140
  - lib/recurly/coupon.rb
141
141
  - lib/recurly/credit_payment.rb
142
+ - lib/recurly/currency_percentage_tier.rb
142
143
  - lib/recurly/custom_field.rb
143
144
  - lib/recurly/delivery.rb
144
145
  - lib/recurly/dunning_campaign.rb
@@ -148,13 +149,16 @@ files:
148
149
  - lib/recurly/helper.rb
149
150
  - lib/recurly/invoice.rb
150
151
  - lib/recurly/invoice_collection.rb
152
+ - lib/recurly/invoice_template.rb
151
153
  - lib/recurly/item.rb
152
154
  - lib/recurly/js.rb
153
155
  - lib/recurly/juris_detail.rb
154
156
  - lib/recurly/measured_unit.rb
155
157
  - lib/recurly/money.rb
156
158
  - lib/recurly/note.rb
159
+ - lib/recurly/percentage_tier.rb
157
160
  - lib/recurly/plan.rb
161
+ - lib/recurly/plan_ramp_interval.rb
158
162
  - lib/recurly/purchase.rb
159
163
  - lib/recurly/redemption.rb
160
164
  - lib/recurly/resource.rb
@@ -164,9 +168,11 @@ files:
164
168
  - lib/recurly/shipping_address.rb
165
169
  - lib/recurly/shipping_fee.rb
166
170
  - lib/recurly/shipping_method.rb
171
+ - lib/recurly/sub_add_on_percentage_tier.rb
167
172
  - lib/recurly/subscription.rb
168
173
  - lib/recurly/subscription/add_ons.rb
169
174
  - lib/recurly/subscription_add_on.rb
175
+ - lib/recurly/subscription_ramp_interval.rb
170
176
  - lib/recurly/tax_detail.rb
171
177
  - lib/recurly/tax_type.rb
172
178
  - lib/recurly/tier.rb