restful_resource 1.4.0 → 1.4.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 709712fad9b584a11db8734c6de7c26ad6ae9060
|
4
|
+
data.tar.gz: 117d4d8d92144cf017c6e0bf5aa9e9f2ad96b31a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c82a341ee0ba285b130399f5792b30f065555f3a7f9c1e94fa03b83675f36a06d6089bd6ebebeae5d54a6b0739f98a5cb041e1efca4abcea8b6ce145b04ee16a
|
7
|
+
data.tar.gz: f950b007bbc8087e31b9e5cebde0620d4f7967f0316cdc9fd4b55dad957d1142400580f37bfe5f3efa34745ae7066b4da6780784223f22f7068dbb3cb7407682
|
@@ -24,13 +24,13 @@ module RestfulResource
|
|
24
24
|
|
25
25
|
class ResourceNotFound < HttpError
|
26
26
|
def message
|
27
|
-
"404 Resource Not Found"
|
27
|
+
"HTTP 404: Resource Not Found"
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
class OtherHttpError < HttpError
|
32
32
|
def message
|
33
|
-
"
|
33
|
+
"HTTP Error - Status code: #{response.status}"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -40,6 +40,12 @@ module RestfulResource
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
class Timeout < HttpError
|
44
|
+
def message
|
45
|
+
"Timeout: Service not responding"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
43
49
|
class ClientError < HttpError
|
44
50
|
def message
|
45
51
|
"There was some client error"
|
@@ -108,6 +114,8 @@ module RestfulResource
|
|
108
114
|
Response.new(body: response.body, headers: response.headers, status: response.status)
|
109
115
|
rescue Faraday::ConnectionFailed
|
110
116
|
raise
|
117
|
+
rescue Faraday::TimeoutError
|
118
|
+
raise HttpClient::Timeout.new(request)
|
111
119
|
rescue Faraday::ClientError => e
|
112
120
|
response = e.response
|
113
121
|
raise ClientError.new(request) unless response
|
@@ -111,6 +111,14 @@ describe RestfulResource::HttpClient do
|
|
111
111
|
expect { http_client(connection).get('https://localhost:3005') }.to raise_error(Faraday::ConnectionFailed)
|
112
112
|
end
|
113
113
|
|
114
|
+
it 'should raise Timeout error' do
|
115
|
+
connection = faraday_connection do |stubs|
|
116
|
+
stubs.get('https://localhost:3005') {|env| raise Faraday::TimeoutError.new(nil) }
|
117
|
+
end
|
118
|
+
|
119
|
+
expect { http_client(connection).get('https://localhost:3005') }.to raise_error(RestfulResource::HttpClient::Timeout)
|
120
|
+
end
|
121
|
+
|
114
122
|
it 'raises ClientError when a client errors with no response' do
|
115
123
|
connection = faraday_connection do |stubs|
|
116
124
|
stubs.get('https://localhost:3005') {|env| raise Faraday::ClientError.new(nil) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restful_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Santoro
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
225
|
version: '0'
|
226
226
|
requirements: []
|
227
227
|
rubyforge_project:
|
228
|
-
rubygems_version: 2.5.
|
228
|
+
rubygems_version: 2.5.2
|
229
229
|
signing_key:
|
230
230
|
specification_version: 4
|
231
231
|
summary: A simple activerecord inspired rest resource base class implemented using
|