restful_resource 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/restful_resource/http_client.rb +11 -0
- data/lib/restful_resource/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db211e69eaa5a728787f648586539ee4f2e7973f
|
4
|
+
data.tar.gz: 90b99d72f60ede0ab07d59e4ebbbd257d5c75b3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16060fe0a969d7e693ab6bc1117b601c61be1692a05cf96a2f9895d606a08d6137a334f630367f5ca215c53deaa1bade441aab17a7a65d5fb7301af2beb23a9d
|
7
|
+
data.tar.gz: 6be2ba5e9eae8c91f38b1adaa97ce291196f0fc5b0d4375653896e2ac842ffd523401647aafdfca9e4cfee0016bd9d9230e542143415059e83c98c21cab8cbe4
|
@@ -30,6 +30,16 @@ module RestfulResource
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
class ClientError < HttpError
|
34
|
+
def initalize(request)
|
35
|
+
super(request, {})
|
36
|
+
end
|
37
|
+
|
38
|
+
def message
|
39
|
+
"There was some client error"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
33
43
|
def initialize(username: nil, password: nil, logger: nil, cache_store: nil)
|
34
44
|
@client = Faraday.new do |b|
|
35
45
|
if username.present? && password.present?
|
@@ -90,6 +100,7 @@ module RestfulResource
|
|
90
100
|
raise
|
91
101
|
rescue Faraday::ClientError => e
|
92
102
|
response = e.response
|
103
|
+
raise ClientError.new(request) unless response
|
93
104
|
case response[:status]
|
94
105
|
when 404 then raise HttpClient::ResourceNotFound.new(request, response)
|
95
106
|
when 422 then raise HttpClient::UnprocessableEntity.new(request, response)
|
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.2.
|
4
|
+
version: 1.2.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: 2016-10-
|
12
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|