module ExternalParamValidator

Constants

VERSION

Public Instance Methods

check_external_param() click to toggle source
# File lib/external_param_validator.rb, line 13
def check_external_param()
  if request.headers["Device-id"]
    device =  HTTParty.get(url_string(request.headers["Device-id"]))
    if device.present?
      device
    else
      render nothing: true, status: :not_found
    end
  end
end
url_string(device_id) click to toggle source
# File lib/external_param_validator.rb, line 5
def url_string(device_id)
    if ENV["URL_DEVICE_AUTH"]
      "#{ENV["URL_DEVICE_AUTH"]}/#{device_id}"
    else
      "http://localhost:3001/api/v1/terminals/#{device_id}"
    end
end