recurly 2.18.11 → 2.18.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c689b0c52f5605dec02135ba9f3cfd670e519c379e9b1e3d05b99949ccfa294
4
- data.tar.gz: 2c4d074aedac025339691373b19a03ab2e618cfde673111178a796fb413a47b8
3
+ metadata.gz: 81da082560bca542b9109eb8ae61089f33e28838f9c8b495f3cea9a37c612f5c
4
+ data.tar.gz: 2df98aa3795f057055ab8973584ab3facb05242316c8e299e7e8b88489fafa08
5
5
  SHA512:
6
- metadata.gz: 68a15832e3afcbf690f3266068caa8a85c5a3f5ab684ea900ce0f7d9f5af0705e3a540c276e1aeaf00c8935abd7c91be7f361414743e009fb1df7c33fd701029
7
- data.tar.gz: 41517c9c71fa214786e084329f4c9f75b9ac033b280c8c9a92b0d4f3400030f91d6a8fd956570b187bff0e40c9f86b0371c528661707f3896caebdb2e7f69272
6
+ metadata.gz: 206bda608a120910f408779cb21701e343b6e0d2753bfb6034555a1bae67f24966448c363772c12283a421bc21833e5c6af184a94a2de91408a0feadda6182d1
7
+ data.tar.gz: 823c10946b07e4dd80ba2a4a3152eef3a119cccc6ecf64adefcf0af0c4d0679d437ec9a652933294fba0b14e4a1f32976fe060aa365974136c192f8b6559c519
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.11'
17
+ gem 'recurly', '~> 2.18.16'
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/verify'
43
44
  require 'recurly/tier'
44
45
 
45
46
  @subdomain = nil
@@ -2,6 +2,7 @@ module Recurly
2
2
  class AddOn < Resource
3
3
  # @return [Plan]
4
4
  belongs_to :plan
5
+ # @return [[Tier], []]
5
6
  has_many :tiers, class_name: :Tier, readonly: false
6
7
 
7
8
  define_attribute_methods %w(
@@ -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.28'
21
+ RECURLY_API_VERSION = '2.29'
22
22
 
23
23
  FORMATS = Helper.hash_with_indifferent_read_access(
24
24
  'pdf' => 'application/pdf',
@@ -10,6 +10,7 @@ module Recurly
10
10
  ROKU_ATTRIBUTES = %w(roku_billing_agreement_id last_four).freeze
11
11
  SEPA_ATTRIBUTES = %w(iban).freeze
12
12
  BACS_ATTRIBUTES = %w(account_number sort_code type).freeze
13
+ BECS_ATTRIBUTES = %w(account_number bsb_code type).freeze
13
14
 
14
15
  # @return [Account]
15
16
  belongs_to :account
@@ -39,36 +40,50 @@ module Recurly
39
40
  three_d_secure_action_result_token_id
40
41
  transaction_type
41
42
  mandate_reference
42
- ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES | BACS_ATTRIBUTES
43
+ tax_identifier
44
+ tax_identifier_type
45
+ ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES | BACS_ATTRIBUTES | BECS_ATTRIBUTES
46
+
47
+ # Verify an account's stored billing info
48
+ #
49
+ # @param [Hash] gateway_code (optional) is the code for the gateway to use for verification. If unspecified, a gateway will be selected using the normal rules.
50
+ # @return [Transaction]
51
+ # @raise [Invalid] Raise if the account's billing info cannot be verified
52
+ def verify(attrs = {})
53
+ Transaction.from_response API.post("#{path}/verify", attrs.empty? ? nil : Verify.to_xml(attrs))
54
+ end
43
55
 
44
56
  # @return [String]
45
57
  def inspect
46
58
  attributes = self.class.attribute_names
47
59
  case type
48
60
  when 'credit_card'
49
- attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES)
61
+ attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
50
62
  attributes |= CREDIT_CARD_ATTRIBUTES
51
63
  when 'paypal'
52
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES)
64
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
53
65
  when 'amazon'
54
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES)
66
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
55
67
  when 'bank_account'
56
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES)
68
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
57
69
  attributes |= BANK_ACCOUNT_ATTRIBUTES
58
70
  when 'roku'
59
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES)
71
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
60
72
  attributes |= ROKU_ATTRIBUTES
61
73
  when 'sepa'
62
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + BACS_ATTRIBUTES)
74
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
63
75
  attributes |= SEPA_ATTRIBUTES
64
76
  when 'bacs'
65
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES)
77
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BECS_ATTRIBUTES)
66
78
  attributes |= BACS_ATTRIBUTES
79
+ when 'becs'
80
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES)
81
+ attributes |= BECS_ATTRIBUTES
67
82
  end
68
83
  super attributes
69
84
  end
70
85
 
71
- # @return ["credit_card", "paypal", "amazon", "bank_account", "roku", "sepa", "bacs", nil] The type of billing info.
86
+ # @return ["credit_card", "paypal", "amazon", "bank_account", "roku", "sepa", "bacs", "becs", nil] The type of billing info.
72
87
  def type
73
88
  self[:type] || @type
74
89
  end
@@ -46,6 +46,8 @@ module Recurly
46
46
  unique_template_code
47
47
  free_trial_amount
48
48
  free_trial_unit
49
+ applies_to_all_items
50
+ item_codes
49
51
  )
50
52
  alias to_param coupon_code
51
53
 
@@ -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
@@ -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
@@ -29,7 +32,10 @@ module Recurly
29
32
  if add_on.unit_amount_in_cents
30
33
  self.unit_amount_in_cents = add_on.unit_amount_in_cents.to_i
31
34
  end
32
- self.add_on_source = add_on.add_on_source
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?
33
39
  when Hash
34
40
  self.attributes = add_on
35
41
  when String, Symbol
@@ -8,7 +8,6 @@ module Recurly
8
8
  tax_rate
9
9
  tax_in_cents
10
10
  level
11
- surcharge
12
11
  billable
13
12
  )
14
13
 
@@ -2,6 +2,7 @@ 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
@@ -0,0 +1,12 @@
1
+ module Recurly
2
+ class Verify < Resource
3
+ define_attribute_methods %w(
4
+ gateway_code
5
+ )
6
+
7
+ def self.to_xml(attrs)
8
+ verify = new attrs
9
+ verify.to_xml
10
+ end
11
+ end
12
+ end
@@ -1,6 +1,6 @@
1
1
  module Recurly
2
2
  module Version
3
- VERSION = "2.18.11"
3
+ VERSION = "2.18.16"
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.11
4
+ version: 2.18.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -253,6 +253,7 @@ files:
253
253
  - lib/recurly/transaction.rb
254
254
  - lib/recurly/transaction/errors.rb
255
255
  - lib/recurly/usage.rb
256
+ - lib/recurly/verify.rb
256
257
  - lib/recurly/version.rb
257
258
  - lib/recurly/webhook.rb
258
259
  - lib/recurly/webhook/account_notification.rb
@@ -331,7 +332,7 @@ homepage: https://github.com/recurly/recurly-client-ruby
331
332
  licenses:
332
333
  - MIT
333
334
  metadata: {}
334
- post_install_message:
335
+ post_install_message:
335
336
  rdoc_options:
336
337
  - "--main"
337
338
  - README.md
@@ -349,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
350
  version: '0'
350
351
  requirements: []
351
352
  rubygems_version: 3.0.3
352
- signing_key:
353
+ signing_key:
353
354
  specification_version: 4
354
355
  summary: Recurly API Client
355
356
  test_files: []