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-4.2.0.alpha2 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.2.0.alpha1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.1.1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.1.0 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.1.0.rc1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.0.3 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.0.2 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.0.1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.0.0 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.0.0.rc0 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.0.0.alpha3 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.4.1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.0.0.alpha2 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-4.0.0.alpha1 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.4.0 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.3.0 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.3.0.rc3 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.3.0.rc2 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.1.2 app/api/locomotive/api/resources/token_resource.rb
locomotivecms-3.2.1 app/api/locomotive/api/resources/token_resource.rb