Class: Superset::Chart::List

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

Constant Summary

Constants inherited from Request

Request::DEFAULT_PAGE_SIZE

Instance Attribute Summary collapse

Attributes inherited from Request

#page_num, #page_size

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Request

#query_params, #response, #result, #superset_host

Methods included from Display

#ids, #list, #result, #rows, #table, #title, #to_h

Constructor Details

#initialize(title_contains: '', dashboard_id_eq: '', dataset_id_eq: '', **kwargs) ⇒ List

Returns a new instance of List.



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

def initialize(title_contains: '', dashboard_id_eq: '', dataset_id_eq: '', **kwargs)
  @title_contains = title_contains
  @dashboard_id_eq = dashboard_id_eq
  @dataset_id_eq = dataset_id_eq
  super(**kwargs)
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

#title_containsObject (readonly)

Returns the value of attribute title_contains.



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

def title_contains
  @title_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