class FlagEvaluationService

Servicio para acceder a flag evaluation

Public Class Methods

evaluate(token, user_id = nil) click to toggle source
# File lib/flag_evaluation_service.rb, line 7
def self.evaluate(token, user_id = nil)
  url = FlagEvaluationLib::StaticEnvs::SERVICE_URL
  params = user_id == nil ?
    { params: { flag: token } } :
    { params: { flag: token, userId: user_id } }

  response = RestClient.get url, params
  if response.code == 200
    JSON.parse(response.body)
  else
    raise "An error has occured. Response was #{response.code}"
  end
end