recurly 2.5.5 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of recurly might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: bb8fbde37c70b1e64c348ce6a5fb926194de63ad57a1aa9913afd42880a8acdd
4
- data.tar.gz: 201a6232dd1570bb55191301e0bae22e1d761a3e871a15f0d39a2835b90364c1
2
+ SHA1:
3
+ metadata.gz: 5296bab34689e0ae0ec10718c784190b7997a9ff
4
+ data.tar.gz: 5c1e61a8cc48280d94b4df1e7b12bae145abefd0
5
5
  SHA512:
6
- metadata.gz: 7a220fe45b5b2a7de8d4c9d9ba18a21dc2dc2acd213fce443115f3b89b664007cb9b589ba2fded161e1ab164d9c3f1bd23cd99ed13a0dc6f92181d18ad70bc04
7
- data.tar.gz: 8010a639e611d44709d71851e71142a8f790bbf34dc139f4f355695615240393b55c28299a47cfe467c94bb82b31e0f2efc78f3e098ac5817452861953493c42
6
+ metadata.gz: f457df1f45a7483ea85ef1fc801c3fdb3843ee572ceb7c46a780a34ef9e586a691e59d3683c3e7a8142c60e4013475df9173d8969904051f5e6d5b5a0834076e
7
+ data.tar.gz: 1e93e65adc5afadc1b68574b71b6f40598556413b0789a9aca55dc203dc61ee8e94b0c6bfcfd038770a6c3e660ca7854056e69150c23a1b55f618cce61c74c66
data/README.md CHANGED
@@ -12,7 +12,7 @@ Recurly is packaged as a Ruby gem. We recommend you install it with
12
12
  [Bundler](http://gembundler.com/) by adding the following line to your Gemfile:
13
13
 
14
14
  ``` ruby
15
- gem 'recurly', '~> 2.5.4'
15
+ gem 'recurly', '~> 2.6.0'
16
16
  ```
17
17
 
18
18
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
data/lib/recurly.rb CHANGED
@@ -80,8 +80,6 @@ module Recurly
80
80
  end
81
81
 
82
82
  # Assigns a logger to log requests/responses and more.
83
- # The logger can only be set if the environment variable
84
- # `RECURLY_INSECURE_DEBUG` equals `true`.
85
83
  #
86
84
  # @return [Logger, nil]
87
85
  # @example
@@ -93,22 +91,6 @@ module Recurly
93
91
  # Recurly.logger = nil # Or Recurly.logger = Logger.new nil
94
92
  attr_accessor :logger
95
93
 
96
- def logger=(logger)
97
- if ENV['RECURLY_INSECURE_DEBUG'].to_s.downcase == 'true'
98
- @logger = logger
99
- puts <<-MSG
100
- [WARNING] Recurly logger enabled. The logger has the potential to leak
101
- PII and should never be used in production environments.
102
- MSG
103
- else
104
- puts <<-MSG
105
- [WARNING] Recurly logger has been disabled. If you wish to use it,
106
- only do so in a non-production environment and make sure
107
- the `RECURLY_INSECURE_DEBUG` environment variable is set to `true`.
108
- MSG
109
- end
110
- end
111
-
112
94
  # Convenience logging method includes a Logger#progname dynamically.
113
95
  # @return [true, nil]
114
96
  def log level, message
@@ -74,6 +74,14 @@ module Recurly
74
74
  true
75
75
  end
76
76
 
77
+ def changed_attributes
78
+ attrs = super
79
+ if address && address.changed?
80
+ attrs['address'] = address
81
+ end
82
+ attrs
83
+ end
84
+
77
85
  private
78
86
 
79
87
  def xml_keys
data/lib/recurly/api.rb CHANGED
@@ -15,7 +15,6 @@ module Recurly
15
15
  require 'recurly/api/errors'
16
16
 
17
17
  @@base_uri = "https://api.recurly.com/v2/"
18
- @@valid_domains = [".recurly.com"]
19
18
 
20
19
  RECURLY_API_VERSION = '2.2'
21
20
 
@@ -76,13 +75,6 @@ module Recurly
76
75
  URI.parse @@base_uri.sub('api', Recurly.subdomain)
77
76
  end
78
77
 
79
- def validate_uri!(uri)
80
- domain = @@valid_domains.detect { |d| uri.host.end_with?(d) }
81
- unless domain
82
- raise ArgumentError, "URI #{uri} is invalid. You may only make requests to a Recurly domain."
83
- end
84
- end
85
-
86
78
  # @return [String]
87
79
  def user_agent
88
80
  "Recurly/#{Version}; #{RUBY_DESCRIPTION}"
@@ -43,7 +43,6 @@ module Recurly
43
43
  }
