rest-client 1.6.1 → 1.6.14

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.

Potentially problematic release.


This version of rest-client might be problematic. Click here for more details.

Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +3 -0
  5. data/AUTHORS +75 -0
  6. data/Gemfile +7 -0
  7. data/README.rdoc +52 -21
  8. data/Rakefile +15 -35
  9. data/bin/restclient +45 -39
  10. data/history.md +67 -1
  11. data/lib/restclient.rb +11 -6
  12. data/lib/restclient/abstract_response.rb +6 -2
  13. data/lib/restclient/exceptions.rb +22 -5
  14. data/lib/restclient/net_http_ext.rb +41 -7
  15. data/lib/restclient/payload.rb +28 -8
  16. data/lib/restclient/platform.rb +29 -0
  17. data/lib/restclient/request.rb +96 -36
  18. data/lib/restclient/resource.rb +17 -0
  19. data/lib/restclient/response.rb +3 -1
  20. data/lib/restclient/version.rb +7 -0
  21. data/rest-client.gemspec +26 -0
  22. data/spec/abstract_response_spec.rb +28 -10
  23. data/spec/base.rb +1 -4
  24. data/spec/exceptions_spec.rb +31 -12
  25. data/spec/integration/capath_digicert/244b5494.0 +19 -0
  26. data/spec/integration/capath_digicert/81b9768f.0 +19 -0
  27. data/spec/integration/capath_digicert/README +8 -0
  28. data/spec/integration/capath_digicert/digicert.crt +19 -0
  29. data/spec/integration/certs/digicert.crt +19 -0
  30. data/spec/integration/certs/verisign.crt +14 -14
  31. data/spec/integration/request_spec.rb +54 -4
  32. data/spec/integration_spec.rb +9 -9
  33. data/spec/master_shake.jpg +0 -0
  34. data/spec/payload_spec.rb +60 -35
  35. data/spec/raw_response_spec.rb +4 -4
  36. data/spec/request2_spec.rb +22 -4
  37. data/spec/request_spec.rb +129 -130
  38. data/spec/resource_spec.rb +30 -18
  39. data/spec/response_spec.rb +48 -36
  40. data/spec/restclient_spec.rb +6 -1
  41. metadata +142 -74
  42. data/VERSION +0 -1
  43. data/spec/integration/certs/equifax.crt +0 -19
@@ -1,7 +1,7 @@
1
1
  require File.join( File.dirname(File.expand_path(__FILE__)), 'base')
2
2
 
3
3
  require 'webmock/rspec'
4
- include WebMock
4
+ include WebMock::API
5
5
 
6
6
  describe RestClient::Resource do
7
7
  before do
@@ -14,6 +14,11 @@ describe RestClient::Resource do
14
14
  @resource.get
15
15
  end
16
16
 
17
+ it "HEAD" do
18
+ RestClient::Request.should_receive(:execute).with(:method => :head, :url => 'http://some/resource', :headers => {'X-Something' => '1'}, :user => 'jane', :password => 'mypass')
19
+ @resource.head
20
+ end
21
+
17
22
  it "POST" do
18
23
  RestClient::Request.should_receive(:execute).with(:method => :post, :url => 'http://some/resource', :payload => 'abc', :headers => {:content_type => 'image/jpg', 'X-Something' => '1'}, :user => 'jane', :password => 'mypass')
19
24
  @resource.post 'abc', :content_type => 'image/jpg'
@@ -24,6 +29,11 @@ describe RestClient::Resource do
24
29
  @resource.put 'abc', :content_type => 'image/jpg'
25
30
  end
26
31
 
32
+ it "PATCH" do
33
+ RestClient::Request.should_receive(:execute).with(:method => :patch, :url => 'http://some/resource', :payload => 'abc', :headers => {:content_type => 'image/jpg', 'X-Something' => '1'}, :user => 'jane', :password => 'mypass')
34
+ @resource.patch 'abc', :content_type => 'image/jpg'
35
+ end
36
+
27
37
  it "DELETE" do
