Class: Iot::BaseController

Inherits:
ApiController
  • Object
show all
Includes:
ActionController::Flash
Defined in:
app/controllers/iot/base_controller.rb

Direct Known Subclasses

AnalysesController

Instance Method Summary collapse

Methods included from CallLoggable

#log_request, #log_response

Instance Method Details

#authenticate_thing!Object


25
26
27
28
29
30
31
# File 'app/controllers/iot/base_controller.rb', line 25

def authenticate_thing!
  @sensor = Sensor.find_by(token: params.delete(:token))
  unless @sensor
    render status: :unauthorized, json: { message: 'Unauthorized.' }
    false
  end
end