44
44
  uri += "?#{pairs.join '&'}"
45
45
  end
46
- self.validate_uri!(uri)
47
46
  request = METHODS[method].new uri.request_uri, head
48
47
  request.basic_auth(*[Recurly.api_key, nil].flatten[0, 2])
49
48
  if options[:body]
@@ -4,6 +4,7 @@ module Recurly
4
4
  CREDIT_CARD_ATTRIBUTES = %w(number verification_value card_type year month first_six last_four).freeze
5
5
  AMAZON_ATTRIBUTES = %w(amazon_billing_agreement_id).freeze
6
6
  PAYPAL_ATTRIBUTES = %w(paypal_billing_agreement_id).freeze
7
+ ROKU_ATTRIBUTES = %w(roku_billing_agreement_id last_four).freeze
7
8
 
8
9
  # @return [Account]
9
10
  belongs_to :account
@@ -24,9 +25,9 @@ module Recurly
24
25
  ip_address_country
25
26
  token_id
26
27
  currency
27
- ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES
28
+ ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES
28
29
 
29
- # @return ["credit_card", "paypal", "amazon", "bank_account", nil] The type of billing info.
30
+ # @return ["credit_card", "paypal", "amazon", "bank_account", "roku", nil] The type of billing info.
30
31
  attr_reader :type
31
32
 
32
33
  # @return [String]
@@ -34,15 +35,18 @@ module Recurly
34
35
  attributes = self.class.attribute_names
35
36
  case type
36
37
  when 'credit_card'
37
- attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES)
38
+ attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES)
38
39
  attributes |= CREDIT_CARD_ATTRIBUTES
39
40
  when 'paypal'
40
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES)
41
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES)
41
42
  when 'amazon'
42
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES)
43
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES)
43
44
  when 'bank_account'
44
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES)
45
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES)
45
46
  attributes |= BANK_ACCOUNT_ATTRIBUTES
47
+ when 'roku'
48
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES)
49
+ attributes |= ROKU_ATTRIBUTES
46
50
  end
47
51
  super attributes
48
52
  end
@@ -40,6 +40,8 @@ module Recurly
40
40
  redemption_resource
41
41
  coupon_type
42
42
  unique_template_code
43
+ free_trial_amount
44
+ free_trial_unit
43
45
  )
44
46
  alias to_param coupon_code
45
47
 
@@ -328,8 +328,9 @@ module Recurly
328
328
  raise NotFound, "can't find a record with nil identifier"
329
329
  end
330
330
 
331
+ uri = uuid =~ /^http/ ? uuid : member_path(uuid)
331
332
  begin
332
- from_response API.get(member_path(uuid), {}, options)
333
+ from_response API.get(uri, {}, options)
333
334
  rescue API::NotFound => e
334
335
  raise NotFound, e.description
335
336
  end
@@ -436,7 +437,9 @@ module Recurly
436
437
  else
437
438
  val = XML.cast(el)
438
439
  if 'address' == el.name && val.kind_of?(Hash)
439
- record[el.name] = Address.new val
440
+ address = Address.new val
441
+ address.instance_variable_set(:@changed_attributes, {})
442
+ record[el.name] = address
440
443
  else
441
444
  record[el.name] = val
442
445
  end
@@ -607,12 +610,9 @@ module Recurly
607
610
  return if response.body.to_s.length.zero?
608
611
  fresh = self.class.from_response response
609
612
  else
610
- options = {:etag => (etag unless changed?)}
611
- fresh = if @href
612
- self.class.from_response API.get(@href, {}, options)
613
- else
614
- self.class.find(to_param, options)
615
- end
613
+ fresh = self.class.find(
614
+ @href || to_param, :etag => (etag unless changed?)
615
+ )
616
616
  end
617
617
  fresh and copy_from fresh
618
618
  persist! true
@@ -210,8 +210,30 @@ module Recurly
210
210
  true
211
211
  end
212
212
 
213
+ # Overrides the behavior of `update_attributes` in Resource class so ensure
214
+ # all attributes are marked as dirty if the plan code changes
215
+ def update_attributes attributes = {}
216
+ clear_attributes_if_plan_code_changed attributes
217
+ super
218
+ end
219
+
220
+ def update_attributes! attributes = {}
221
+ clear_attributes_if_plan_code_changed attributes
222
+ super
223
+ end
224
+
213
225
  def signable_attributes
214
226
  super.merge :plan_code => plan_code
215
227
  end
