Sha256: ec3a012e96fd2cd27ac061858070c142d530c58e161b6ccc6f864113e03a56f5
Contents?: true
Size: 953 Bytes
Versions: 14
Compression:
Stored size: 953 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 ( [ 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
14 entries across 14 versions & 1 rubygems