Class: SparkApi::Authentication::SingleSessionProvider

Inherits:
BaseOAuth2Provider show all
Defined in:
lib/spark_api/authentication/oauth2_impl/single_session_provider.rb

Instance Attribute Summary

Attributes inherited from BaseOAuth2Provider

#code, #grant_type

Instance Method Summary collapse

Methods inherited from BaseOAuth2Provider

#redirect, #session_timeout

Constructor Details

#initialize(credentials) ⇒ SingleSessionProvider

Returns a new instance of SingleSessionProvider.



6
7
8
9
# File 'lib/spark_api/authentication/oauth2_impl/single_session_provider.rb', line 6

def initialize(credentials)
  @access_token = credentials.delete(:access_token)
  super(credentials)
end

Instance Method Details

#destroy_sessionObject



21
22
23
# File 'lib/spark_api/authentication/oauth2_impl/single_session_provider.rb', line 21

def destroy_session
  @session = nil
end

#load_sessionObject



11
12
13
14
15
# File 'lib/spark_api/authentication/oauth2_impl/single_session_provider.rb', line 11

def load_session
  @session ||= SparkApi::Authentication::OAuthSession.new({
    :access_token => @access_token
  })
end

#save_session(session) ⇒ Object



17
18
19
# File 'lib/spark_api/authentication/oauth2_impl/single_session_provider.rb', line 17

def save_session session
  @session = session
end