Class: Superset::Dashboard::Put

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/dashboard/put.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(target_dashboard_id:, params:) ⇒ Put

Returns a new instance of Put.



10
11
12
13
# File 'lib/superset/dashboard/put.rb', line 10

def initialize(target_dashboard_id:, params:)
  @target_dashboard_id = target_dashboard_id
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



8
9
10
# File 'lib/superset/dashboard/put.rb', line 8

def params
  @params
end

#target_dashboard_idObject (readonly)

Returns the value of attribute target_dashboard_id.



8
9
10
# File 'lib/superset/dashboard/put.rb', line 8

def target_dashboard_id
  @target_dashboard_id
end

Instance Method Details

#idObject



26
27
28
# File 'lib/superset/dashboard/put.rb', line 26

def id
  response["result"]["id"]
end

#performObject



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

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

  response
end

#responseObject



22
23
24
# File 'lib/superset/dashboard/put.rb', line 22

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