Sha256: efb0ebfacfc09bf4c06c5fe2e44b351eaecc14b2fcc9333425d1e0c65e215c88
Contents?: true
Size: 952 Bytes
Versions: 2
Compression:
Stored size: 952 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 fail 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
finapps-5.0.34 | lib/finapps/rest/sessions.rb |
finapps-5.0.33 | lib/finapps/rest/sessions.rb |