Class: Levelup::Requests::CreateUser

Inherits:
Base show all
Includes:
Templates::AppAuthenticated
Defined in:
lib/levelup/requests/create_user.rb

Overview

Represents a request to create a new user with the specified list of permissions.

Constant Summary

Constants inherited from Base

Base::ALLOWED_REQUEST_METHODS

Instance Attribute Summary collapse

Attributes included from Templates::AppAuthenticated

#app_access_token

Instance Method Summary collapse

Methods included from Templates::AppAuthenticated

#auth_type

Methods inherited from Base

#auth_type, #headers, instance_variables_excluded_from_hash, #send_to_api

Methods inherited from Templates::DataParcel

excluded?, #initialize, instance_variables_excluded_from_hash

Constructor Details

This class inherits a constructor from Levelup::Templates::DataParcel

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key



7
8
9
# File 'lib/levelup/requests/create_user.rb', line 7

def api_key
  @api_key
end

#permission_keynamesObject

Returns the value of attribute permission_keynames



6
7
8
# File 'lib/levelup/requests/create_user.rb', line 6

def permission_keynames
  @permission_keynames
end

#userObject

Returns the value of attribute user



8
9
10
# File 'lib/levelup/requests/create_user.rb', line 8

def user
  @user
end

Instance Method Details

#bodyObject



10
11
12
# File 'lib/levelup/requests/create_user.rb', line 10

def body
  { api_key: api_key, user: user, permission_keynames: permission_keynames }
end

#response_from_hash(hash) ⇒ Object



14
15
16
17
18
# File 'lib/levelup/requests/create_user.rb', line 14

def response_from_hash(hash)
  hash['user'] = OpenStruct.new(hash['user'])

  Responses::Success.new(hash)
end