Class: Superset::Dashboard::Delete

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/dashboard/delete.rb

Constant Summary

Constants inherited from Request

Request::PAGE_SIZE

Instance Attribute Summary collapse

Attributes inherited from Request

#page_num

Instance Method Summary collapse

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:, confirm_zero_charts: true) ⇒ Delete

Returns a new instance of Delete.



9
10
11
12
# File 'lib/superset/dashboard/delete.rb', line 9

def initialize(dashboard_id: , confirm_zero_charts: true)
  @dashboard_id = dashboard_id
  @confirm_zero_charts = confirm_zero_charts
end

Instance Attribute Details

#confirm_zero_chartsObject (readonly)

Returns the value of attribute confirm_zero_charts.



7
8
9
# File 'lib/superset/dashboard/delete.rb', line 7

def confirm_zero_charts
  @confirm_zero_charts
end

#dashboard_idObject (readonly)

Returns the value of attribute dashboard_id.



7
8
9
# File 'lib/superset/dashboard/delete.rb', line 7

def dashboard_id
  @dashboard_id
end

Instance Method Details

#performObject



14
15
16
17
18
19
20
21
# File 'lib/superset/dashboard/delete.rb', line 14

def perform
  raise InvalidParameterError, "dashboard_id integer is required" unless dashboard_id.present? && dashboard_id.is_a?(Integer)

  confirm_zero_charts_on_dashboard if confirm_zero_charts

  logger.info("Attempting to delete dashboard with id: #{dashboard_id}")
  response
end

#responseObject



23
24
25
# File 'lib/superset/dashboard/delete.rb', line 23

def response
  @response ||= client.delete(route)
end