recurly 2.18.23 → 2.18.24

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: fd2a6275f99c0018d36fbaa9e825dc17b559ea85e7de03e0c939b36110e5f3a9
4
- data.tar.gz: a73a5a0fdc4a711e78441be22b9f3a4f5244b60214d8b9a3ec8a0f0121268d7c
3
+ metadata.gz: 98504e5e8b9e9732604cbc8eaeba0b771463e0d0a5c6ec15656bb1a724b386c6
4
+ data.tar.gz: a88b8b53bc3c500ab02f71addccb5d605654705a0e32bffb5f63e6c2620d4910
5
5
  SHA512:
6
- metadata.gz: edc527fa06b7b42d791c54b6be18625ceb2004b2e7d0f55adc092f83d0ea5a9acd4ae22953be7304007996b134f6492e828b6e41d4426e4a8c3613f7205ac18b
7
- data.tar.gz: 344b0d5627a8876373297f23d9648002a37f1897d3be6b6c8feac5021e6b07af9426f929bcf885e5ccd709d8173e53fb9d5604ed45c8b74ee0f7e284eacea8d4
6
+ metadata.gz: 0e60ca7cc8a994de67763b9063345dc86302cf5e23f90c8f7b53a2cb493c9507cac43dc0010e1305084fd9a1e8afa87d8965d95f1c11d4229c5f052bf408242c
7
+ data.tar.gz: 1c615e1d4b53acc353f85c1eb48c9a45cf71ce9846dd716a5418686479e0fc747ce5a156df09e7bde252756c76e68f033c96679044e597e0a94ad56a703fc5ab
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.23'
17
+ gem 'recurly', '~> 2.18.24'
18
18
  ```
19
19
 
20
20
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -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
@@ -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
@@ -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
@@ -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,14 @@ 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
+ end
1121
1130
  end
1122
1131
  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
@@ -72,6 +72,7 @@ module Recurly
72
72
  tax_type
73
73
  tax_region
74
74
  tax_rate
75
+ tax_inclusive
75
76
  bulk
76
77
  bank_account_authorized_at
77
78
  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
@@ -1,6 +1,6 @@
1
1
  module Recurly
2
2
  module Version
3
- VERSION = "2.18.23"
3
+ VERSION = "2.18.24"
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
@@ -45,6 +45,9 @@ module Recurly
45
45
  require 'recurly/dunning_campaign'
46
46
  require 'recurly/dunning_cycle'
47
47
  require 'recurly/invoice_template'
48
+ require 'recurly/percentage_tier'
49
+ require 'recurly/currency_percentage_tier'
50
+ require 'recurly/sub_add_on_percentage_tier'
48
51
 
49
52
  @subdomain = nil
50
53
 
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.23
4
+ version: 2.18.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-03 00:00:00.000000000 Z
11
+ date: 2022-06-21 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
@@ -155,6 +156,7 @@ files:
155
156
  - lib/recurly/measured_unit.rb
156
157
  - lib/recurly/money.rb
157
158
  - lib/recurly/note.rb
159
+ - lib/recurly/percentage_tier.rb
158
160
  - lib/recurly/plan.rb
159
161
  - lib/recurly/purchase.rb
160
162
  - lib/recurly/redemption.rb
@@ -165,6 +167,7 @@ files:
165
167
  - lib/recurly/shipping_address.rb
166
168
  - lib/recurly/shipping_fee.rb
167
169
  - lib/recurly/shipping_method.rb
170
+ - lib/recurly/sub_add_on_percentage_tier.rb
168
171
  - lib/recurly/subscription.rb
169
172
  - lib/recurly/subscription/add_ons.rb
170
173
  - lib/recurly/subscription_add_on.rb