Class: Superset::Dashboard::Embedded::Put

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/dashboard/embedded/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(dashboard_id:, allowed_domains:) ⇒ Put

Returns a new instance of Put.



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

def initialize(dashboard_id: , allowed_domains: )
  @dashboard_id = dashboard_id
  @allowed_domains = allowed_domains
end

Instance Attribute Details

#allowed_domainsObject (readonly)

Returns the value of attribute allowed_domains.



5
6
7
# File 'lib/superset/dashboard/embedded/put.rb', line 5

def allowed_domains
  @allowed_domains
end

#dashboard_idObject (readonly)

Returns the value of attribute dashboard_id.



5
6
7
# File 'lib/superset/dashboard/embedded/put.rb', line 5

def dashboard_id
  @dashboard_id
end

Instance Method Details

#paramsObject



19
20
21
# File 'lib/superset/dashboard/embedded/put.rb', line 19

def params
  { "allowed_domains": allowed_domains }
end

#responseObject



12
13
14
15
16
17
# File 'lib/superset/dashboard/embedded/put.rb', line 12

def response
  raise  InvalidParameterError, 'dashboard_id integer is required' if dashboard_id.nil? || dashboard_id.class != Integer
  raise  InvalidParameterError, 'allowed_domains array is required' if allowed_domains.nil? || allowed_domains.class != Array

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

#uuidObject



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

def uuid
  result['uuid'] unless response[:result].empty?
end