recurly 2.8.3 → 2.9.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: 5d8d608dad115469f711a1e02417114735591b0b64ce9b7cf2fdb13155ce7f6d
4
- data.tar.gz: 5e98dce7f4872d4a6ed38f8d089ccd2908b7f495ff0d6991336300cb8df90ca7
2
+ SHA1:
3
+ metadata.gz: 484c28b3c176d82de1fb1f2f25df00602ce9701f
4
+ data.tar.gz: b841ce1d8a13adc2345446df5661b4f8b5f0390e
5
5
  SHA512:
6
- metadata.gz: ae7ad01aad504251fbd34ea498b203a9d4058fc0e1aa98e80ded7c2a8b1e9b065027d152e68c5bd85cffc879d6e6baa8ec293292cf4edc1f7628890b47c19a93
7
- data.tar.gz: b5cbfb94397b2be7f0dbb1be6730985b4d095d7efa5acad1f9896b232e2dc5b519d86614b52ddd37beaa1d6c7c02bb9b6b6f3ff834448b0f28283a6f9bfdcb4e
6
+ metadata.gz: 6c7fbf56c05a64d0dc90285f56a75de6b086ffe09f9621b27d5248d9f0e2f36f5124e858a575ced4f6743bf1b5b7c7796347390b47266c53ea79c4cae563b7a5
7
+ data.tar.gz: e561799eb31ca989e9c891132919cb348553a5935b07337a6aeb0664e390e5d98cced23ef150ffd87326c5e63d978edb59ebd917cdfef4d996b11e9caeb7abcb
data/README.md CHANGED
@@ -14,13 +14,12 @@ 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.8.2'
17
+ gem 'recurly', '~> 2.9.0'
18
18
  ```
19
19
 
20
20
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
21
21
  speed boost) if it's available and loaded in your app's environment.
22
22
 
23
-
24
23
  ## Configuration
25
24
 
26
25
  If you're using Rails, you can generate an initializer with the following
@@ -90,6 +89,19 @@ Any configuration items you do not include in the above config call will be defa
90
89
  configuration items. For example if you do not define default_currency then Recurly.default_currency
91
90
  will be used.
92
91
 
92
+ ## Supported Versions
93
+
94
+ We are currently supporting versions `2.1.0` and above. `1.9` and `2.0` will still work but are deprecated.
95
+
96
+ If you are still using one of these rubies, you should know that support for them ended in
97
+ 2015 (1.9) and 2016 (2.0) and continuing to use them is a security risk.
98
+
99
+ - https://www.ruby-lang.org/en/news/2015/02/23/support-for-ruby-1-9-3-has-ended/
100
+ - https://www.ruby-lang.org/en/news/2016/02/24/support-plan-of-ruby-2-0-0-and-2-1/
101
+
102
+ For now, we are still running the tests on 1.9 and 2.0 but without `nokogiri` and only `rexml`. Nokogiri is
103
+ no longer supported on 1.9 or 2.0 and has patched known vulnerabilities since dropping support.
104
+ If you must run one of these rubies (this includes jruby1.7), you must use rexml and not nokogiri.
93
105
 
94
106
  ## Usage
95
107
 
@@ -1,6 +1,5 @@
1
1
  module Recurly
2
2
  class Address < Resource
3
-
4
3
  define_attribute_methods %w(
5
4
  address1
6
5
  address2
@@ -11,5 +10,12 @@ module Recurly
11
10
  phone
12
11
  geo_code
13
12
  )
13
+
14
+ # This ensures every attribute is rendered
15
+ # when updating. The Address object does not
16
+ # accept partial updates on the server
17
+ def xml_keys
18
+ attributes.keys
19
+ end
14
20
  end
15
21
  end
@@ -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]
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.5'
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}"
@@ -44,6 +44,19 @@ module Recurly
44
44
  # if the loaded page content has not changed.
45
45
  # @option options [String] :uri The default location the pager will
46
46
  # request.
47
+ # @option options [String, Symbol] :sort The attribute that will be used to order
48
+ # records: <tt>created_at</tt>, <tt>updated_at</tt>. Defaults to <tt>created_at</tt>.
49
+ # @option options [String, Symbol] :order The order in which records will be
50
+ # returned: <tt>asc</tt> for ascending order, <tt>desc</tt> for descending order.
51
+ # Defaults to <tt>desc</tt>.
52
+ # @option options [DateTime, String] :begin_time Operates on the attribute specified by the
53
+ # <tt>sort</tt> parameter. Filters records to only include those with datetimes
54
+ # greater than or equal to the supplied datetime. Accepts an ISO 8601
55
+ # date or date and time.
56
+ # @option options [DateTime, String] :end_time Operates on the attribute specified by
57
+ # the <tt>sort</tt> parameter. Filters records to only include those with
58
+ # datetimes less than or equal to the supplied datetime. Accepts an
59
+ # ISO 8601 date or date and time.
47
60
  # @raise [API::NotModified] If the <tt>:etag</tt> option is set and
48
61
  # matches the server's.
49
62
  def initialize resource_class, options = {}
@@ -336,8 +336,9 @@ module Recurly
336
336
  raise NotFound, "can't find a record with nil identifier"
337
337
  end
338
338
 
339
+ uri = uuid =~ /^http/ ? uuid : member_path(uuid)
339
340
  begin
340
- from_response API.get(member_path(uuid), {}, options)
341
+ from_response API.get(uri, {}, options)
341
342
  rescue API::NotFound => e
342
343
  raise NotFound, e.description
343
344
  end
@@ -460,8 +461,8 @@ module Recurly
460
461
  # parsing here or else it always serializes. Need
461
462
  # a better way of handling changed attributes
462
463
  if el.name == 'address' && val.kind_of?(Hash)
463
- address = Address.new val
464
- address.changed_attributes.clear
464
+ address = Address.new(val)
465
+ address.instance_variable_set(:@changed_attributes, {})
465
466
  record[el.name] = address
466
467
  else
467
468
  record[el.name] = val
@@ -634,12 +635,9 @@ module Recurly
634
635
  return if response.body.to_s.length.zero?
635
636
  fresh = self.class.from_response response
636
637
  else
637
- options = {:etag => (etag unless changed?)}
638
- fresh = if @href
639
- self.class.from_response API.get(@href, {}, options)
640
- else
641
- self.class.find(to_param, options)
642
- end
638
+ fresh = self.class.find(
639
+ @href || to_param, :etag => (etag unless changed?)
640
+ )
643
641
  end
644
642
  fresh and copy_from fresh
645
643
  persist! true
@@ -1,8 +1,8 @@
1
1
  module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 8
5
- PATCH = 3
4
+ MINOR = 9
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
data/lib/recurly/xml.rb CHANGED
@@ -80,7 +80,18 @@ module Recurly
80
80
  end
81
81
 
82
82
  if defined? Nokogiri
83
- require 'recurly/xml/nokogiri'
83
+ if RUBY_VERSION < "2.1.0"
84
+ raise <<-MSG
85
+
86
+ You are attempting to use an insecure version of
87
+ nokogiri on an insecure version of ruby. Please see
88
+ the documentation on supported versions for more information:
89
+ https://github.com/recurly/recurly-client-ruby#supported-versions
90
+
91
+ MSG
92
+ else
93
+ require 'recurly/xml/nokogiri'
94
+ end
84
95
  else
85
96
  require 'recurly/xml/rexml'
86
97
  end
data/lib/recurly.rb CHANGED
@@ -86,8 +86,6 @@ module Recurly
86
86
  end
87
87
 
88
88
  # Assigns a logger to log requests/responses and more.
89
- # The logger can only be set if the environment variable
90
- # `RECURLY_INSECURE_DEBUG` equals `true`.
91
89
  #
92
90
  # @return [Logger, nil]
93
91
  # @example
@@ -99,22 +97,6 @@ module Recurly
99
97
  # Recurly.logger = nil # Or Recurly.logger = Logger.new nil
100
98
  attr_accessor :logger
101
99
 
102
- def logger=(logger)
103
- if ENV['RECURLY_INSECURE_DEBUG'].to_s.downcase == 'true'
104
- @logger = logger
105
- puts <<-MSG
106
- [WARNING] Recurly logger enabled. The logger has the potential to leak
107
- PII and should never be used in production environments.
108
- MSG
109
- else
110
- puts <<-MSG
111
- [WARNING] Recurly logger has been disabled. If you wish to use it,
112
- only do so in a non-production environment and make sure
113
- the `RECURLY_INSECURE_DEBUG` environment variable is set to `true`.
114
- MSG
115
- end
116
- end
117
-
118
100
  # Convenience logging method includes a Logger#progname dynamically.
119
101
  # @return [true, nil]
120
102
  def log level, message
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.8.3
4
+ version: 2.9.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: 2017-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.0
20
- type: :runtime
19
+ version: 1.7.1
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
- version: 1.6.0
26
+ version: 1.7.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.24.6
75
+ version: 2.3.2
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.24.6
82
+ version: 2.3.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: redcarpet
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  version: '0'
239
239
  requirements: []
240
240
  rubyforge_project:
241
- rubygems_version: 2.7.6
241
+ rubygems_version: 2.6.8
242
242
  signing_key:
243
243
  specification_version: 4
244
244
  summary: Recurly API Client