28
38
  RestClient::Request.should_receive(:execute).with(:method => :delete, :url => 'http://some/resource', :headers => {'X-Something' => '1'}, :user => 'jane', :password => 'mypass')
29
39
  @resource.delete
@@ -41,83 +51,85 @@ describe RestClient::Resource do
41
51
 
42
52
  it "is backwards compatible with previous constructor" do
43
53
  @resource = RestClient::Resource.new('http://some/resource', 'user', 'pass')
44
- @resource.user.should == 'user'
45
- @resource.password.should == 'pass'
54
+ @resource.user.should eq 'user'
55
+ @resource.password.should eq 'pass'
46
56
  end
47
57
 
48
58
  it "concatenates urls, inserting a slash when it needs one" do
49
- @resource.concat_urls('http://example.com', 'resource').should == 'http://example.com/resource'
59
+ @resource.concat_urls('http://example.com', 'resource').should eq 'http://example.com/resource'
50
60
  end
51
61
 
52
62
  it "concatenates urls, using no slash if the first url ends with a slash" do
53
- @resource.concat_urls('http://example.com/', 'resource').should == 'http://example.com/resource'
63
+ @resource.concat_urls('http://example.com/', 'resource').should eq 'http://example.com/resource'
54
64
  end
55
65
 
56
66
  it "concatenates urls, using no slash if the second url starts with a slash" do
57
- @resource.concat_urls('http://example.com', '/resource').should == 'http://example.com/resource'
67
+ @resource.concat_urls('http://example.com', '/resource').should eq 'http://example.com/resource'
58
68
  end
59
69
 
60
70
  it "concatenates even non-string urls, :posts + 1 => 'posts/1'" do
61
- @resource.concat_urls(:posts, 1).should == 'posts/1'
71
+ @resource.concat_urls(:posts, 1).should eq 'posts/1'
62
72
  end
63
73
 
64
74
  it "offers subresources via []" do
65
75
  parent = RestClient::Resource.new('http://example.com')
66
- parent['posts'].url.should == 'http://example.com/posts'
76
+ parent['posts'].url.should eq 'http://example.com/posts'
67
77
  end
68
78
 
69
79
  it "transports options to subresources" do
70
80
  parent = RestClient::Resource.new('http://example.com', :user => 'user', :password => 'password')
71
- parent['posts'].user.should == 'user'
72
- parent['posts'].password.should == 'password'
81
+ parent['posts'].user.should eq 'user'
82
+ parent['posts'].password.should eq 'password'
73
83
  end
74
84
 
75
85
  it "passes a given block to subresources" do
76
86
  block = Proc.new{|r| r}
77
87
  parent = RestClient::Resource.new('http://example.com', &block)
78
- parent['posts'].block.should == block
88
+ parent['posts'].block.should eq block
79
89
  end
80
90
 
81
91
  it "the block should be overrideable" do
82
92
  block1 = Proc.new{|r| r}
83
93
  block2 = Proc.new{|r| r}
84
94
  parent = RestClient::Resource.new('http://example.com', &block1)
85
- # parent['posts', &block2].block.should == block2 # ruby 1.9 syntax
86
- parent.send(:[], 'posts', &block2).block.should == block2
95
+ # parent['posts', &block2].block.should eq block2 # ruby 1.9 syntax
96
+ parent.send(:[], 'posts', &block2).block.should eq block2
87
97
  end
88
98
 
89
99
  it "the block should be overrideable in ruby 1.9 syntax" do
90
100
  block = Proc.new{|r| r}
91
101
  parent = RestClient::Resource.new('http://example.com', &block)
92
102
  r19_syntax = %q{
93
- parent['posts', &->(r){r}].block.should_not == block
103
+ parent['posts', &->(r){r}].block.should_not eq block
94
104
  }
95
105
  if is_ruby_19?
96
106
  eval(r19_syntax)
107
+ else
108
+ parent.should_not be_nil
97
109
  end
98
110
  end
99
111
 
100
112
  it "prints its url with to_s" do
