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

#authsub_tokenObject

Returns the value of attribute authsub_token.



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

def authsub_token
  @authsub_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

#authsub_user?Boolean

Returns:

  • (Boolean)


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

def authsub_user?
  !authsub_token.nil?
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