Module: OpenExchangeRates::Client::Connections

Included in:
OpenExchangeRates::Client
Defined in:
lib/open_exchange_rates/client/connections.rb

Instance Method Summary collapse

Instance Method Details

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



4
5
6
# File 'lib/open_exchange_rates/client/connections.rb', line 4

def get(path, options = {})
  request :get, path, options
end

#parse_rates(data) ⇒ Object



14
15
16
# File 'lib/open_exchange_rates/client/connections.rb', line 14

def parse_rates(data)
  data['rates']
end

#request(http_method, path, options) ⇒ Object



8
9
10
11
12
# File 'lib/open_exchange_rates/client/connections.rb', line 8

def request(http_method, path, options)
  response = self.class.send http_method, path, { query: options }
  data = response.parsed_response
  parse_rates data
end