alinta-rest-client 2.2.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.mailmap +10 -0
  4. data/.rspec +2 -0
  5. data/.rubocop +2 -0
  6. data/.rubocop-disables.yml +393 -0
  7. data/.rubocop.yml +8 -0
  8. data/.travis.yml +49 -0
  9. data/AUTHORS +106 -0
  10. data/Gemfile +11 -0
  11. data/LICENSE +21 -0
  12. data/README.md +896 -0
  13. data/Rakefile +140 -0
  14. data/bin/restclient +92 -0
  15. data/history.md +357 -0
  16. data/lib/rest-client.rb +2 -0
  17. data/lib/rest_client.rb +2 -0
  18. data/lib/restclient.rb +183 -0
  19. data/lib/restclient/abstract_response.rb +252 -0
  20. data/lib/restclient/exceptions.rb +244 -0
  21. data/lib/restclient/params_array.rb +72 -0
  22. data/lib/restclient/payload.rb +234 -0
  23. data/lib/restclient/platform.rb +49 -0
  24. data/lib/restclient/raw_response.rb +49 -0
  25. data/lib/restclient/request.rb +875 -0
  26. data/lib/restclient/resource.rb +178 -0
  27. data/lib/restclient/response.rb +90 -0
  28. data/lib/restclient/utils.rb +274 -0
  29. data/lib/restclient/version.rb +8 -0
  30. data/lib/restclient/windows.rb +8 -0
  31. data/lib/restclient/windows/root_certs.rb +105 -0
  32. data/rest-client.gemspec +32 -0
  33. data/rest-client.windows.gemspec +19 -0
  34. data/spec/ISS.jpg +0 -0
  35. data/spec/helpers.rb +54 -0
  36. data/spec/integration/_lib.rb +1 -0
  37. data/spec/integration/capath_digicert/244b5494.0 +19 -0
  38. data/spec/integration/capath_digicert/81b9768f.0 +19 -0
  39. data/spec/integration/capath_digicert/README +8 -0
  40. data/spec/integration/capath_digicert/digicert.crt +19 -0
  41. data/spec/integration/capath_verisign/415660c1.0 +14 -0
  42. data/spec/integration/capath_verisign/7651b327.0 +14 -0
  43. data/spec/integration/capath_verisign/README +8 -0
  44. data/spec/integration/capath_verisign/verisign.crt +14 -0
  45. data/spec/integration/certs/digicert.crt +19 -0
  46. data/spec/integration/certs/verisign.crt +14 -0
  47. data/spec/integration/httpbin_spec.rb +128 -0
  48. data/spec/integration/integration_spec.rb +118 -0
  49. data/spec/integration/request_spec.rb +127 -0
  50. data/spec/spec_helper.rb +29 -0
  51. data/spec/unit/_lib.rb +1 -0
  52. data/spec/unit/abstract_response_spec.rb +145 -0
  53. data/spec/unit/exceptions_spec.rb +108 -0
  54. data/spec/unit/params_array_spec.rb +36 -0
  55. data/spec/unit/payload_spec.rb +295 -0
  56. data/spec/unit/raw_response_spec.rb +22 -0
  57. data/spec/unit/request2_spec.rb +54 -0
  58. data/spec/unit/request_spec.rb +1238 -0
  59. data/spec/unit/resource_spec.rb +134 -0
  60. data/spec/unit/response_spec.rb +252 -0
  61. data/spec/unit/restclient_spec.rb +80 -0
  62. data/spec/unit/utils_spec.rb +147 -0
  63. data/spec/unit/windows/root_certs_spec.rb +22 -0
  64. metadata +318 -0
