Class: Superset::Dashboard::Export

Inherits:
Request
  • Object
show all
Includes:
FileUtilities
Defined in:
lib/superset/dashboard/export.rb

Constant Summary collapse

TMP_SUPERSET_DASHBOARD_PATH =
'/tmp/superset_dashboards'

Constants inherited from Request

Request::PAGE_SIZE

Instance Attribute Summary collapse

Attributes inherited from Request

#page_num

Instance Method Summary collapse

Methods included from FileUtilities

#unzip_file

Methods inherited from Request

call, #query_params, #result, #superset_host

Methods included from Superset::Display

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

Constructor Details

#initialize(dashboard_id:, destination_path:) ⇒ Export

Returns a new instance of Export.



20
21
22
23
# File 'lib/superset/dashboard/export.rb', line 20

def initialize(dashboard_id: , destination_path: )
  @dashboard_id = dashboard_id
  @destination_path = destination_path.chomp('/')
end

Instance Attribute Details

#dashboard_idObject (readonly)

Returns the value of attribute dashboard_id.



18
19
20
# File 'lib/superset/dashboard/export.rb', line 18

def dashboard_id
  @dashboard_id
end

#destination_pathObject (readonly)

Returns the value of attribute destination_path.



18
19
20
# File 'lib/superset/dashboard/export.rb', line 18

def destination_path
  @destination_path
end

Instance Method Details

#performObject



25
26
27
28
29
30
# File 'lib/superset/dashboard/export.rb', line 25

def perform
  create_tmp_dir
  save_exported_zip_file
  unzip_files
  copy_export_files_to_destination_path if destination_path
end

#responseObject



32
33
34
35
36
37
38
# File 'lib/superset/dashboard/export.rb', line 32

def response
  @response ||= client.call(
    :get,
    client.url(route),
    client.param_check(params)
  )
end