228
+
229
+ private
230
+
231
+ def clear_attributes_if_plan_code_changed attributes
232
+ if attributes[:plan_code] != plan_code
233
+ attributes.each do |key, value|
234
+ self.attributes[key.to_s] = nil
235
+ end
236
+ end
237
+ end
216
238
  end
217
239
  end
@@ -47,8 +47,10 @@ module Recurly
47
47
  tax_exempt
48
48
  tax_code
49
49
  accounting_code
50
+ fraud
50
51
  )
51
52
  alias to_param uuid
53
+ alias fraud_info fraud
52
54
 
53
55
  def self.to_xml(attrs)
54
56
  transaction = new attrs
@@ -1,8 +1,8 @@
1
1
  module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 5
5
- PATCH = 5
4
+ MINOR = 6
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.5
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-09 00:00:00.000000000 Z
11
+ date: 2016-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '11.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '11.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '5.8'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: webmock
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.24'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.24'
55
55
  description: 'An API client library for Recurly: http://recurly.com'
@@ -60,20 +60,17 @@ extensions: []
60
60
  extra_rdoc_files:
61
61
  - README.md
62
62
  files:
63
- - README.md
64
- - bin/recurly
65
63
  - lib/ecurly.rb
66
64
  - lib/rails/generators/recurly/config_generator.rb
67
65
  - lib/rails/recurly.rb
68
- - lib/recurly.rb
69
66
  - lib/recurly/account.rb
70
67
  - lib/recurly/add_on.rb
71
68
  - lib/recurly/address.rb
72
69
  - lib/recurly/adjustment.rb
73
70
  - lib/recurly/all.rb
74
- - lib/recurly/api.rb
75
71
  - lib/recurly/api/errors.rb
76
72
  - lib/recurly/api/net_http_adapter.rb
73
+ - lib/recurly/api.rb
77
74
  - lib/recurly/billing_info.rb
78
75
  - lib/recurly/coupon.rb
79
76
  - lib/recurly/error.rb
@@ -84,19 +81,18 @@ files:
84
81
  - lib/recurly/money.rb
85
82
  - lib/recurly/plan.rb
86
83
  - lib/recurly/redemption.rb
87
- - lib/recurly/resource.rb
88
84
  - lib/recurly/resource/association.rb
89
85
  - lib/recurly/resource/errors.rb
90
86
  - lib/recurly/resource/pager.rb
91
- - lib/recurly/subscription.rb
87
+ - lib/recurly/resource.rb
92
88
  - lib/recurly/subscription/add_ons.rb
89
+ - lib/recurly/subscription.rb
93
90
  - lib/recurly/subscription_add_on.rb
94
91
  - lib/recurly/tax_detail.rb
95
- - lib/recurly/transaction.rb
96
92
  - lib/recurly/transaction/errors.rb
93
+ - lib/recurly/transaction.rb
97
94
  - lib/recurly/usage.rb
98
95
  - lib/recurly/version.rb
99
- - lib/recurly/webhook.rb
100
96
  - lib/recurly/webhook/account_notification.rb
101
97
  - lib/recurly/webhook/billing_info_updated_notification.rb
102
98
  - lib/recurly/webhook/canceled_account_notification.rb
@@ -121,33 +117,38 @@ files:
121
117
  - lib/recurly/webhook/transaction_notification.rb
122
118
  - lib/recurly/webhook/updated_subscription_notification.rb
123
119
  - lib/recurly/webhook/void_payment_notification.rb
124
- - lib/recurly/xml.rb
120
+ - lib/recurly/webhook.rb
125
121
  - lib/recurly/xml/nokogiri.rb
126
122
  - lib/recurly/xml/rexml.rb
123
+ - lib/recurly/xml.rb
124
+ - lib/recurly.rb
125
+ - README.md
126
+ - bin/recurly
127
127
  homepage: https://github.com/recurly/recurly-client-ruby
128
128
  licenses:
129
129
  - MIT
130
130
  metadata: {}
131
131
  post_install_message:
132
132
  rdoc_options:
133
- - "--main"
133
+ - --main
134
134
  - README.md
135
135
  require_paths:
136
136
  - lib
137
137
  required_ruby_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - ">="
139
+ - - '>='
140
140
  - !ruby/object:Gem::Version
141
141
  version: 1.9.3
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ">="
144
+ - - '>='
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
148
  rubyforge_project:
149
- rubygems_version: 2.7.6
149
+ rubygems_version: 2.0.14.1
150
150
  signing_key:
151
151
  specification_version: 4
152
152
  summary: Recurly API Client
153
153
  test_files: []
154
+ has_rdoc: true