101
- RestClient::Resource.new('x').to_s.should == 'x'
113
+ RestClient::Resource.new('x').to_s.should eq 'x'
102
114
  end
103
115
 
104
116
  describe 'block' do
105
117
  it 'can use block when creating the resource' do
106
118
  stub_request(:get, 'www.example.com').to_return(:body => '', :status => 404)
107
119
  resource = RestClient::Resource.new('www.example.com') { |response, request| 'foo' }
108
- resource.get.should == 'foo'
120
+ resource.get.should eq 'foo'
109
121
  end
110
122
 
111
123
  it 'can use block when executing the resource' do
112
124
  stub_request(:get, 'www.example.com').to_return(:body => '', :status => 404)
113
125
  resource = RestClient::Resource.new('www.example.com')
114
- resource.get { |response, request| 'foo' }.should == 'foo'
126
+ resource.get { |response, request| 'foo' }.should eq 'foo'
115
127
  end
116
128
 
117
129
  it 'execution block override resource block' do
118
130
  stub_request(:get, 'www.example.com').to_return(:body => '', :status => 404)
119
131
  resource = RestClient::Resource.new('www.example.com') { |response, request| 'foo' }
120
- resource.get { |response, request| 'bar' }.should == 'bar'
132
+ resource.get { |response, request| 'bar' }.should eq 'bar'
121
133
  end
122
134
 
123
135
  end
@@ -1,64 +1,64 @@
1
1
  require File.join( File.dirname(File.expand_path(__FILE__)), 'base')
2
2
 
3
3
  require 'webmock/rspec'
4
- include WebMock
4
+ include WebMock::API
5
5
 
6
6
  describe RestClient::Response do
7
7
  before do
8
- @net_http_res = mock('net http response', :to_hash => {"Status" => ["200 OK"]}, :code => 200)
9
- @request = mock('http request', :user => nil, :password => nil)
8
+ @net_http_res = double('net http response', :to_hash => {"Status" => ["200 OK"]}, :code => 200)
9
+ @request = double('http request', :user => nil, :password => nil)
10
10
  @response = RestClient::Response.create('abc', @net_http_res, {})
11
11
  end
12
12
 
13
13
  it "behaves like string" do
14
- @response.should.to_s == 'abc'
15
- @response.to_str.should == 'abc'
16
- @response.to_i.should == 200
14
+ @response.to_s.should eq 'abc'
15
+ @response.to_str.should eq 'abc'
16
+ @response.to_i.should eq 200
17
17
  end
18
18
 
19
19
  it "accepts nil strings and sets it to empty for the case of HEAD" do
20
- RestClient::Response.create(nil, @net_http_res, {}).should.to_s == ""
20
+ RestClient::Response.create(nil, @net_http_res, {}).to_s.should eq ""
21
21
  end
22
22
 
23
23
  it "test headers and raw headers" do
24
- @response.raw_headers["Status"][0].should == "200 OK"
25
- @response.headers[:status].should == "200 OK"
24
+ @response.raw_headers["Status"][0].should eq "200 OK"
25
+ @response.headers[:status].should eq "200 OK"
26
26
  end
27
27
 
28
28
  describe "cookie processing" do
29
29
  it "should correctly deal with one Set-Cookie header with one cookie inside" do
