class Fizzy::Api::Endpoints::CalculateOutcome

Public Instance Methods

execute() click to toggle source
# File lib/fizzy/api/endpoints/calculate_outcome.rb, line 10
def execute
  response = Api.basic_auth_session.post("/dossier/#{dossier_id}"\
                                         "/protocol_subscriptions/#{protocol_subscription_id}"\
                                         '/calculate')
  process_response(response)
end

Private Instance Methods

invalid_response(response) click to toggle source
# File lib/fizzy/api/endpoints/calculate_outcome.rb, line 19
def invalid_response(response)
  case response.code
  when 202
    raise(Errors::OutcomeNotAvailableError,
          select_measurement_text(response, 'The results are currently being calculated.'))
  when 404
    raise Errors::GraphNotFoundError, select_measurement_text(response,
                                                              'Participant not found, or graph not supported.')
  else
    raise Errors::UnexpectedStatusError, "Status code #{response.code} not expected."
  end
end