Class: GrapeDeviseAuth::AuthorizerData

Inherits:
Object
  • Object
show all
Defined in:
lib/grape_devise_auth/authorizer_data.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uid, client_id, token, expiry, warden) ⇒ AuthorizerData

Returns a new instance of AuthorizerData.



5
6
7
8
9
10
11
# File 'lib/grape_devise_auth/authorizer_data.rb', line 5

def initialize(uid, client_id, token, expiry, warden)
  @uid = uid
  @client_id = client_id
  @token = token
  @expiry = expiry
  @warden = warden
end

Instance Attribute Details

#client_idObject (readonly)

Returns the value of attribute client_id.



3
4
5
# File 'lib/grape_devise_auth/authorizer_data.rb', line 3

def client_id
  @client_id
end

#expiryObject (readonly)

Returns the value of attribute expiry.



3
4
5
# File 'lib/grape_devise_auth/authorizer_data.rb', line 3

def expiry
  @expiry
end

#tokenObject (readonly)

Returns the value of attribute token.



3
4
5
# File 'lib/grape_devise_auth/authorizer_data.rb', line 3

def token
  @token
end

#uidObject (readonly)

Returns the value of attribute uid.



3
4
5
# File 'lib/grape_devise_auth/authorizer_data.rb', line 3

def uid
  @uid
end

#wardenObject (readonly)

Returns the value of attribute warden.



3
4
5
# File 'lib/grape_devise_auth/authorizer_data.rb', line 3

def warden
  @warden
end

Class Method Details

.from_env(env) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/grape_devise_auth/authorizer_data.rb', line 13

def self.from_env(env)
  new(
    env[Configuration::UID_KEY],
    env[Configuration::CLIENT_KEY] || 'default',
    env[Configuration::ACCESS_TOKEN_KEY],
    env[Configuration::EXPIRY_KEY],
    env['warden']
  )
end

Instance Method Details

#token_prerequisites_present?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/grape_devise_auth/authorizer_data.rb', line 23

def token_prerequisites_present?
  token && uid
end