Class: Superset::Chart::BulkDelete

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/chart/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 Display

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

Constructor Details

#initialize(chart_ids: []) ⇒ BulkDelete

Returns a new instance of BulkDelete.



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

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

Instance Attribute Details

#chart_idsObject (readonly)

Returns the value of attribute chart_ids.



11
12
13
# File 'lib/superset/chart/bulk_delete.rb', line 11

def chart_ids
  @chart_ids
end

Instance Method Details

#performObject



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

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

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

#responseObject



25
26
27
# File 'lib/superset/chart/bulk_delete.rb', line 25

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