Sha256: 4fc874825f9439c0249d65aee422d8e2ec404326d2877de49b4946572182d457
Contents?: true
Size: 924 Bytes
Versions: 4
Compression:
Stored size: 924 Bytes
Contents
# frozen_string_literal: true module FinApps module REST class Sessions < FinAppsCore::REST::Resources # :nodoc: CONSUMER_LOGIN = 'login' LOGOUT = 'logout' def create(params, path = nil) return super nil, path if path == LOGOUT raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params path ||= CONSUMER_LOGIN begin super params, path rescue FinAppsCore::ApiUnauthenticatedError return [ nil, [ "Invalid #{path == CONSUMER_LOGIN ? 'Consumer' : 'Operator'} Identifier or Credentials" ] ] end end def destroy create nil, LOGOUT end private def validates(params) params.key?(:email) && params[:email] && params.key?(:password) && params[:password] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
finapps-5.0.7 | lib/finapps/rest/sessions.rb |
finapps-5.0.6 | lib/finapps/rest/sessions.rb |
finapps-5.0.5 | lib/finapps/rest/sessions.rb |
finapps-5.0.4 | lib/finapps/rest/sessions.rb |