30
- net_http_res = mock('net http response', :to_hash => {"etag" => ["\"e1ac1a2df945942ef4cac8116366baad\""], "set-cookie" => ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT"]})
30
+ net_http_res = double('net http response', :to_hash => {"etag" => ["\"e1ac1a2df945942ef4cac8116366baad\""], "set-cookie" => ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT"]})
31
31
  response = RestClient::Response.create('abc', net_http_res, {})
32
- response.headers[:set_cookie].should == ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT"]
33
- response.cookies.should == { "main_page" => "main_page_no_rewrite" }
32
+ response.headers[:set_cookie].should eq ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT"]
33
+ response.cookies.should eq({ "main_page" => "main_page_no_rewrite" })
34
34
  end
35
35
 
36
36
  it "should correctly deal with multiple cookies [multiple Set-Cookie headers]" do
37
- net_http_res = mock('net http response', :to_hash => {"etag" => ["\"e1ac1a2df945942ef4cac8116366baad\""], "set-cookie" => ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT", "remember_me=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT", "user=somebody; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]})
37
+ net_http_res = double('net http response', :to_hash => {"etag" => ["\"e1ac1a2df945942ef4cac8116366baad\""], "set-cookie" => ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT", "remember_me=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT", "user=somebody; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]})
38
38
  response = RestClient::Response.create('abc', net_http_res, {})
39
- response.headers[:set_cookie].should == ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT", "remember_me=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT", "user=somebody; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]
40
- response.cookies.should == {
39
+ response.headers[:set_cookie].should eq ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT", "remember_me=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT", "user=somebody; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]
40
+ response.cookies.should eq({
41
41
  "main_page" => "main_page_no_rewrite",
42
42
  "remember_me" => "",
43
43
  "user" => "somebody"
44
- }
44
+ })
45
45
  end
46
46
 
47
47
  it "should correctly deal with multiple cookies [one Set-Cookie header with multiple cookies]" do
48
- net_http_res = mock('net http response', :to_hash => {"etag" => ["\"e1ac1a2df945942ef4cac8116366baad\""], "set-cookie" => ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT, remember_me=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT, user=somebody; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]})
48
+ net_http_res = double('net http response', :to_hash => {"etag" => ["\"e1ac1a2df945942ef4cac8116366baad\""], "set-cookie" => ["main_page=main_page_no_rewrite; path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT, remember_me=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT, user=somebody; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"]})
49
49
  response = RestClient::Response.create('abc', net_http_res, {})
50
- response.cookies.should == {
50
+ response.cookies.should eq({
51
51
  "main_page" => "main_page_no_rewrite",
52
52
  "remember_me" => "",
53
53
  "user" => "somebody"
54
- }
54
+ })
55
55
  end
56
56
  end
57
57
 
58
58
  describe "exceptions processing" do
59
59
  it "should return itself for normal codes" do
60
60
  (200..206).each do |code|
61
- net_http_res = mock('net http response', :code => '200')
61
+ net_http_res = double('net http response', :code => '200')
62
62
  response = RestClient::Response.create('abc', net_http_res, {})
63
63
  response.return! @request
64
64
  end
@@ -67,7 +67,7 @@ describe RestClient::Response do
67
67
  it "should throw an exception for other codes" do
68
68
  RestClient::Exceptions::EXCEPTIONS_MAP.each_key do |code|
69
69
  unless (200..207).include? code
70
- net_http_res = mock('net http response', :code => code.to_i)
70
+ net_http_res = double('net http response', :code => code.to_i)
71
71
  response = RestClient::Response.create('abc', net_http_res, {})
72
72
  lambda { response.return!}.should raise_error
73
73
  end
@@ -77,45 +77,45 @@ describe RestClient::Response do
77
77
  end
78
78
 
79
79
  describe "redirection" do
80
-
80
+
81
81
  it "follows a redirection when the request is a get" do
82
82
  stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
83
83
  stub_request(:get, 'http://new/resource').to_return(:body => 'Foo')
84
- RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
84
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should eq 'Foo'
85
85
  end
86
86
 
87
87
  it "follows a redirection and keep the parameters" do
88
88
  stub_request(:get, 'http://foo:bar@some/resource').with(:headers => {'Accept' => 'application/json'}).to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
89
89
  stub_request(:get, 'http://foo:bar@new/resource').with(:headers => {'Accept' => 'application/json'}).to_return(:body => 'Foo')
90
- RestClient::Request.execute(:url => 'http://some/resource', :method => :get, :user => 'foo', :password => 'bar', :headers => {:accept => :json}).body.should == 'Foo'
90
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get, :user => 'foo', :password => 'bar', :headers => {:accept => :json}).body.should eq 'Foo'
91
91
  end
92
92
 
93
93
  it "follows a redirection and keep the cookies" do
