lib/gattica/engine.rb
def do_http_get(query_string)
      response = @http.get(add_api_key(query_string), @headers)

      # Response code error checking
      if response.code != '200'
        case response.code
        when '400'
          raise GatticaError::AnalyticsError, response.body + " (status code: #{response.code})"
        when '401'
          raise GatticaError::InvalidToken, "Your authorization token is invalid or has expired (status code: #{response.code})"
        when '403'
          raise GatticaError::UserError, response.body + " (status code: #{response.code})"
        else
          raise GatticaError::UnknownAnalyticsError, response.body + " (status code: #{response.code})"
        end
      end

      return response.body
    end
# Does the work of making HTTP calls and then going through a suite of tests on the response to make
# sure it's valid and not an error
Does the work of making HTTP calls and then going through a suite of tests on the response to make
sure it's valid and not an error
Does the work of making HTTP calls and then going through a suite of tests on the response to make sure it ' s valid and not an error
def do_http_get(query_string)
      response = @http.get(add_api_key(query_string), @headers)
      if response.code != '200'
        case response.code
        when '400'
          raise GatticaError::AnalyticsError, response.body + " (status code: #{response.code})"
        when '401'
          raise GatticaError::InvalidToken, "Your authorization token is invalid or has expired (status code: #{response.code})"
        when '403'
          raise GatticaError::UserError, response.body + " (status code: #{response.code})"
        else
          raise GatticaError::UnknownAnalyticsError, response.body + " (status code: #{response.code})"
        end
      end
      return response.body
    end
def do_http_get ( query_string ) response = @http . get ( add_api_key ( query_string ) , @headers ) if response . code != '200' case response . code when '400' raise GatticaError :: AnalyticsError , response . body + " (status code: #{response.code})" when '401' raise GatticaError :: InvalidToken , "Your authorization token is invalid or has expired (status code: #{response.code})" when '403' raise GatticaError :: UserError , response . body + " (status code: #{response.code})" else raise GatticaError :: UnknownAnalyticsError , response . body + " (status code: #{response.code})" end end return response . body end
Does the work of making HTTP calls and then going through a suite of tests on the response to make
sure it's valid and not an error
Does the work of making HTTP calls and then going through a suite of tests on the response to make sure it ' s valid and not an error
# Response code error checking
query_string