Class: Superset::Security::User::Create

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/security/user/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(user_params: {}) ⇒ Create

Returns a new instance of Create.



7
8
9
# File 'lib/superset/security/user/create.rb', line 7

def initialize(user_params: {})
  @user_params = user_params.with_indifferent_access
end

Instance Attribute Details

#user_paramsObject (readonly)

Returns the value of attribute user_params.



5
6
7
# File 'lib/superset/security/user/create.rb', line 5

def user_params
  @user_params
end

Instance Method Details

#responseObject



11
12
13
14
15
# File 'lib/superset/security/user/create.rb', line 11

def response
  validate_user_params

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

#validate_user_paramsObject



17
18
19
20
21
# File 'lib/superset/security/user/create.rb', line 17

def validate_user_params
  raise InvalidParameterError, "Missing user params. Expects #{valid_user_params_keys}" unless symbolized_user_param_keys == valid_user_params_keys
  raise InvalidParameterError, 'Roles must be an array ' unless user_params[:roles].is_a?(Array)
  confirm_all_params_present
end