trustedsearch 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +1 -0
- data/lib/trustedsearch.rb +1 -0
- data/lib/trustedsearch/api_resource.rb +2 -2
- data/lib/trustedsearch/errors/api_mock_response.rb +9 -0
- data/lib/trustedsearch/errors/error.rb +13 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzIwYjM3NGI5ZjAxYWNiNzFhYjIwNmYzN2QyMGFmODYzYTE0MjVlMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDk1ZmQwMjU3MDc4YmM5NTI5MWI5NDA2M2JlZjFiOGY3MzdiZWU3Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2I1Y2EzYmRkNmQ4NWYxNWQ3NGUwOTgyMjllZDUyYTU4YzQ2OGNkNDYzYjFk
|
10
|
+
ZmRiMjYyYzVjYzQwNDkwYTA0MjkzODcwOGFhNTZkMzQwZGVlZmU2ZjFjOTQ2
|
11
|
+
ZjA0MzMzMDIxMmQ0YWY2YzdkMTZlZTI1NDZlMTdmYzRjMmZhMGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTU0MTU2MjgxOWI5MDE0ZDljOTYzZjVmMzg2ZGJkMTRlNDNhZmEzYjAwOTI0
|
14
|
+
ZjM4Y2ViYWMwODIyMjJmYWU0NzFmY2ViYjQyMzUxMzU3MTBlODhhZGE2NDc0
|
15
|
+
MGNkYTA5NGQyN2I0OTJkMjQ5YmNjNmNlY2RlNDA3NTM3ODJlOWQ=
|
data/README.md
CHANGED
data/lib/trustedsearch.rb
CHANGED
@@ -18,6 +18,7 @@ require_relative "trustedsearch/v2/hooks"
|
|
18
18
|
require_relative "trustedsearch/v2/hook_subscriptions"
|
19
19
|
|
20
20
|
require_relative "trustedsearch/errors/error"
|
21
|
+
require_relative "trustedsearch/errors/api_mock_response"
|
21
22
|
require_relative "trustedsearch/errors/authentication_error"
|
22
23
|
require_relative "trustedsearch/errors/connection_error"
|
23
24
|
require_relative "trustedsearch/errors/invalid_request_error"
|
@@ -141,7 +141,6 @@ module TrustedSearch
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
-
|
145
144
|
def request(method='get', resource_url, params, body)
|
146
145
|
#puts resource_url
|
147
146
|
#puts params.to_json
|
@@ -161,7 +160,8 @@ module TrustedSearch
|
|
161
160
|
end
|
162
161
|
|
163
162
|
rescue Timeout::Error
|
164
|
-
|
163
|
+
connection_response = ApiMockResponse.new("Timeout error (#{timeout}s)", nil, 500)
|
164
|
+
raise ConnectionError.new(connection_response)
|
165
165
|
end
|
166
166
|
process(response)
|
167
167
|
end
|
@@ -4,8 +4,19 @@ module TrustedSearch
|
|
4
4
|
|
5
5
|
def initialize(response = nil, code = nil )
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
@message = ''
|
8
|
+
body = ''
|
9
|
+
if(response.respond_to?("message"))
|
10
|
+
@message = response.message.to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
if(response.respond_to?("body") && (response.body != nil))
|
14
|
+
body = JSON.parse(response.body.to_s)
|
15
|
+
# Use API message instead of exception message for more detail about issue when possible.
|
16
|
+
if(body.key?('message'))
|
17
|
+
@message = body['message']
|
18
|
+
end
|
19
|
+
end
|
9
20
|
@code = code
|
10
21
|
@body = body
|
11
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trustedsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- trustedSEARCH Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/trustedsearch/api.rb
|
152
152
|
- lib/trustedsearch/api_resource.rb
|
153
153
|
- lib/trustedsearch/api_response.rb
|
154
|
+
- lib/trustedsearch/errors/api_mock_response.rb
|
154
155
|
- lib/trustedsearch/errors/authentication_error.rb
|
155
156
|
- lib/trustedsearch/errors/connection_error.rb
|
156
157
|
- lib/trustedsearch/errors/error.rb
|