druid_client 0.1.0 → 0.1.2

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
  SHA256:
3
- metadata.gz: d0995de7f57ebb5a4b1b5fb39f3bd08378073d814289f3bc02e530edb3aabd53
4
- data.tar.gz: 27330ecf9f06410fa5a30d9b02c6fc9c63dd3a0bbc02f54b3bc88938c633f369
3
+ metadata.gz: 9a81c003d77d8da968f48e5ff8702892b98449819b5629f0eb83fb34e7930cdd
4
+ data.tar.gz: 882564c48dd0551757b273c4f2e703d922b64574a61ab4ff9102657beca915e0
5
5
  SHA512:
6
- metadata.gz: '081b22325e38beadd31c03636c1f26300a4f8bd8070984de6524206789d15fca97fe9d2691f52b5e15c81fdb5e41934856f8db1eaac58b6b86b20e499ede676c'
7
- data.tar.gz: 6a28949b4fcd34210bb5cc7f38aa39d8271ab902e677bd868bc65e23bb250034f9d490bf56caa37cbceadd02cf75444d82b366dd3177a6c151098088325f1b0b
6
+ metadata.gz: e723a1dc81da695bde0987398597105f75aa878ae21d6c22c4406ccf09f3abfe4e51f4dfe350fa13c72e9a0641df7e5a1aa6044195c1b2c83fa1ab8d98564065
7
+ data.tar.gz: 91660b9d43dcbe92b9d4ea38c963566b8dd36358705b532974a7fb0186f6eea8be9a0be6bc58fd7f3185b739359004dc39d8b8caeb855ad5b24cde2ce4149b72
@@ -3,19 +3,19 @@
3
3
  module DruidClient
4
4
  module Api
5
5
  class Response
6
- attr_reader :status_code, :body, :headers, :elapsed_time
6
+ attr_reader :status_code, :body, :headers, :duration
7
7
 
8
- def initialize(status_code:, body:, headers: {}, elapsed_time: nil)
8
+ def initialize(status_code:, body:, headers: {}, duration: nil)
9
9
  @status_code = status_code
10
10
  @body = body
11
11
  @headers = headers
12
- @elapsed_time = elapsed_time
12
+ @duration = duration
13
13
  end
14
14
 
15
15
  def success?
16
16
  return false unless status_code
17
17
 
18
- 200.299.include?(status_code)
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} elapsed_time=#{elapsed_time}s>"
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
- elapsed_time = Time.now - start_time
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
- elapsed_time: elapsed_time
51
+ duration: duration
52
52
  )
53
53
  rescue Faraday::Error => e
54
- elapsed_time = Time.now - start_time
55
- Response.new(status_code: 0, body: e.message, elapsed_time: elapsed_time)
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
@@ -31,8 +31,8 @@ module DruidClient
31
31
  parameters: parameters.to_a,
32
32
  resultFormat: result_format.to_s,
33
33
  header: header,
34
- typesHeader: types_header,
35
- sqlTypesHeader: sql_types_header,
34
+ typesHeader: header && types_header,
35
+ sqlTypesHeader: header && sql_types_header,
36
36
  context: context.to_h
37
37
  }
38
38
  post(SQL_PATH, body: query_body)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DruidClient
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: druid_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Tych