94
- stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Set-Cookie' => CGI::Cookie.new('Foo', 'Bar'), 'Location' => 'http://new/resource', })
94
+ stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Set-Cookie' => 'Foo=Bar', 'Location' => 'http://new/resource', })
95
95
  stub_request(:get, 'http://new/resource').with(:headers => {'Cookie' => 'Foo=Bar'}).to_return(:body => 'Qux')
96
- RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Qux'
96
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should eq 'Qux'
97
97
  end
98
98
 
99
99
  it "doesn't follow a 301 when the request is a post" do
100
- net_http_res = mock('net http response', :code => 301)
100
+ net_http_res = double('net http response', :code => 301)
101
101
  response = RestClient::Response.create('abc', net_http_res, {:method => :post})
102
102
  lambda { response.return!(@request)}.should raise_error(RestClient::MovedPermanently)
103
103
  end
104
104
 
105
105
  it "doesn't follow a 302 when the request is a post" do
106
- net_http_res = mock('net http response', :code => 302)
106
+ net_http_res = double('net http response', :code => 302)
107
107
  response = RestClient::Response.create('abc', net_http_res, {:method => :post})
108
108
  lambda { response.return!(@request)}.should raise_error(RestClient::Found)
109
109
  end
110
110
 
111
111
  it "doesn't follow a 307 when the request is a post" do
112
- net_http_res = mock('net http response', :code => 307)
112
+ net_http_res = double('net http response', :code => 307)
113
113
  response = RestClient::Response.create('abc', net_http_res, {:method => :post})
114
114
  lambda { response.return!(@request)}.should raise_error(RestClient::TemporaryRedirect)
115
115
  end
116
116
 
117
117
  it "doesn't follow a redirection when the request is a put" do
118
- net_http_res = mock('net http response', :code => 301)
118
+ net_http_res = double('net http response', :code => 301)
119
119
  response = RestClient::Response.create('abc', net_http_res, {:method => :put})
120
120
  lambda { response.return!(@request)}.should raise_error(RestClient::MovedPermanently)
121
121
  end
@@ -123,34 +123,46 @@ describe RestClient::Response do
123
123
  it "follows a redirection when the request is a post and result is a 303" do
124
124
  stub_request(:put, 'http://some/resource').to_return(:body => '', :status => 303, :headers => {'Location' => 'http://new/resource'})
125
125
  stub_request(:get, 'http://new/resource').to_return(:body => 'Foo')
126
- RestClient::Request.execute(:url => 'http://some/resource', :method => :put).body.should == 'Foo'
126
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :put).body.should eq 'Foo'
127
127
  end
128
128
 
129
129
  it "follows a redirection when the request is a head" do
130
130
  stub_request(:head, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
131
131
  stub_request(:head, 'http://new/resource').to_return(:body => 'Foo')
132
- RestClient::Request.execute(:url => 'http://some/resource', :method => :head).body.should == 'Foo'
132
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :head).body.should eq 'Foo'
133
133
  end
134
134
 
135
135
  it "handles redirects with relative paths" do
136
136
  stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'index'})
137
137
  stub_request(:get, 'http://some/index').to_return(:body => 'Foo')
138
- RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
138
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should eq 'Foo'
139
139
  end
140
140
 
141
141
  it "handles redirects with relative path and query string" do
142
142
  stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'index?q=1'})
143
143
  stub_request(:get, 'http://some/index?q=1').to_return(:body => 'Foo')
144
- RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
144
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should eq 'Foo'
145
145
  end
146
146
 
147
147
  it "follow a redirection when the request is a get and the response is in the 30x range" do
148
148
  stub_request(:get, 'http://some/resource').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://new/resource'})
149
149
  stub_request(:get, 'http://new/resource').to_return(:body => 'Foo')
