recurly 2.1.9 → 2.1.10

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
2
  SHA1:
3
- metadata.gz: 76c75b95cb4d9280613f61c55faf3be2cf8aadb1
4
- data.tar.gz: ac7e65d2b87a4b2a19f2fb04ec4b966123e9d11a
3
+ metadata.gz: 12853807c04655302f78fb9b87992d4f992593b6
4
+ data.tar.gz: f5696cc8f9df986d54246fbe19d0e2fd0a7e811b
5
5
  SHA512:
6
- metadata.gz: f1f9d6af15f90d289ce4d5b93f0bdbe1574bccca26cc63a5a05e207b1647e4a4b4be11110e60b9f3dd73db2156552f3ad1aa3b352b7c854cb2dac09bb6d172e8
7
- data.tar.gz: 05c18c6c4c0972aa0f43612150e1f79227f1427ce1b040063ff0c818f6339f62960b083088797096ebec8d5c480581330fd4208a6d475eef17732b5fa7ee777a
6
+ metadata.gz: 7d4858275495cde312e387918ae21479d4729ab681cf8e60d206af13b488f03db41ea27c93f51835815e44939f42e9f1e548f5cdc6b805ac80d49ac4fbb16119
7
+ data.tar.gz: 0c38e035af4367919685481359ecd5017ff614da9fb155863381798d1a07717809bcf11c1b42cd7a0589fc1d1afedbc92b6569e315862a387e95b316c3bdceed
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 = 1
5
- PATCH = 9
5
+ PATCH = 10
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.1.9
4
+ version: 2.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-04 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
55
  description: 'An API client library for Recurly: http://recurly.com'
@@ -60,16 +60,19 @@ extensions: []
60
60
  extra_rdoc_files:
61
61
  - README.markdown
62
62
  files:
63
+ - README.markdown
64
+ - bin/recurly
63
65
  - lib/ecurly.rb
64
66
  - lib/rails/generators/recurly/config_generator.rb
65
67
  - lib/rails/recurly.rb
68
+ - lib/recurly.rb
66
69
  - lib/recurly/account.rb
67
70
  - lib/recurly/add_on.rb
68
71
  - lib/recurly/adjustment.rb
69
72
  - lib/recurly/all.rb
73
+ - lib/recurly/api.rb
70
74
  - lib/recurly/api/errors.rb
71
75
  - lib/recurly/api/net_http_adapter.rb
72
- - lib/recurly/api.rb
73
76
  - lib/recurly/billing_info.rb
74
77
  - lib/recurly/coupon.rb
75
78
  - lib/recurly/helper.rb
@@ -78,44 +81,41 @@ files:
78
81
  - lib/recurly/money.rb
79
82
  - lib/recurly/plan.rb
80
83
  - lib/recurly/redemption.rb
84
+ - lib/recurly/resource.rb
81
85
  - lib/recurly/resource/errors.rb
82
86
  - lib/recurly/resource/pager.rb
83
- - lib/recurly/resource.rb
84
- - lib/recurly/subscription/add_ons.rb
85
87
  - lib/recurly/subscription.rb
88
+ - lib/recurly/subscription/add_ons.rb
86
89
  - lib/recurly/subscription_add_on.rb
87
- - lib/recurly/transaction/errors.rb
88
90
  - lib/recurly/transaction.rb
91
+ - lib/recurly/transaction/errors.rb
89
92
  - lib/recurly/version.rb
93
+ - lib/recurly/xml.rb
90
94
  - lib/recurly/xml/nokogiri.rb
91
95
  - lib/recurly/xml/rexml.rb
92
- - lib/recurly/xml.rb
93
- - lib/recurly.rb
94
- - README.markdown
95
- - bin/recurly
96
96
  homepage: https://github.com/recurly/recurly-client-ruby
97
97
  licenses:
98
98
  - MIT
99
99
  metadata: {}
100
100
  post_install_message:
101
101
  rdoc_options:
102
- - --main
102
+ - "--main"
103
103
  - README.markdown
104
104
  require_paths:
105
105
  - lib
106
106
  required_ruby_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - '>='
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  requirements: []
117
117
  rubyforge_project:
118
- rubygems_version: 2.0.2
118
+ rubygems_version: 2.6.13
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Recurly API Client