recurly 2.2.3 → 2.2.4

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NjhkNmMyMGU5YjU3YWFhNTI4MjU1NGU1YzRjZjJiYzJmMzdkNTA5ZA==
5
- data.tar.gz: !binary |-
6
- MjdjMmM5OGU4MGE0NjFlMmIzMDkxZTAxYTlmNjE4ODc5NTAzYmY3OQ==
2
+ SHA1:
3
+ metadata.gz: ab34994a1c9c447dfadd88e6a57ca425ea9e260e
4
+ data.tar.gz: 1dad0cdd579adde8eeba75f613b9393e578e7609
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NGVlOTllNWEwZjdmZjI4OWY0MmExYjc3YWY3NzVkNDRjNjY4YzdlNmQzOTVm
10
- ZWIzYzk0ZTA4OWM4ZDVmODIyYTM1NTVjNDA0NmQyZWU4ZThlNDViNjdhZjQ2
11
- NzFkZDE0OTFkMWY2MmExYzgyNTk5NGUwMDM4ZTg1MmYzNWI1NDU=
12
- data.tar.gz: !binary |-
13
- NDJiNzlkNTYxMTc2YmViOWJhNGNmNjI0MGQyY2QxZjQxNmJmM2M2Yjk5ZDgx
14
- NDE0Y2FmMzIzZGFkZTdiYzUzYzJkNGYyMGI0M2I3OGIxZGYxMzc1MDZlMjYx
15
- ZThhOGQ0OWNiMTI0NzA0ZTQ0MjY5OTJlYmRjZWU4MmI0ZDNiZWI=
6
+ metadata.gz: 2b8e90a4bb40f8ae9b90bf64ff8d905eed197ef9c06b4e38b5c5fa74cdb63f1732f3e0e70c25c66389569852dc952efaf395ff95496d93fa3873fa4b6fcb019d
7
+ data.tar.gz: 1f989840edba57d172d368766b35d51cd5979da1b3475d924d73d408c60ed3d605ab2c04a11175710159676b48dc1c1312f021ddf5fc9ebe19913cde378d2413
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.2.3'
15
+ gem 'recurly', '~> 2.2.4'
16
16
  ```
17
17
 
18
18
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
data/lib/recurly/api.rb CHANGED
@@ -15,6 +15,7 @@ module Recurly
15
15
  require 'recurly/api/errors'
16
16
 
17
17
  @@base_uri = "https://api.recurly.com/v2/"
18
+ @@valid_domains = [".recurly.com"]
18
19
 
19
20
  FORMATS = Helper.hash_with_indifferent_read_access(
20
21
  'pdf' => 'application/pdf',
@@ -73,6 +74,13 @@ module Recurly
73
74
  URI.parse @@base_uri.sub('api', Recurly.subdomain)
74
75
  end
75
76
 
77
+ def validate_uri!(uri)
78
+ domain = @@valid_domains.detect { |d| uri.host.end_with?(d) }
79
+ unless domain
80
+ raise ArgumentError, "URI #{uri} is invalid. You may only make requests to a Recurly domain."
81
+ end
82
+ end
83
+
76
84
  # @return [String]
77
85
  def user_agent
78
86
  "Recurly/#{Version}; #{RUBY_DESCRIPTION}"
@@ -36,13 +36,14 @@ module Recurly
36
36
  head = headers.dup
37
37
  head.update options[:head] if options[:head]
38
38
  head.delete_if { |_, value| value.nil? }
39
- uri = base_uri + URI.escape(uri)
39
+ uri = base_uri + uri
40
40
  if options[:params] && !options[:params].empty?
41
41
  pairs = options[:params].map { |key, value|
42
42
  "#{CGI.escape key.to_s}=#{CGI.escape value.to_s}"
43
43
  }
44
44
  uri += "?#{pairs.join '&'}"
45
45
  end
46
+ self.validate_uri!(uri)
46
47
  request = METHODS[method].new uri.request_uri, head
47
48
  request.basic_auth(*[Recurly.api_key, nil].flatten[0, 2])
48
49
  if options[:body]
@@ -1,4 +1,5 @@
1
1
  require 'date'
2
+ require 'erb'
2
3
 
3
4
  module Recurly
4
5
  # The base class for all Recurly resources (e.g. {Account}, {Subscription},
@@ -184,6 +185,7 @@ module Recurly
184
185
  # Recurly::Account.member_path "code" # => "accounts/code"
185
186
  # Recurly::Account.member_path nil # => "accounts"
186
187
  def member_path uuid
188
+ uuid = ERB::Util.url_encode(uuid) if uuid
187
189
  [collection_path, uuid].compact.join '/'
188
190
  end
189
191
 
@@ -319,9 +321,8 @@ module Recurly
319
321
  raise NotFound, "can't find a record with nil identifier"
320
322
  end
321
323
 
322
- uri = uuid =~ /^http/ ? uuid : member_path(uuid)
323
324
  begin
324
- from_response API.get(uri, {}, options)
325
+ from_response API.get(member_path(uuid), {}, options)
325
326
  rescue API::NotFound => e
326
327
  raise NotFound, e.description
327
328
  end
@@ -2,7 +2,7 @@ module Recurly
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 2
5
- PATCH = 3
5
+ PATCH = 4
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
metadata CHANGED
@@ -1,58 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-09 00:00:00.000000000 Z
11
+ date: 2017-11-08 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: 0.9.2
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: 0.9.2
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: 2.6.1
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: 2.6.1
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.7.6
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.7.6
55
- description: ! 'An API client library for Recurly: http://recurly.com'
55
+ description: 'An API client library for Recurly: http://recurly.com'
56
56
  email: support@recurly.com
57
57
  executables:
58
58
  - recurly
@@ -100,25 +100,24 @@ licenses:
100
100
  metadata: {}
101
101
  post_install_message:
102
102
  rdoc_options:
103
- - --main
103
+ - "--main"
104
104
  - README.md
105
105
  require_paths:
106
106
  - lib
107
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ! '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: 1.9.3
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ! '>='
114
+ - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.2.2
119
+ rubygems_version: 2.6.13
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Recurly API Client
123
123
  test_files: []
124
- has_rdoc: true