# frozen_string_literal: true module Fizzy module Api module Endpoints class Endpoint < ActiveInteraction::Base protected def process_response(response) case response.code when 200 response else invalid_response(response) end end def invalid_response(response) raise Errors::UnexpectedStatusError, "Status code #{response.code} not expected." end def select_measurement_text(response, default_message) response.body || default_message end end end end end