recurly 2.18.23 → 2.18.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/recurly/account_balance.rb +1 -0
- data/lib/recurly/add_on.rb +5 -0
- data/lib/recurly/adjustment.rb +1 -0
- data/lib/recurly/currency_percentage_tier.rb +17 -0
- data/lib/recurly/percentage_tier.rb +17 -0
- data/lib/recurly/resource.rb +11 -2
- data/lib/recurly/sub_add_on_percentage_tier.rb +17 -0
- data/lib/recurly/subscription.rb +1 -0
- data/lib/recurly/subscription_add_on.rb +5 -0
- data/lib/recurly/version.rb +1 -1
- data/lib/recurly/xml/nokogiri.rb +1 -1
- data/lib/recurly.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98504e5e8b9e9732604cbc8eaeba0b771463e0d0a5c6ec15656bb1a724b386c6
|
4
|
+
data.tar.gz: a88b8b53bc3c500ab02f71addccb5d605654705a0e32bffb5f63e6c2620d4910
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
17
|
+
gem 'recurly', '~> 2.18.24'
|
18
18
|
```
|
19
19
|
|
20
20
|
Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
|
data/lib/recurly/add_on.rb
CHANGED
@@ -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
|
data/lib/recurly/adjustment.rb
CHANGED
@@ -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
|
data/lib/recurly/resource.rb
CHANGED
@@ -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
|
758
|
-
value = Money.new(value, self, key)
|
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
|
data/lib/recurly/subscription.rb
CHANGED
@@ -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
|
data/lib/recurly/version.rb
CHANGED
data/lib/recurly/xml/nokogiri.rb
CHANGED
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.
|
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-
|
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
|