druid_client 0.1.0 → 0.1.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 +4 -4
- data/lib/druid_client/api/response.rb +5 -5
- data/lib/druid_client/api/rest_client.rb +4 -4
- data/lib/druid_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34ed86aa92753544301d906daa4146a3867b2ef5401e8fa82d1c998aa70cee0a
|
4
|
+
data.tar.gz: 29ba4d941f1b137264b4e9e416071fbbb6168087b9bc179a7c8b9deccf3e6686
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab5a604a24cf2f870a1587c5fd7248136ba0b57cb8350f6f0afffdd0fb64bce2b62eabc7dc57e82aa0bb6a56a156e0f48b683473e11b517d039596ecc1310a98
|
7
|
+
data.tar.gz: d129f0ad680fb0218c559dda7933c2d0f9af7a37ef6674550fe1c2a4adac942a137b4f02914a41aca559684d835bb98721d1ae4291e2f73189e53af73ee9bc4b
|
@@ -3,19 +3,19 @@
|
|
3
3
|
module DruidClient
|
4
4
|
module Api
|
5
5
|
class Response
|
6
|
-
attr_reader :status_code, :body, :headers, :
|
6
|
+
attr_reader :status_code, :body, :headers, :duration
|
7
7
|
|
8
|
-
def initialize(status_code:, body:, headers: {},
|
8
|
+
def initialize(status_code:, body:, headers: {}, duration: nil)
|
9
9
|
@status_code = status_code
|
10
10
|
@body = body
|
11
11
|
@headers = headers
|
12
|
-
@
|
12
|
+
@duration = duration
|
13
13
|
end
|
14
14
|
|
15
15
|
def success?
|
16
16
|
return false unless status_code
|
17
17
|
|
18
|
-
200
|
18
|
+
(200..299).include?(status_code)
|
19
19
|
end
|
20
20
|
|
21
21
|
def error?
|
@@ -23,7 +23,7 @@ module DruidClient
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def to_s
|
26
|
-
"#<Response status_code=#{status_code}
|
26
|
+
"#<Response status_code=#{status_code} duration=#{duration}s>"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -43,16 +43,16 @@ module DruidClient
|
|
43
43
|
req.headers.merge!(headers)
|
44
44
|
req.body = body.to_json if body
|
45
45
|
end
|
46
|
-
|
46
|
+
duration = Time.now - start_time
|
47
47
|
Response.new(
|
48
48
|
status_code: response.status,
|
49
49
|
headers: response.headers,
|
50
50
|
body: response.body,
|
51
|
-
|
51
|
+
duration: duration
|
52
52
|
)
|
53
53
|
rescue Faraday::Error => e
|
54
|
-
|
55
|
-
Response.new(status_code: 0, body: e.message,
|
54
|
+
duration = Time.now - start_time
|
55
|
+
Response.new(status_code: 0, body: e.message, duration: duration)
|
56
56
|
end
|
57
57
|
|
58
58
|
def client_options
|
data/lib/druid_client/version.rb
CHANGED