Class: NVX::SDS::AccountLogin
- Inherits:
-
Object
- Object
- NVX::SDS::AccountLogin
- Defined in:
- lib/nvx/sds/accountlogin.rb
Overview
Overview
The AccountLogin object is used to hold the session and application information for a specific account. The AccountLogin object is created from the session object. it is used to store the current user information.
Instance Method Summary collapse
-
#app_key ⇒ Object
Gets the current application key.
-
#app_name ⇒ Object
Gets the current application name.
-
#initialize(app_key, username, app_name, password = nil, session_token = nil) ⇒ AccountLogin
constructor
The initialize method is used to set the parameters being passed by the session object.
-
#Login ⇒ Object
The Login method signs the user in using the information passed in the initialize method.
-
#root_path ⇒ Object
Convenient function to get the root of the current application.
-
#session_token ⇒ Object
Current session token for the current logged in user.
-
#username ⇒ Object
Stores the currently logged in username.
-
#username=(username) ⇒ Object
Sets the username.
Constructor Details
#initialize(app_key, username, app_name, password = nil, session_token = nil) ⇒ AccountLogin
The initialize method is used to set the parameters being passed by the session object.
21 22 23 24 25 26 |
# File 'lib/nvx/sds/accountlogin.rb', line 21 def initialize(app_key, username, app_name, password = nil, session_token = nil) @app_key, @username, @app_name = app_key, username, app_name @password = password @session_token = session_token @impersonation = !session_token.nil? end |
Instance Method Details
#app_key ⇒ Object
Gets the current application key.
44 45 46 |
# File 'lib/nvx/sds/accountlogin.rb', line 44 def app_key @app_key end |
#app_name ⇒ Object
Gets the current application name.
49 50 51 |
# File 'lib/nvx/sds/accountlogin.rb', line 49 def app_name @app_name end |
#Login ⇒ Object
The Login method signs the user in using the information passed in the initialize method.
59 60 61 62 63 64 65 |
# File 'lib/nvx/sds/accountlogin.rb', line 59 def Login if @impersonation raise "This account is impersonated and cannot be logged in." end result = Transport.execute_command_post(APICommand.Login, [APIParam.new("appKey", @app_key), APIParam.new("username", @username), APIParam.new("password", @password)], nil) @session_token = result.root.elements["SessionToken"].get_text.value end |
#root_path ⇒ Object
Convenient function to get the root of the current application.
54 55 56 |
# File 'lib/nvx/sds/accountlogin.rb', line 54 def root_path @root_path = "//" + @app_name + "/" + @username; end |
#session_token ⇒ Object
Current session token for the current logged in user.
29 30 31 |
# File 'lib/nvx/sds/accountlogin.rb', line 29 def session_token @session_token end |
#username ⇒ Object
Stores the currently logged in username
34 35 36 |
# File 'lib/nvx/sds/accountlogin.rb', line 34 def username @username end |
#username=(username) ⇒ Object
Sets the username
39 40 41 |
# File 'lib/nvx/sds/accountlogin.rb', line 39 def username=(username) @username=username end |