rjmetrics-client 0.3.0 → 0.4.0
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/rjmetrics-client/client.rb +12 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjliNDE1YjI2NzUwMDc3Y2IzNGVhNmRhMjkwZDk0ZjMwZjk4NzVhMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGRhNjNjMTUzNTk3MDJkOGVkZjlhNDkzZWNhNzU5ZjA4YjRkOTlhMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmNmYWVkZGU1MTRjMTZiMTI3ZmJkY2MxMDBmZjY2MWQ3MjU4MDZmZjA3MDdl
|
10
|
+
YmRiOTkyYjY2YzJiOGFhODczOTc0ODM3MTJiNTAxZmRlNWEwMTkzN2MzMzUz
|
11
|
+
YTY0NzQ5YmE1ZDcwZjIxZjFjNjQyNGQ3NWVjNzQxNDc0Y2JiNzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTUyMGZjNTYyOGQ0MTE3YmU4YzNiMTM3NDI4NTJhOGQ4OTQyNDYxN2ExMmMy
|
14
|
+
Nzk2ODQyMTYyNzY0ZDE0NWI3MjI0OTgyZjk1NzA1N2RjZDU3NjFlNzVjYzRh
|
15
|
+
MzNiM2YyM2NhNWZkYTc4ZmRkN2RkNWMyZjY5MTE4Y2I0ZmRmYjE=
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'rest_client'
|
2
4
|
require 'json'
|
3
5
|
require 'enumerator'
|
@@ -100,9 +102,14 @@ class Client
|
|
100
102
|
)
|
101
103
|
return response
|
102
104
|
rescue RestClient::Exception => error
|
103
|
-
|
104
|
-
|
105
|
-
|
105
|
+
begin
|
106
|
+
response = JSON.parse(error.response)
|
107
|
+
raise InvalidRequestException,
|
108
|
+
"The Import API returned: #{response['code']} #{response['message']}. Reasons: #{response['reasons']}"
|
109
|
+
rescue JSON::ParserError, TypeError => e
|
110
|
+
raise InvalidResponseException,
|
111
|
+
"RestClientError: #{error.class}, With response: #{error.response}"
|
112
|
+
end
|
106
113
|
end
|
107
114
|
end
|
108
115
|
|
@@ -110,4 +117,6 @@ class Client
|
|
110
117
|
end
|
111
118
|
class InvalidRequestException < RuntimeError
|
112
119
|
end
|
120
|
+
class InvalidResponseException < RuntimeError
|
121
|
+
end
|
113
122
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rjmetrics-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|