rest-client 1.6.7 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +14 -0
  5. data/AUTHORS +81 -0
  6. data/Gemfile +11 -0
  7. data/LICENSE +21 -0
  8. data/README.rdoc +63 -24
  9. data/Rakefile +85 -35
  10. data/bin/restclient +9 -8
  11. data/history.md +63 -1
  12. data/lib/restclient/abstract_response.rb +44 -15
  13. data/lib/restclient/exceptions.rb +20 -10
  14. data/lib/restclient/payload.rb +21 -18
  15. data/lib/restclient/platform.rb +30 -0
  16. data/lib/restclient/raw_response.rb +3 -2
  17. data/lib/restclient/request.rb +368 -63
  18. data/lib/restclient/resource.rb +3 -4
  19. data/lib/restclient/response.rb +2 -5
  20. data/lib/restclient/version.rb +7 -0
  21. data/lib/restclient/windows/root_certs.rb +105 -0
  22. data/lib/restclient/windows.rb +8 -0
  23. data/lib/restclient.rb +6 -15
  24. data/rest-client.gemspec +30 -0
  25. data/rest-client.windows.gemspec +19 -0
  26. data/spec/integration/capath_digicert/244b5494.0 +19 -0
  27. data/spec/integration/capath_digicert/81b9768f.0 +19 -0
  28. data/spec/integration/capath_digicert/README +8 -0
  29. data/spec/integration/capath_digicert/digicert.crt +19 -0
  30. data/spec/integration/capath_verisign/415660c1.0 +14 -0
  31. data/spec/integration/capath_verisign/7651b327.0 +14 -0
  32. data/spec/integration/capath_verisign/README +8 -0
  33. data/spec/integration/capath_verisign/verisign.crt +14 -0
  34. data/spec/integration/certs/digicert.crt +19 -0
  35. data/spec/{integration_spec.rb → integration/integration_spec.rb} +10 -13
  36. data/spec/integration/request_spec.rb +86 -7
  37. data/spec/spec_helper.rb +2 -0
  38. data/spec/{abstract_response_spec.rb → unit/abstract_response_spec.rb} +18 -15
  39. data/spec/{exceptions_spec.rb → unit/exceptions_spec.rb} +17 -20
  40. data/spec/unit/master_shake.jpg +0 -0
  41. data/spec/{payload_spec.rb → unit/payload_spec.rb} +42 -31
  42. data/spec/unit/raw_response_spec.rb +18 -0
  43. data/spec/{request2_spec.rb → unit/request2_spec.rb} +6 -14
  44. data/spec/unit/request_spec.rb +917 -0
  45. data/spec/{resource_spec.rb → unit/resource_spec.rb} +27 -31
  46. data/spec/{response_spec.rb → unit/response_spec.rb} +63 -57
  47. data/spec/{restclient_spec.rb → unit/restclient_spec.rb} +8 -2
  48. data/spec/unit/windows/root_certs_spec.rb +22 -0
  49. metadata +210 -112
  50. data/VERSION +0 -1
  51. data/lib/restclient/net_http_ext.rb +0 -55
  52. data/spec/base.rb +0 -16
  53. data/spec/integration/certs/equifax.crt +0 -19
  54. data/spec/master_shake.jpg +0 -0
  55. data/spec/raw_response_spec.rb +0 -17
  56. data/spec/request_spec.rb +0 -529
metadata CHANGED
@@ -1,155 +1,253 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rest-client
3
- version: !ruby/object:Gem::Version
4
- hash: 1
5
- prerelease:
6
- segments:
7
- - 1
8
- - 6
9
- - 7
10
- version: 1.6.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.8.0
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: 2011-08-24 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: mime-types
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: webmock
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :development
23
21
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.4'
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'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
27
45
  - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 47
30
- segments:
31
- - 1
32
- - 16
33
- version: "1.16"
34
- type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: webmock
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
38
49
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
42
52
  - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 57
45
- segments:
46
- - 0
47
- - 9
48
- - 1
49
- version: 0.9.1
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-doc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
50
62
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rspec
54
63
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
58
66
  - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.4.2
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '5.0'
64
79
  type: :development
65
- version_requirements: *id003
66
- description: "A simple HTTP and REST client for Ruby, inspired by the Sinatra microframework style of specifying actions: get, put, post, delete."
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 2.4.2
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: '5.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: http-cookie
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 1.0.2
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: '2.0'
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 1.0.2
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: '2.0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: mime-types
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '1.16'
116
+ - - "<"
117
+ - !ruby/object:Gem::Version
118
+ version: '3.0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '1.16'
126
+ - - "<"
127
+ - !ruby/object:Gem::Version
128
+ version: '3.0'
129
+ - !ruby/object:Gem::Dependency
130
+ name: netrc
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: '0.7'
136
+ type: :runtime
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - "~>"
141
+ - !ruby/object:Gem::Version
142
+ version: '0.7'
143
+ description: 'A simple HTTP and REST client for Ruby, inspired by the Sinatra microframework
144
+ style of specifying actions: get, put, post, delete.'
67
145
  email: rest.client@librelist.com
