Module: Garb::Session::Methods

Included in:
Garb::Session, Garb::Session
Defined in:
lib/garb/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



4
5
6
# File 'lib/garb/session.rb', line 4

def access_token
  @access_token
end

#auth_tokenObject

Returns the value of attribute auth_token.



4
5
6
# File 'lib/garb/session.rb', line 4

def auth_token
  @auth_token
end

#emailObject

Returns the value of attribute email.



4
5
6
# File 'lib/garb/session.rb', line 4

def email
  @email
end

Instance Method Details

#auth_sub(token) ⇒ Object



21
22
23
24
# File 'lib/garb/session.rb', line 21

def auth_sub(token)
  self.auth_token = token
  @auth_sub = true
end

#auth_sub?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/garb/session.rb', line 26

def auth_sub?
  @auth_sub
end

#login(email, password, opts = {}) ⇒ Object

use only for single user authentication



7
8
9
10
11
# File 'lib/garb/session.rb', line 7

def (email, password, opts={})
  self.email = email
  auth_request = AuthenticationRequest.new(email, password, opts)
  self.auth_token = auth_request.auth_token(opts)
end

#oauth_user?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/garb/session.rb', line 17

def oauth_user?
  !access_token.nil?
end

#single_user?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/garb/session.rb', line 13

def single_user?
  auth_token && auth_token.is_a?(String)
end