Module: Responsys::Api::Authentication

Included in:
All, Session
Defined in:
lib/responsys/api/authentication.rb

Instance Method Summary collapse

Instance Method Details

#logged_in?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/responsys/api/authentication.rb', line 20

def logged_in?
  !(session_id.nil? || jsession_id.nil? || header.nil?)
end

#loginObject



4
5
6
7
8
9
10
11
# File 'lib/responsys/api/authentication.rb', line 4

def 
  logout if logged_in?

  response = run(:login, credentials)
  establish_session_id(response)
  establish_jsession_id(response)
  set_session_credentials
end

#logoutObject



13
14
15
16
17
18
# File 'lib/responsys/api/authentication.rb', line 13

def logout
  return unless logged_in?

  run_with_credentials(:logout, nil)
  destroy_session_objects
end