68
- executables:
146
+ executables:
69
147
  - restclient
70
148
  extensions: []
71
-
72
- extra_rdoc_files:
149
+ extra_rdoc_files:
73
150
  - README.rdoc
74
151
  - history.md
75
- files:
152
+ files:
153
+ - ".gitignore"
154
+ - ".rspec"
155
+ - ".travis.yml"
156
+ - AUTHORS
157
+ - Gemfile
158
+ - LICENSE
76
159
  - README.rdoc
77
160
  - Rakefile
78
- - VERSION
79
161
  - bin/restclient
162
+ - history.md
80
163
  - lib/rest-client.rb
81
164
  - lib/rest_client.rb
82
165
  - lib/restclient.rb
83
166
  - lib/restclient/abstract_response.rb
84
167
  - lib/restclient/exceptions.rb
85
- - lib/restclient/net_http_ext.rb
86
168
  - lib/restclient/payload.rb
169
+ - lib/restclient/platform.rb
87
170
  - lib/restclient/raw_response.rb
88
171
  - lib/restclient/request.rb
89
172
  - lib/restclient/resource.rb
90
173
  - lib/restclient/response.rb
91
- - spec/abstract_response_spec.rb
92
- - spec/base.rb
93
- - spec/exceptions_spec.rb
94
- - spec/integration/certs/equifax.crt
174
+ - lib/restclient/version.rb
175
+ - lib/restclient/windows.rb
176
+ - lib/restclient/windows/root_certs.rb
177
+ - rest-client.gemspec
178
+ - rest-client.windows.gemspec
179
+ - spec/integration/capath_digicert/244b5494.0
180
+ - spec/integration/capath_digicert/81b9768f.0
181
+ - spec/integration/capath_digicert/README
182
+ - spec/integration/capath_digicert/digicert.crt
183
+ - spec/integration/capath_verisign/415660c1.0
184
+ - spec/integration/capath_verisign/7651b327.0
185
+ - spec/integration/capath_verisign/README
186
+ - spec/integration/capath_verisign/verisign.crt
187
+ - spec/integration/certs/digicert.crt
95
188
  - spec/integration/certs/verisign.crt
189
+ - spec/integration/integration_spec.rb
96
190
  - spec/integration/request_spec.rb
97
- - spec/integration_spec.rb
98
- - spec/master_shake.jpg
99
- - spec/payload_spec.rb
100
- - spec/raw_response_spec.rb
101
- - spec/request2_spec.rb
102
- - spec/request_spec.rb
103
- - spec/resource_spec.rb
104
- - spec/response_spec.rb
105
- - spec/restclient_spec.rb
106
- - history.md
107
- homepage: http://github.com/archiloque/rest-client
108
- licenses: []
109
-
191
+ - spec/spec_helper.rb
192
+ - spec/unit/abstract_response_spec.rb
193
+ - spec/unit/exceptions_spec.rb
194
+ - spec/unit/master_shake.jpg
195
+ - spec/unit/payload_spec.rb
196
+ - spec/unit/raw_response_spec.rb
197
+ - spec/unit/request2_spec.rb
198
+ - spec/unit/request_spec.rb
199
+ - spec/unit/resource_spec.rb
200
+ - spec/unit/response_spec.rb
201
+ - spec/unit/restclient_spec.rb
202
+ - spec/unit/windows/root_certs_spec.rb
203
+ homepage: https://github.com/rest-client/rest-client
204
+ licenses:
205
+ - MIT
206
+ metadata: {}
110
207
  post_install_message:
111
208
  rdoc_options: []
112
-
113
- require_paths:
209
+ require_paths:
114
210
  - lib
115
- required_ruby_version: !ruby/object:Gem::Requirement
116
- none: false
117
- requirements:
211
+ required_ruby_version: !ruby/object:Gem::Requirement
212
+ requirements:
118
213
  - - ">="
119
- - !ruby/object:Gem::Version
120
- hash: 3
121
- segments:
122
- - 0
123
- version: "0"
124
- required_rubygems_version: !ruby/object:Gem::Requirement
125
- none: false
126
- requirements:
214
+ - !ruby/object:Gem::Version
215
+ version: 1.9.2
216
+ required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
127
218
  - - ">="
128
- - !ruby/object:Gem::Version
129
- hash: 3
130
- segments:
131
- - 0
132
- version: "0"
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
133
221
  requirements: []
134
-
135
222
  rubyforge_project:
136
- rubygems_version: 1.8.5
223
+ rubygems_version: 2.2.2
137
224
  signing_key:
