Class: Superset::Chart::Create

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/chart/create.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(params:) ⇒ Create

Returns a new instance of Create.



18
19
20
# File 'lib/superset/chart/create.rb', line 18

def initialize(params: )
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



16
17
18
# File 'lib/superset/chart/create.rb', line 16

def params
  @params
end

Instance Method Details

#performObject



22
23
24
25
26
27
# File 'lib/superset/chart/create.rb', line 22

def perform
  raise "Error: params hash is required" unless params.present? && params.is_a?(Hash)

  logger.info("Creating New Chart")
  response['id']
end

#responseObject



29
30
31
# File 'lib/superset/chart/create.rb', line 29

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