Class: Superset::Request

Inherits:
Object
  • Object
show all
Includes:
Display
Defined in:
lib/superset/request.rb

Defined Under Namespace

Classes: InvalidParameterError, ValidationError

Constant Summary collapse

PAGE_SIZE =
100

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Display

#display_headers, #headings, #list, #list_attributes, #rows, #table, #title

Constructor Details

#initialize(page_num: 0) ⇒ Request

Returns a new instance of Request.



13
14
15
# File 'lib/superset/request.rb', line 13

def initialize(page_num: 0)
  @page_num = page_num
end

Instance Attribute Details

#page_numObject

Returns the value of attribute page_num.



11
12
13
# File 'lib/superset/request.rb', line 11

def page_num
  @page_num
end

Class Method Details

.callObject



17
18
19
# File 'lib/superset/request.rb', line 17

def self.call
  self.new.response
end

Instance Method Details

#query_paramsObject



36
37
38
# File 'lib/superset/request.rb', line 36

def query_params
  [filters, pagination].join
end

#responseObject



21
22
23
24
25
26
# File 'lib/superset/request.rb', line 21

def response
  @response ||= client.get(route)
rescue => e
  logger.error("#{e.message}")
  raise e
end

#resultObject



28
29
30
# File 'lib/superset/request.rb', line 28

def result
  response['result']
end

#superset_hostObject



32
33
34
# File 'lib/superset/request.rb', line 32

def superset_host
  client.superset_host
end