138
- specification_version: 3
139
- summary: Simple HTTP and REST client for Ruby, inspired by microframework syntax for specifying actions.
140
- test_files:
141
- - spec/abstract_response_spec.rb
142
- - spec/base.rb
143
- - spec/exceptions_spec.rb
144
- - spec/integration/certs/equifax.crt
225
+ specification_version: 4
226
+ summary: Simple HTTP and REST client for Ruby, inspired by microframework syntax for
227
+ specifying actions.
228
+ test_files:
229
+ - spec/integration/capath_digicert/244b5494.0
230
+ - spec/integration/capath_digicert/81b9768f.0
231
+ - spec/integration/capath_digicert/README
232
+ - spec/integration/capath_digicert/digicert.crt
233
+ - spec/integration/capath_verisign/415660c1.0
234
+ - spec/integration/capath_verisign/7651b327.0
235
+ - spec/integration/capath_verisign/README
236
+ - spec/integration/capath_verisign/verisign.crt
237
+ - spec/integration/certs/digicert.crt
145
238
  - spec/integration/certs/verisign.crt
239
+ - spec/integration/integration_spec.rb
146
240
  - spec/integration/request_spec.rb
147
- - spec/integration_spec.rb
148
- - spec/master_shake.jpg
149
- - spec/payload_spec.rb
150
- - spec/raw_response_spec.rb
151
- - spec/request2_spec.rb
152
- - spec/request_spec.rb
153
- - spec/resource_spec.rb
154
- - spec/response_spec.rb
155
- - spec/restclient_spec.rb
241
+ - spec/spec_helper.rb
242
+ - spec/unit/abstract_response_spec.rb
243
+ - spec/unit/exceptions_spec.rb
244
+ - spec/unit/master_shake.jpg
245
+ - spec/unit/payload_spec.rb
246
+ - spec/unit/raw_response_spec.rb
247
+ - spec/unit/request2_spec.rb
248
+ - spec/unit/request_spec.rb
249
+ - spec/unit/resource_spec.rb
250
+ - spec/unit/response_spec.rb
251
+ - spec/unit/restclient_spec.rb
252
+ - spec/unit/windows/root_certs_spec.rb
253
+ has_rdoc:
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.6.6
@@ -1,55 +0,0 @@
1
- module Net
2
- class HTTP
3
-
4
- # Adding the patch method if it doesn't exist (rest-client issue: https://github.com/archiloque/rest-client/issues/79)
5
- if !defined?(Net::HTTP::Patch)
6
- # Code taken from this commit: https://github.com/ruby/ruby/commit/ab70e53ac3b5102d4ecbe8f38d4f76afad29d37d#lib/net/http.rb
7
- class Protocol
8
- # Sends a PATCH request to the +path+ and gets a response,
9
- # as an HTTPResponse object.
10
- def patch(path, data, initheader = nil, dest = nil, &block) # :yield: +body_segment+
11
- send_entity(path, data, initheader, dest, Patch, &block)
12
- end
13
-
14
- # Executes a request which uses a representation
15
- # and returns its body.
16
- def send_entity(path, data, initheader, dest, type, &block)
17
- res = nil
18
- request(type.new(path, initheader), data) {|r|
19
- r.read_body dest, &block
20
- res = r
21
- }
22
- unless @newimpl
23
- res.value
24
- return res, res.body
25
- end
26
- res
27
- end
28
- end
29
-
30
- class Patch < HTTPRequest
31
- METHOD = 'PATCH'
32
- REQUEST_HAS_BODY = true
33
- RESPONSE_HAS_BODY = true
34
- end
35
- end
36
-
37
- #
38
- # Replace the request method in Net::HTTP to sniff the body type
39
- # and set the stream if appropriate
40
- #
41
- # Taken from:
42
- # http://www.missiondata.com/blog/ruby/29/streaming-data-to-s3-with-ruby/
43
-
44
- alias __request__ request
45
-
46
- def request(req, body=nil, &block)
47
- if body != nil && body.respond_to?(:read)
48
- req.body_stream = body
49
- return __request__(req, nil, &block)
50
- else
51
- return __request__(req, body, &block)
52
- end
53
- end
54
- end
55
- end
data/spec/base.rb DELETED
@@ -1,16 +0,0 @@
1
- def is_ruby_19?
2
- RUBY_VERSION == '1.9.1' or RUBY_VERSION == '1.9.2'
3
- end
4
-
5
- Encoding.default_internal = Encoding.default_external = "ASCII-8BIT" if is_ruby_19?
6
-
7
- require 'rubygems'
8
- require 'spec'
9
-
10
- begin
11
- require "ruby-debug"
12
- rescue LoadError
13
- # NOP, ignore
14
- end
15
-
16
- require File.dirname(__FILE__) + '/../lib/restclient'
@@ -1,19 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
3
- UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUg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File.join( File.dirname(File.expand_path(__FILE__)), 'base')
2
-
3
- describe RestClient::RawResponse do
4
- before do
5
- @tf = mock("Tempfile", :read => "the answer is 42", :open => true)
6
- @net_http_res = mock('net http response')
7
- @response = RestClient::RawResponse.new(@tf, @net_http_res, {})
8
- end
9
-
10
- it "behaves like string" do
11
- @response.to_s.should == 'the answer is 42'
12
- end
13
-
14
- it "exposes a Tempfile" do
15
- @response.file.should == @tf
16
- end
17
- end