Class: Superset::Chart::List

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/chart/list.rb

Constant Summary

Constants inherited from Request

Request::PAGE_SIZE

Instance Attribute Summary collapse

Attributes inherited from Request

#page_num

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Request

#query_params, #response, #result, #superset_host

Methods included from Display

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

Constructor Details

#initialize(page_num: 0, name_contains: '', dashboard_id_eq: '', dataset_id_eq: '') ⇒ List

Returns a new instance of List.



7
8
9
10
11
12
# File 'lib/superset/chart/list.rb', line 7

def initialize(page_num: 0, name_contains: '', dashboard_id_eq: '', dataset_id_eq: '')
  @name_contains = name_contains
  @dashboard_id_eq = dashboard_id_eq
  @dataset_id_eq = dataset_id_eq
  super(page_num: page_num)
end

Instance Attribute Details

#dashboard_id_eqObject (readonly)

Returns the value of attribute dashboard_id_eq.



5
6
7
# File 'lib/superset/chart/list.rb', line 5

def dashboard_id_eq
  @dashboard_id_eq
end

#dataset_id_eqObject (readonly)

Returns the value of attribute dataset_id_eq.



5
6
7
# File 'lib/superset/chart/list.rb', line 5

def dataset_id_eq
  @dataset_id_eq
end

#name_containsObject (readonly)

Returns the value of attribute name_contains.



5
6
7
# File 'lib/superset/chart/list.rb', line 5

def name_contains
  @name_contains
end

Class Method Details

.callObject



14
15
16
# File 'lib/superset/chart/list.rb', line 14

def self.call
  self.new.list
end

Instance Method Details

#list_with_dashboardsObject



18
19
20
21
22
23
24
# File 'lib/superset/chart/list.rb', line 18

def list_with_dashboards
  puts Terminal::Table.new(
    title: title,
    headings: list_dashboard_attributes.map(&:to_s).map(&:humanize),
    rows: rows_with_dashboards
  )
end

#rows_with_dashboardsObject



26
27
28
29
30
# File 'lib/superset/chart/list.rb', line 26

def rows_with_dashboards
  result.map do |d|
    list_dashboard_attributes.map { |la| d[la].to_s }
  end
end