@@ -0,0 +1,147 @@
1
+ require_relative '_lib'
2
+
3
+ describe RestClient::Utils do
4
+ describe '.get_encoding_from_headers' do
5
+ it 'assumes no encoding by default for text' do
6
+ headers = {:content_type => 'text/plain'}
7
+ expect(RestClient::Utils.get_encoding_from_headers(headers)).
8
+ to eq nil
9
+ end
10
+
11
+ it 'returns nil on failures' do
12
+ expect(RestClient::Utils.get_encoding_from_headers(
13
+ {:content_type => 'blah'})).to eq nil
14
+ expect(RestClient::Utils.get_encoding_from_headers(
15
+ {})).to eq nil
16
+ expect(RestClient::Utils.get_encoding_from_headers(
17
+ {:content_type => 'foo; bar=baz'})).to eq nil
18
+ end
19
+
20
+ it 'handles various charsets' do
21
+ expect(RestClient::Utils.get_encoding_from_headers(
22
+ {:content_type => 'text/plain; charset=UTF-8'})).to eq 'UTF-8'
23
+ expect(RestClient::Utils.get_encoding_from_headers(
24
+ {:content_type => 'application/json; charset=ISO-8859-1'})).
25
+ to eq 'ISO-8859-1'
26
+ expect(RestClient::Utils.get_encoding_from_headers(
27
+ {:content_type => 'text/html; charset=windows-1251'})).
28
+ to eq 'windows-1251'
29
+
30
+ expect(RestClient::Utils.get_encoding_from_headers(
31
+ {:content_type => 'text/html; charset="UTF-16"'})).
32
+ to eq 'UTF-16'
33
+ end
34
+ end
35
+
36
+ describe '.cgi_parse_header' do
37
+ it 'parses headers', :unless => RUBY_VERSION.start_with?('2.0') do
38
+ expect(RestClient::Utils.cgi_parse_header('text/plain')).
39
+ to eq ['text/plain', {}]
40
+
41
+ expect(RestClient::Utils.cgi_parse_header('text/vnd.just.made.this.up')).
42
+ to eq ['text/vnd.just.made.this.up', {}]
43
+
44
+ expect(RestClient::Utils.cgi_parse_header('text/plain;charset=us-ascii')).
45
+ to eq ['text/plain', {'charset' => 'us-ascii'}]
46
+
47
+ expect(RestClient::Utils.cgi_parse_header('text/plain ; charset="us-ascii"')).
48
+ to eq ['text/plain', {'charset' => 'us-ascii'}]
49
+
50
+ expect(RestClient::Utils.cgi_parse_header(
51
+ 'text/plain ; charset="us-ascii"; another=opt')).
52
+ to eq ['text/plain', {'charset' => 'us-ascii', 'another' => 'opt'}]
53
+
54
+ expect(RestClient::Utils.cgi_parse_header(
55
+ 'foo/bar; filename="silly.txt"')).
56
+ to eq ['foo/bar', {'filename' => 'silly.txt'}]
57
+
58
+ expect(RestClient::Utils.cgi_parse_header(
59
+ 'foo/bar; filename="strange;name"')).
60
+ to eq ['foo/bar', {'filename' => 'strange;name'}]
61
+
62
+ expect(RestClient::Utils.cgi_parse_header(
63
+ 'foo/bar; filename="strange;name";size=123')).to eq \
64
+ ['foo/bar', {'filename' => 'strange;name', 'size' => '123'}]
65
+
66
+ expect(RestClient::Utils.cgi_parse_header(
67
+ 'foo/bar; name="files"; filename="fo\\"o;bar"')).to eq \
68
+ ['foo/bar', {'name' => 'files', 'filename' => 'fo"o;bar'}]
69
+ end
70
+ end
71
+
72
+ describe '.encode_query_string' do
73
+ it 'handles simple hashes' do
74
+ {
75
+ {foo: 123, bar: 456} => 'foo=123&bar=456',
76
+ {'foo' => 123, 'bar' => 456} => 'foo=123&bar=456',
77
+ {foo: 'abc', bar: 'one two'} => 'foo=abc&bar=one+two',
78
+ {escaped: '1+2=3'} => 'escaped=1%2B2%3D3',
79
+ {'escaped + key' => 'foo'} => 'escaped+%2B+key=foo',
80
+ }.each_pair do |input, expected|
81
+ expect(RestClient::Utils.encode_query_string(input)).to eq expected
82
+ end
83
+ end
84
+
85
+ it 'handles simple arrays' do
86
+ {
87
+ {foo: [1, 2, 3]} => 'foo[]=1&foo[]=2&foo[]=3',
88
+ {foo: %w{a b c}, bar: [1, 2, 3]} => 'foo[]=a&foo[]=b&foo[]=c&bar[]=1&bar[]=2&bar[]=3',
89
+ {foo: ['one two', 3]} => 'foo[]=one+two&foo[]=3',
90
+ {'a+b' => [1,2,3]} => 'a%2Bb[]=1&a%2Bb[]=2&a%2Bb[]=3',
91
+ }.each_pair do |input, expected|
92
+ expect(RestClient::Utils.encode_query_string(input)).to eq expected
93
+ end
94
+ end
95
+
96
+ it 'handles nested hashes' do
97
+ {
98
+ {outer: {foo: 123, bar: 456}} => 'outer[foo]=123&outer[bar]=456',
99
+ {outer: {foo: [1, 2, 3], bar: 'baz'}} => 'outer[foo][]=1&outer[foo][]=2&outer[foo][]=3&outer[bar]=baz',
100
+ }.each_pair do |input, expected|
101
+ expect(RestClient::Utils.encode_query_string(input)).to eq expected
102
+ end
103
+ end
104
+
105
+ it 'handles null and empty values' do
106
+ {
107
+ {string: '', empty: nil, list: [], hash: {}, falsey: false } =>
108
+ 'string=&empty&list&hash&falsey=false',
109
+ }.each_pair do |input, expected|
110
+ expect(RestClient::Utils.encode_query_string(input)).to eq expected
111
+ end
112
+ end
113
+
114
+ it 'handles nested nulls' do
115
+ {
116
+ {foo: {string: '', empty: nil}} => 'foo[string]=&foo[empty]',
117
+ }.each_pair do |input, expected|
118
+ expect(RestClient::Utils.encode_query_string(input)).to eq expected
119
+ end
120
+ end
121
+
122
+ it 'handles deep nesting' do
123
+ {
124
+ {coords: [{x: 1, y: 0}, {x: 2}, {x: 3}]} => 'coords[][x]=1&coords[][y]=0&coords[][x]=2&coords[][x]=3',
125
+ }.each_pair do |input, expected|
126
+ expect(RestClient::Utils.encode_query_string(input)).to eq expected
127
+ end
128
+ end
129
+
130
+ it 'handles multiple fields with the same name using ParamsArray' do
131
+ {
132
+ RestClient::ParamsArray.new([[:foo, 1], [:foo, 2], [:foo, 3]]) => 'foo=1&foo=2&foo=3',
133
+ }.each_pair do |input, expected|
134
+ expect(RestClient::Utils.encode_query_string(input)).to eq expected
135
+ end
136
+ end
137
+
138
+ it 'handles nested ParamsArrays' do
139
+ {
140
+ {foo: RestClient::ParamsArray.new([[:a, 1], [:a, 2]])} => 'foo[a]=1&foo[a]=2',
141
+ RestClient::ParamsArray.new([[:foo, {a: 1}], [:foo, {a: 2}]]) => 'foo[a]=1&foo[a]=2',
142
+ }.each_pair do |input, expected|
143
+ expect(RestClient::Utils.encode_query_string(input)).to eq expected
144
+ end
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,22 @@
1
+ require_relative '../_lib'
2
+
3
+ describe 'RestClient::Windows::RootCerts',
4
+ :if => RestClient::Platform.windows? do
5
+ let(:x509_store) { RestClient::Windows::RootCerts.instance.to_a }
6
+
7
+ it 'should return at least one X509 certificate' do
8
+ expect(x509_store.to_a.size).to be >= 1
9
+ end
10
+
11
+ it 'should return an X509 certificate with a subject' do
12
+ x509 = x509_store.first
13
+
14
+ expect(x509.subject.to_s).to match(/CN=.*/)
15
+ end
16
+
17
+ it 'should return X509 certificate objects' do
18
+ x509_store.each do |cert|
19
+ expect(cert).to be_a(OpenSSL::X509::Certificate)
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,318 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alinta-rest-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.0
5
+ platform: x64-mingw32
6
+ authors:
7
+ - REST Client Team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-30 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: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
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'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
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: '6.0'
79
+ type: :development
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: '6.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: http-accept
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 1.7.0
110
+ - - "<"
111
+ - !ruby/object:Gem::Version
112
+ version: '2.0'
113
+ type: :runtime
114
+ prerelease: false
115
+ version_requirements: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: 1.7.0
120
+ - - "<"
121
+ - !ruby/object:Gem::Version
122
+ version: '2.0'
123
+ - !ruby/object:Gem::Dependency
124
+ name: http-cookie
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 1.0.2
130
+ - - "<"
131
+ - !ruby/object:Gem::Version
132
+ version: '2.0'
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: 1.0.2
140
+ - - "<"
141
+ - !ruby/object:Gem::Version
142
+ version: '2.0'
143
+ - !ruby/object:Gem::Dependency
144
+ name: mime-types
145
+ requirement: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '1.16'
150
+ - - "<"
151
+ - !ruby/object:Gem::Version
152
+ version: '4.0'
153
+ type: :runtime
154
+ prerelease: false
155
+ version_requirements: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '1.16'
160
+ - - "<"
161
+ - !ruby/object:Gem::Version
162
+ version: '4.0'
163
+ - !ruby/object:Gem::Dependency
164
+ name: netrc
165
+ requirement: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - "~>"
168
+ - !ruby/object:Gem::Version
169
+ version: '0.8'
170
+ type: :runtime
171
+ prerelease: false
172
+ version_requirements: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - "~>"
175
+ - !ruby/object:Gem::Version
176
+ version: '0.8'
177
+ - !ruby/object:Gem::Dependency
178
+ name: alinta-ffi
179
+ requirement: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - "~>"
182
+ - !ruby/object:Gem::Version
183
+ version: '1.9'
184
+ type: :runtime
185
+ prerelease: false
186
+ version_requirements: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - "~>"
189
+ - !ruby/object:Gem::Version
190
+ version: '1.9'
191
+ description: 'A simple HTTP and REST client for Ruby, inspired by the Sinatra microframework
192
+ style of specifying actions: get, put, post, delete.'
193
+ email: discuss@rest-client.groups.io
194
+ executables:
195
+ - restclient
196
+ extensions: []
197
+ extra_rdoc_files:
198
+ - README.md
199
+ - history.md
200
+ files:
201
+ - ".gitignore"
202
+ - ".mailmap"
203
+ - ".rspec"
204
+ - ".rubocop"
205
+ - ".rubocop-disables.yml"
206
+ - ".rubocop.yml"
207
+ - ".travis.yml"
208
+ - AUTHORS
209
+ - Gemfile
210
+ - LICENSE
211
+ - README.md
212
+ - Rakefile
213
+ - bin/restclient
214
+ - history.md
215
+ - lib/rest-client.rb
216
+ - lib/rest_client.rb
217
+ - lib/restclient.rb
218
+ - lib/restclient/abstract_response.rb
219
+ - lib/restclient/exceptions.rb
220
+ - lib/restclient/params_array.rb
221
+ - lib/restclient/payload.rb
222
+ - lib/restclient/platform.rb
223
+ - lib/restclient/raw_response.rb
224
+ - lib/restclient/request.rb
225
+ - lib/restclient/resource.rb
226
+ - lib/restclient/response.rb
227
+ - lib/restclient/utils.rb
228
+ - lib/restclient/version.rb
229
+ - lib/restclient/windows.rb
230
+ - lib/restclient/windows/root_certs.rb
231
+ - rest-client.gemspec
232
+ - rest-client.windows.gemspec
233
+ - spec/ISS.jpg
234
+ - spec/helpers.rb
235
+ - spec/integration/_lib.rb
236
+ - spec/integration/capath_digicert/244b5494.0
237
+ - spec/integration/capath_digicert/81b9768f.0
238
+ - spec/integration/capath_digicert/README
239
+ - spec/integration/capath_digicert/digicert.crt
240
+ - spec/integration/capath_verisign/415660c1.0
241
+ - spec/integration/capath_verisign/7651b327.0
242
+ - spec/integration/capath_verisign/README
243
+ - spec/integration/capath_verisign/verisign.crt
244
+ - spec/integration/certs/digicert.crt
245
+ - spec/integration/certs/verisign.crt
246
+ - spec/integration/httpbin_spec.rb
247
+ - spec/integration/integration_spec.rb
248
+ - spec/integration/request_spec.rb
249
+ - spec/spec_helper.rb
250
+ - spec/unit/_lib.rb
251
+ - spec/unit/abstract_response_spec.rb
252
+ - spec/unit/exceptions_spec.rb
253
+ - spec/unit/params_array_spec.rb
254
+ - spec/unit/payload_spec.rb
255
+ - spec/unit/raw_response_spec.rb
256
+ - spec/unit/request2_spec.rb
257
+ - spec/unit/request_spec.rb
258
+ - spec/unit/resource_spec.rb
259
+ - spec/unit/response_spec.rb
260
+ - spec/unit/restclient_spec.rb
261
+ - spec/unit/utils_spec.rb
262
+ - spec/unit/windows/root_certs_spec.rb
263
+ homepage: https://github.com/rest-client/rest-client
264
+ licenses:
265
+ - MIT
266
+ metadata: {}
267
+ post_install_message:
268
+ rdoc_options: []
269
+ require_paths:
270
+ - lib
271
+ required_ruby_version: !ruby/object:Gem::Requirement
272
+ requirements:
273
+ - - ">="
274
+ - !ruby/object:Gem::Version
275
+ version: 2.0.0
276
+ required_rubygems_version: !ruby/object:Gem::Requirement
277
+ requirements:
278
+ - - ">="
279
+ - !ruby/object:Gem::Version
280
+ version: '0'
281
+ requirements: []
282
+ rubyforge_project:
283
+ rubygems_version: 2.7.3
284
+ signing_key:
285
+ specification_version: 4
286
+ summary: Simple HTTP and REST client for Ruby, inspired by microframework syntax for
287
+ specifying actions.
288
+ test_files:
289
+ - spec/ISS.jpg
290
+ - spec/helpers.rb
291
+ - spec/integration/_lib.rb
292
+ - spec/integration/capath_digicert/244b5494.0
293
+ - spec/integration/capath_digicert/81b9768f.0
294
+ - spec/integration/capath_digicert/README
295
+ - spec/integration/capath_digicert/digicert.crt
296
+ - spec/integration/capath_verisign/415660c1.0
297
+ - spec/integration/capath_verisign/7651b327.0
298
+ - spec/integration/capath_verisign/README
299
+ - spec/integration/capath_verisign/verisign.crt
300
+ - spec/integration/certs/digicert.crt
301
+ - spec/integration/certs/verisign.crt
302
+ - spec/integration/httpbin_spec.rb
303
+ - spec/integration/integration_spec.rb
304
+ - spec/integration/request_spec.rb
305
+ - spec/spec_helper.rb
306
+ - spec/unit/_lib.rb
307
+ - spec/unit/abstract_response_spec.rb
308
+ - spec/unit/exceptions_spec.rb
309
+ - spec/unit/params_array_spec.rb
310
+ - spec/unit/payload_spec.rb
311
+ - spec/unit/raw_response_spec.rb
312
+ - spec/unit/request2_spec.rb
313
+ - spec/unit/request_spec.rb
314
+ - spec/unit/resource_spec.rb
315
+ - spec/unit/response_spec.rb
316
+ - spec/unit/restclient_spec.rb
317
+ - spec/unit/utils_spec.rb
318
+ - spec/unit/windows/root_certs_spec.rb