Class: Superset::Dataset::BulkDelete

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

Returns a new instance of BulkDelete.



14
15
16
# File 'lib/superset/dataset/bulk_delete.rb', line 14

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

Instance Attribute Details

#dataset_idsObject (readonly)

Returns the value of attribute dataset_ids.



12
13
14
# File 'lib/superset/dataset/bulk_delete.rb', line 12

def dataset_ids
  @dataset_ids
end

Instance Method Details

#performObject



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

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

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

#responseObject



26
27
28
# File 'lib/superset/dataset/bulk_delete.rb', line 26

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