Class: Superset::Dashboard::BulkDelete

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/dashboard/bulk_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_ids: []) ⇒ BulkDelete

Returns a new instance of BulkDelete.



15
16
17
# File 'lib/superset/dashboard/bulk_delete.rb', line 15

def initialize(dashboard_ids: [])
  @dashboard_ids = dashboard_ids
end

Instance Attribute Details

#dashboard_idsObject (readonly)

Returns the value of attribute dashboard_ids.



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

def dashboard_ids
  @dashboard_ids
end

Instance Method Details

#performObject



19
20
21
22
23
24
25
# File 'lib/superset/dashboard/bulk_delete.rb', line 19

def perform
  raise InvalidParameterError, "dashboard_ids array of integers expected" unless dashboard_ids.is_a?(Array)
  raise InvalidParameterError, "dashboard_ids array must contain Integer only values" unless dashboard_ids.all? { |item| item.is_a?(Integer) }

  logger.info("Attempting to delete dashboards with id: #{dashboard_ids.join(', ')}")
  response
end

#responseObject



27
28
29
# File 'lib/superset/dashboard/bulk_delete.rb', line 27

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