Class: FinApps::REST::Sessions

Inherits:
FinAppsCore::REST::Resources
  • Object
show all
Defined in:
lib/finapps/rest/sessions.rb

Overview

:nodoc:

Constant Summary collapse

CONSUMER_LOGIN =
'login'
LOGOUT =
'logout'

Instance Method Summary collapse

Instance Method Details

#create(params, path = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/finapps/rest/sessions.rb', line 9

def create(params, path = nil)
  return super nil, path if path == LOGOUT
  fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params

  path ||= CONSUMER_LOGIN

  begin
    super params, path
  rescue FinAppsCore::ApiUnauthenticatedError
    (path)
  end
end

#destroyObject



22
23
24
# File 'lib/finapps/rest/sessions.rb', line 22

def destroy
  create nil, LOGOUT
end