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

#api_keyObject

Returns the value of attribute api_key


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

def api_key
  @api_key
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

#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 = Request::Authentication.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