restify 0.1.1.1.b20 → 0.1.1.1.b22
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.
- checksums.yaml +8 -8
- data/lib/restify/adapter.rb +9 -24
- data/lib/restify/client.rb +5 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmU3OTMyNjA1OTU3NjFlNTc1ODY2MDIzOTE3MjhhNzA5ZDk1MzdlYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjZiMDg0ZTYyZTJmMTQ0YTJlYjc1NDBiNTAwZjM1YmJhODE2MGRlZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTlhMWRhOTM5ODNiYzZlMzk3MmE3YTEwZmI1OTM2OGRlZTNiMWVlNjUwZmVi
|
10
|
+
NzYyMWJhYmYyMzBkZTdmOGJlYTBhNGI3YzYxZjIxNTYyZmQyM2UwYTczNGRh
|
11
|
+
OGIzMzYyZGI5YmFhNjQyOTE1YWM2MTRkYzc3NjYwZWM5YjdjZTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWFjNjc0YWY0ZjJmMWYwMzRlMzA0ZTlkNjFiYmJhN2VkYmIwZjcwOWVlZjBh
|
14
|
+
MGJhNjQ5ZTNiYjBiY2JiMGY2ZmFlZTEwN2Q4OTYzMjYzNDUxODIzODM0NDZl
|
15
|
+
ZGQzY2UxNTJmMzgwNTY3MGE3ZDk0YTYyNzllMTU2ODIzNGNjOTM=
|
data/lib/restify/adapter.rb
CHANGED
@@ -20,8 +20,7 @@ module Restify
|
|
20
20
|
attr_reader :origin
|
21
21
|
|
22
22
|
def initialize(origin)
|
23
|
-
@origin
|
24
|
-
@pipeline = true
|
23
|
+
@origin = origin
|
25
24
|
end
|
26
25
|
|
27
26
|
def requests
|
@@ -37,14 +36,10 @@ module Restify
|
|
37
36
|
@connection ||= EventMachine::HttpRequest.new(origin)
|
38
37
|
end
|
39
38
|
|
40
|
-
def pipeline?
|
41
|
-
@pipeline
|
42
|
-
end
|
43
|
-
|
44
39
|
def process_next
|
45
40
|
return if requests.empty?
|
46
41
|
|
47
|
-
request, writer =
|
42
|
+
request, writer = requests.first
|
48
43
|
req = connection.send request.method.downcase,
|
49
44
|
keepalive: true,
|
50
45
|
redirects: 3,
|
@@ -53,11 +48,8 @@ module Restify
|
|
53
48
|
body: request.body,
|
54
49
|
head: request.headers
|
55
50
|
|
56
|
-
# puts "REQUEST: #{request} #{pipeline? ? 'w/' : 'w/o'} pipelining"
|
57
|
-
|
58
51
|
req.callback do
|
59
|
-
|
60
|
-
requests.shift unless pipeline?
|
52
|
+
requests.shift
|
61
53
|
|
62
54
|
writer.fulfill Response.new(
|
63
55
|
request,
|
@@ -75,21 +67,14 @@ module Restify
|
|
75
67
|
end
|
76
68
|
|
77
69
|
req.errback do
|
78
|
-
|
70
|
+
requests.shift
|
79
71
|
@connection = nil
|
80
72
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
else
|
87
|
-
begin
|
88
|
-
raise RuntimeError.new \
|
89
|
-
"(#{req.response_header.status}) #{req.error}"
|
90
|
-
rescue => e
|
91
|
-
writer.reject e
|
92
|
-
end
|
73
|
+
begin
|
74
|
+
raise RuntimeError.new \
|
75
|
+
"(#{req.response_header.status}) #{req.error}"
|
76
|
+
rescue => e
|
77
|
+
writer.reject e
|
93
78
|
end
|
94
79
|
end
|
95
80
|
end
|
data/lib/restify/client.rb
CHANGED
@@ -35,7 +35,11 @@ module Restify
|
|
35
35
|
# such a thing otherwise it returns nil.
|
36
36
|
#
|
37
37
|
def errors
|
38
|
-
|
38
|
+
if response.decoded_body
|
39
|
+
response.decoded_body['errors'] || response.decoded_body[:errors]
|
40
|
+
else
|
41
|
+
response.body
|
42
|
+
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1.1.
|
4
|
+
version: 0.1.1.1.b22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: obligation
|
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
version: 1.3.1
|
162
162
|
requirements: []
|
163
163
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.4.1
|
165
165
|
signing_key:
|
166
166
|
specification_version: 4
|
167
167
|
summary: An experimental hypermedia REST client.
|