Sha256: c4d4c0b9290601795a07e93d7dd28929a9b1ce4129df5b880a33dd77699c9223
Contents?: true
Size: 713 Bytes
Versions: 42
Compression:
Stored size: 713 Bytes
Contents
module Locomotive module API module Resources class TokenResource < Grape::API resource :tokens do desc 'Create session token' params do requires :email, type: String, desc: 'Your Email address.' end post do begin token = Account.create_api_token(params[:email], params[:password], params[:api_key]) { token: token } rescue Exception => e response = { message: e.message } error! response, 401, 'X-Error-Detail' => e.message end end # stub destroy Account#invalidate_api_token(token) end end end end end
Version data entries
42 entries across 42 versions & 1 rubygems