150
- RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should == 'Foo'
150
+ RestClient::Request.execute(:url => 'http://some/resource', :method => :get).body.should eq 'Foo'
151
+ end
152
+
153
+ it "follows no more than 10 redirections before raising error" do
154
+ stub_request(:get, 'http://some/redirect-1').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://some/redirect-2'})
155
+ stub_request(:get, 'http://some/redirect-2').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://some/redirect-2'})
156
+ lambda { RestClient::Request.execute(:url => 'http://some/redirect-1', :method => :get) }.should raise_error(RestClient::MaxRedirectsReached)
157
+ WebMock.should have_requested(:get, 'http://some/redirect-2').times(10)
151
158
  end
152
159
 
153
-
160
+ it "follows no more than max_redirects redirections, if specified" do
161
+ stub_request(:get, 'http://some/redirect-1').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://some/redirect-2'})
162
+ stub_request(:get, 'http://some/redirect-2').to_return(:body => '', :status => 301, :headers => {'Location' => 'http://some/redirect-2'})
163
+ lambda { RestClient::Request.execute(:url => 'http://some/redirect-1', :method => :get, :max_redirects => 5) }.should raise_error(RestClient::MaxRedirectsReached)
164
+ WebMock.should have_requested(:get, 'http://some/redirect-2').times(5)
165
+ end
154
166
  end
155
167
 
156
168
 
@@ -17,6 +17,11 @@ describe RestClient do
17
17
  RestClient.put('http://some/resource', 'payload')
18
18
  end
19
19
 
20
+ it "PATCH" do
21
+ RestClient::Request.should_receive(:execute).with(:method => :patch, :url => 'http://some/resource', :payload => 'payload', :headers => {})
22
+ RestClient.patch('http://some/resource', 'payload')
23
+ end
24
+
20
25
  it "DELETE" do
21
26
  RestClient::Request.should_receive(:execute).with(:method => :delete, :url => 'http://some/resource', :headers => {})
22
27
  RestClient.delete('http://some/resource')
@@ -58,7 +63,7 @@ describe RestClient do
58
63
 
59
64
  it "append the log to the requested filename" do
60
65
  RestClient.log = '/tmp/restclient.log'
61
- f = mock('file handle')
66
+ f = double('file handle')
62
67
  File.should_receive(:open).with('/tmp/restclient.log', 'a').and_yield(f)
63
68
  f.should_receive(:puts).with('xyz')
64
69
  RestClient.log << 'xyz'
metadata CHANGED
@@ -1,124 +1,192 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rest-client
3
- version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 6
9
- - 1
10
- version: 1.6.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.6.14
11
5
  platform: ruby
12
- authors:
13
- - Adam Wiggins
14
- - Julien Kirch
6
+ authors:
7
+ - REST Client Team
15
8
  autorequire:
16
9
  bindir: bin
17
10
  cert_chain: []
18
-
19
- date: 2010-07-24 00:00:00 +02:00
20
- default_executable: restclient
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
11
+ date: 2019-08-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
23
14
  name: mime-types
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :runtime
24
21
  prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
28
31
  - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 47
31
- segments:
32
- - 1
33
- - 16
34
- version: "1.16"
35
- type: :runtime
36
- version_requirements: *id001
37
- description: "A simple Simple HTTP and REST client for Ruby, inspired by the Sinatra microframework style of specifying actions: get, put, post, delete."
32
+ - !ruby/object:Gem::Version
33
+ version: 2.4.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.4.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: 'A simple HTTP and REST client for Ruby, inspired by the Sinatra microframework
98
+ style of specifying actions: get, put, post, delete.'
38
99
  email: rest.client@librelist.com
39
- executables:
100
+ executables:
40
101
  - restclient
41
102
  extensions: []
42
-
43
- extra_rdoc_files:
103
+ extra_rdoc_files:
44
104
  - README.rdoc
45
105
  - history.md
46
- files:
106
+ files:
107
+ - ".gitignore"
108
+ - ".rspec"
109
+ - ".travis.yml"
110
+ - AUTHORS
111
+ - Gemfile
47
112
  - README.rdoc
48
113
  - Rakefile
49
- - VERSION
50
114
  - bin/restclient
51
- - lib/rest_client.rb
115
+ - history.md
52
116
  - lib/rest-client.rb
