Module: EndPointBlank::Rails::Authenticated

Extended by:
ActiveSupport::Concern
Defined in:
lib/end_point_blank/rails/authenticated.rb

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



12
13
14
15
16
17
18
# File 'lib/end_point_blank/rails/authenticated.rb', line 12

def authenticate!
  result = EndPointBlank::Commands::EndpointAuthenticate.authenticate(request)
  result_json = JSON.parse(result.body)
  if !result || result.status != 201
    raise UnauthorizedError, "Authentication failed: #{result_json['error']}"
  end
end