Class: LevelTravel::Request

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

Defined Under Namespace

Classes: Response

Constant Summary collapse

HOST =
'https://api.level.travel'

Class Method Summary collapse

Class Method Details

.get(url, params = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/level_travel/request.rb', line 24

def self.get(url, params = {})
  response = request_client.get(url) do |request|
    request.params = params
    request.options.timeout = LevelTravel::Settings.timeout
  end

  body = Oj.load(response.body, symbol_keys: true, mode: :compat)
  Response.new(code: response.status, error: body[:error], body: body)
end