Class: ClickHouse::Response::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/click_house/response/factory.rb

Class Method Summary collapse

Class Method Details

.[](faraday) ⇒ String, ResultSet

Returns:


8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/click_house/response/factory.rb', line 8

def self.[](faraday)
  body = faraday.body

  return body if !body.is_a?(Hash) || !(body.key?('meta') && body.key?('data'))

  ResultSet.new(
    meta: body.fetch('meta'),
    data: body.fetch('data'),
    totals: body['totals'],
    statistics: body['statistics']
  )
end