Class: FlexmlsApi::Authentication::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/flexmls_api/authentication/api_auth.rb

Overview

Session class

Handle on the api user session information as return by the api session service, including roles, tokens and expiration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Session

Returns a new instance of Session.



92
93
94
95
96
# File 'lib/flexmls_api/authentication/api_auth.rb', line 92

def initialize(options={})
  @auth_token = options["AuthToken"]
  @expires = DateTime.parse options["Expires"]
  @roles = options["Roles"]
end

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



91
92
93
# File 'lib/flexmls_api/authentication/api_auth.rb', line 91

def auth_token
  @auth_token
end

#expiresObject

Returns the value of attribute expires.



91
92
93
# File 'lib/flexmls_api/authentication/api_auth.rb', line 91

def expires
  @expires
end

#rolesObject

Returns the value of attribute roles.



91
92
93
# File 'lib/flexmls_api/authentication/api_auth.rb', line 91

def roles
  @roles
end

Instance Method Details

#expired?Boolean

Is the user session token expired?

Returns:

  • (Boolean)


98
99
100
# File 'lib/flexmls_api/authentication/api_auth.rb', line 98

def expired?
  DateTime.now > @expires
end