Class: SparkApi::Authentication::Session
- Inherits:
- 
      Object
      
        - Object
- SparkApi::Authentication::Session
 
- Defined in:
- lib/spark_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
- 
  
    
      #auth_token  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute auth_token. 
- 
  
    
      #expires  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute expires. 
- 
  
    
      #roles  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute roles. 
Instance Method Summary collapse
- 
  
    
      #expired?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Is the user session token expired?. 
- 
  
    
      #initialize(options = {})  ⇒ Session 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Session. 
Constructor Details
#initialize(options = {}) ⇒ Session
Returns a new instance of Session.
| 96 97 98 99 100 | # File 'lib/spark_api/authentication/api_auth.rb', line 96 def initialize(={}) @auth_token = ["AuthToken"] @expires = DateTime.parse ["Expires"] @roles = ["Roles"] end | 
Instance Attribute Details
#auth_token ⇒ Object
Returns the value of attribute auth_token.
| 95 96 97 | # File 'lib/spark_api/authentication/api_auth.rb', line 95 def auth_token @auth_token end | 
#expires ⇒ Object
Returns the value of attribute expires.
| 95 96 97 | # File 'lib/spark_api/authentication/api_auth.rb', line 95 def expires @expires end | 
#roles ⇒ Object
Returns the value of attribute roles.
| 95 96 97 | # File 'lib/spark_api/authentication/api_auth.rb', line 95 def roles @roles end | 
Instance Method Details
#expired? ⇒ Boolean
Is the user session token expired?
| 102 103 104 | # File 'lib/spark_api/authentication/api_auth.rb', line 102 def expired? DateTime.now > @expires end |