117
+ - lib/rest_client.rb
53
118
  - lib/restclient.rb
54
- - lib/restclient/exceptions.rb
55
119
  - lib/restclient/abstract_response.rb
120
+ - lib/restclient/exceptions.rb
56
121
  - lib/restclient/net_http_ext.rb
57
122
  - lib/restclient/payload.rb
123
+ - lib/restclient/platform.rb
58
124
  - lib/restclient/raw_response.rb
59
125
  - lib/restclient/request.rb
60
126
  - lib/restclient/resource.rb
61
127
  - lib/restclient/response.rb
128
+ - lib/restclient/version.rb
129
+ - rest-client.gemspec
130
+ - spec/abstract_response_spec.rb
62
131
  - spec/base.rb
63
132
  - spec/exceptions_spec.rb
133
+ - spec/integration/capath_digicert/244b5494.0
134
+ - spec/integration/capath_digicert/81b9768f.0
135
+ - spec/integration/capath_digicert/README
136
+ - spec/integration/capath_digicert/digicert.crt
137
+ - spec/integration/certs/digicert.crt
138
+ - spec/integration/certs/verisign.crt
139
+ - spec/integration/request_spec.rb
64
140
  - spec/integration_spec.rb
65
141
  - spec/master_shake.jpg
66
- - spec/abstract_response_spec.rb
67
142
  - spec/payload_spec.rb
68
143
  - spec/raw_response_spec.rb
69
- - spec/request_spec.rb
70
144
  - spec/request2_spec.rb
145
+ - spec/request_spec.rb
71
146
  - spec/resource_spec.rb
72
147
  - spec/response_spec.rb
73
148
  - spec/restclient_spec.rb
74
- - spec/integration/certs/equifax.crt
75
- - spec/integration/certs/verisign.crt
76
- - spec/integration/request_spec.rb
77
- - history.md
78
- has_rdoc: true
79
- homepage: http://github.com/archiloque/rest-client
80
- licenses: []
81
-
149
+ homepage: https://github.com/rest-client/rest-client
150
+ licenses:
151
+ - MIT
152
+ metadata: {}
82
153
  post_install_message:
83
- rdoc_options:
84
- - --charset=UTF-8
85
- require_paths:
154
+ rdoc_options: []
155
+ require_paths:
86
156
  - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
88
- none: false
89
- requirements:
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ requirements:
90
159
  - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
94
- - 0
95
- version: "0"
96
- required_rubygems_version: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ requirements:
99
164
  - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
105
167
  requirements: []
106
-
107
- rubyforge_project: rest-client
108
- rubygems_version: 1.3.7
168
+ rubygems_version: 3.0.3
109
169
  signing_key:
110
- specification_version: 3
111
- summary: Simple REST client for Ruby, inspired by microframework syntax for specifying actions.
112
- test_files:
170
+ specification_version: 4
171
+ summary: Simple HTTP and REST client for Ruby, inspired by microframework syntax for
172
+ specifying actions.
173
+ test_files:
174
+ - spec/abstract_response_spec.rb
113
175
  - spec/base.rb
114
176
  - spec/exceptions_spec.rb
177
+ - spec/integration/capath_digicert/244b5494.0
178
+ - spec/integration/capath_digicert/81b9768f.0
179
+ - spec/integration/capath_digicert/README
180
+ - spec/integration/capath_digicert/digicert.crt
181
+ - spec/integration/certs/digicert.crt
182
+ - spec/integration/certs/verisign.crt
183
+ - spec/integration/request_spec.rb
115
184
  - spec/integration_spec.rb
116
- - spec/abstract_response_spec.rb
185
+ - spec/master_shake.jpg
117
186
  - spec/payload_spec.rb
118
187
  - spec/raw_response_spec.rb
119
- - spec/request_spec.rb
120
188
  - spec/request2_spec.rb
189
+ - spec/request_spec.rb
121
190
  - spec/resource_spec.rb
122
191
  - spec/response_spec.rb
123
192
  - spec/restclient_spec.rb
124
- - spec/integration/request_spec.rb