Class: Greeve::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/greeve/request.rb

Overview

Handles an HTTP request to the EVE XML API.

Instance Method Summary collapse

Instance Method Details

#get(endpoint, params = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/greeve/request.rb', line 5

def get(endpoint, params = {})
  url = "#{Greeve::API::BASE_URL}/#{endpoint}"

  unless params.empty?
    query_params =
      params
        .map { |k, v| "#{k}=#{v}" }
        .join("&")

    url = "#{url}?#{query_params}"
  end

  Typhoeus.get(url)
end