Class: Superset::GuestToken

Inherits:
Object
  • Object
show all
Includes:
Credential::EmbeddedUser
Defined in:
lib/superset/guest_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Credential::EmbeddedUser

#credentials

Constructor Details

#initialize(embedded_dashboard_id:, current_user: nil) ⇒ GuestToken

Returns a new instance of GuestToken.



7
8
9
10
# File 'lib/superset/guest_token.rb', line 7

def initialize(embedded_dashboard_id: , current_user: nil)
  @embedded_dashboard_id = embedded_dashboard_id
  @current_user = current_user
end

Instance Attribute Details

#current_userObject

Returns the value of attribute current_user.



5
6
7
# File 'lib/superset/guest_token.rb', line 5

def current_user
  @current_user
end

#embedded_dashboard_idObject

Returns the value of attribute embedded_dashboard_id.



5
6
7
# File 'lib/superset/guest_token.rb', line 5

def embedded_dashboard_id
  @embedded_dashboard_id
end

Instance Method Details

#guest_tokenObject



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

def guest_token
  response_body['token']
end

#paramsObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/superset/guest_token.rb', line 16

def params
  {
    "resources": [
      {
        "id": embedded_dashboard_id.to_s,
        "type": "dashboard" }
    ],
    "rls": [],
    "user": current_user_params
  }
end