Class: FXRates::Request

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

Constant Summary collapse

BASE_URL =
"https://api.fxratesapi.com"

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Request

Returns a new instance of Request.



8
9
10
11
12
# File 'lib/fx_rates/request.rb', line 8

def initialize(api_key)
  raise FXRates::AuthenticationError, "API key is required" if api_key.nil?

  @api_key = api_key
end

Instance Method Details

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



14
15
16
17
# File 'lib/fx_rates/request.rb', line 14

def get(path, params = {})
  response = connection.get(path, params)
  handle_response(response)
end