rest 2.7.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile.lock +16 -18
- data/README.md +2 -0
- data/lib/rest.rb +3 -1
- data/lib/rest/client.rb +12 -6
- data/lib/rest/version.rb +1 -1
- data/lib/rest/wrappers/base_wrapper.rb +7 -9
- data/lib/rest/wrappers/excon_wrapper.rb +4 -4
- data/lib/rest/wrappers/internal_client/internal/abstract_response.rb +108 -0
- data/lib/rest/wrappers/internal_client/internal/exceptions.rb +194 -0
- data/lib/rest/wrappers/internal_client/internal/mimes.rb +54 -0
- data/lib/rest/wrappers/internal_client/internal/net_http_ext.rb +55 -0
- data/lib/rest/wrappers/internal_client/internal/payload.rb +237 -0
- data/lib/rest/wrappers/internal_client/internal/raw_response.rb +36 -0
- data/lib/rest/wrappers/internal_client/internal/request.rb +322 -0
- data/lib/rest/wrappers/internal_client/internal/resource.rb +173 -0
- data/lib/rest/wrappers/internal_client/internal/response.rb +28 -0
- data/lib/rest/wrappers/internal_client/internal_client.rb +177 -0
- data/lib/rest/wrappers/internal_client_wrapper.rb +127 -0
- data/rest.gemspec +4 -2
- data/test/test_base.rb +1 -1
- data/test/test_performance.rb +1 -1
- data/test/test_rest.rb +6 -4
- metadata +47 -36
data/rest.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'rest/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |gem|
|
4
6
|
gem.authors = ["Travis Reeder"]
|
@@ -16,7 +18,6 @@ Gem::Specification.new do |gem|
|
|
16
18
|
|
17
19
|
gem.required_rubygems_version = ">= 1.3.6"
|
18
20
|
gem.required_ruby_version = Gem::Requirement.new(">= 1.8")
|
19
|
-
gem.add_runtime_dependency "rest_client", ">= 1.7.1"
|
20
21
|
gem.add_runtime_dependency "net-http-persistent", ">= 2.9.1"
|
21
22
|
|
22
23
|
gem.add_development_dependency "typhoeus", ">= 0.5.4"
|
@@ -26,6 +27,7 @@ Gem::Specification.new do |gem|
|
|
26
27
|
gem.add_development_dependency "uber_config"
|
27
28
|
gem.add_development_dependency "quicky", ">= 0.4.0"
|
28
29
|
gem.add_development_dependency "excon"
|
30
|
+
gem.add_development_dependency "netrc"
|
29
31
|
|
30
32
|
end
|
31
33
|
|
data/test/test_base.rb
CHANGED
data/test/test_performance.rb
CHANGED
@@ -16,7 +16,7 @@ class TestPerformance < TestBase
|
|
16
16
|
|
17
17
|
quicky = Quicky::Timer.new
|
18
18
|
|
19
|
-
to_run = [:typhoeus, :rest_client, :net_http_persistent]
|
19
|
+
to_run = [:typhoeus, :rest_client, :net_http_persistent, :internal]
|
20
20
|
to_run.each do |gem|
|
21
21
|
run_perf(quicky, times, gem)
|
22
22
|
end
|
data/test/test_rest.rb
CHANGED
@@ -134,7 +134,7 @@ class TestRest < TestBase
|
|
134
134
|
parsed = JSON.parse(response.body)
|
135
135
|
p parsed
|
136
136
|
assert_equal body, JSON.parse(parsed['body'])
|
137
|
-
assert_equal oauth, parsed['headers']['Authorization'
|
137
|
+
assert_equal oauth, parsed['headers']['Authorization']
|
138
138
|
|
139
139
|
body2 = "hello world"
|
140
140
|
response = @rest.post("http://rest-test.iron.io/code/200?store=#{key}",
|
@@ -170,15 +170,17 @@ class TestRest < TestBase
|
|
170
170
|
|
171
171
|
res = rest.get(url, options)
|
172
172
|
|
173
|
-
puts res.body
|
173
|
+
# puts res.body
|
174
174
|
assert res.body.include?("items")
|
175
175
|
end
|
176
176
|
|
177
177
|
def test_bad_host
|
178
178
|
puts "test bad host"
|
179
179
|
# OpenDNS, YOU SUCK!
|
180
|
-
|
181
|
-
|
180
|
+
assert_raise SocketError do
|
181
|
+
r = @rest.get("http://something-that-is-not-here.com", :params=>{:q => "Rick Astley"})
|
182
|
+
p r
|
183
|
+
end
|
182
184
|
end
|
183
185
|
|
184
186
|
end
|
metadata
CHANGED
@@ -1,139 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rest_client
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ! '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.7.1
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ! '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.7.1
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: net-http-persistent
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- -
|
17
|
+
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: 2.9.1
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- -
|
24
|
+
- - ">="
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: 2.9.1
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: typhoeus
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- -
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
33
|
version: 0.5.4
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- -
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: 0.5.4
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: test-unit
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- -
|
45
|
+
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
47
|
version: '0'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- -
|
52
|
+
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: minitest
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
61
|
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rake
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - ">="
|
88
74
|
- !ruby/object:Gem::Version
|
89
75
|
version: '0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: uber_config
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- -
|
87
|
+
- - ">="
|
102
88
|
- !ruby/object:Gem::Version
|
103
89
|
version: '0'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- -
|
94
|
+
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: quicky
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: 0.4.0
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
|
-
- -
|
108
|
+
- - ">="
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: 0.4.0
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: excon
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
|
-
- -
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: netrc
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: Rest client wrapper that chooses best installed client.
|
@@ -143,7 +143,7 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
-
- .gitignore
|
146
|
+
- ".gitignore"
|
147
147
|
- Gemfile
|
148
148
|
- Gemfile.lock
|
149
149
|
- LICENSE
|
@@ -155,6 +155,17 @@ files:
|
|
155
155
|
- lib/rest/version.rb
|
156
156
|
- lib/rest/wrappers/base_wrapper.rb
|
157
157
|
- lib/rest/wrappers/excon_wrapper.rb
|
158
|
+
- lib/rest/wrappers/internal_client/internal/abstract_response.rb
|
159
|
+
- lib/rest/wrappers/internal_client/internal/exceptions.rb
|
160
|
+
- lib/rest/wrappers/internal_client/internal/mimes.rb
|
161
|
+
- lib/rest/wrappers/internal_client/internal/net_http_ext.rb
|
162
|
+
- lib/rest/wrappers/internal_client/internal/payload.rb
|
163
|
+
- lib/rest/wrappers/internal_client/internal/raw_response.rb
|
164
|
+
- lib/rest/wrappers/internal_client/internal/request.rb
|
165
|
+
- lib/rest/wrappers/internal_client/internal/resource.rb
|
166
|
+
- lib/rest/wrappers/internal_client/internal/response.rb
|
167
|
+
- lib/rest/wrappers/internal_client/internal_client.rb
|
168
|
+
- lib/rest/wrappers/internal_client_wrapper.rb
|
158
169
|
- lib/rest/wrappers/net_http_persistent_wrapper.rb
|
159
170
|
- lib/rest/wrappers/rest_client_wrapper.rb
|
160
171
|
- lib/rest/wrappers/typhoeus_wrapper.rb
|
@@ -172,17 +183,17 @@ require_paths:
|
|
172
183
|
- lib
|
173
184
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
185
|
requirements:
|
175
|
-
- -
|
186
|
+
- - ">="
|
176
187
|
- !ruby/object:Gem::Version
|
177
188
|
version: '1.8'
|
178
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
190
|
requirements:
|
180
|
-
- -
|
191
|
+
- - ">="
|
181
192
|
- !ruby/object:Gem::Version
|
182
193
|
version: 1.3.6
|
183
194
|
requirements: []
|
184
195
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
196
|
+
rubygems_version: 2.4.2
|
186
197
|
signing_key:
|
187
198
|
specification_version: 4
|
188
199
|
summary: Rest client wrapper that chooses best installed client.
|