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

Version Path
locomotivecms-3.3.0.rc1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.2.0 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.2.0.rc2 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.2.0.rc1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.1.1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.1.0 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.1.0.rc3 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.1.0.rc2 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.1.0.rc1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0.rc7 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0.rc6 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0.rc5 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0.rc4 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0.rc3 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0.rc2 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0.rc1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0.pre.beta.1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.0.0.pre.alpha.3 app/api/locomotive/api/resources/token_resource.rb