Method: Forecasting::Client#get
- Defined in:
- lib/forecasting/client.rb
#get(path, opts = {}) ⇒ Hash
Performs a GET request and returned the parsed JSON as a Hash.
199 200 201 202 203 204 205 |
# File 'lib/forecasting/client.rb', line 199 def get(path, opts = {}) url = "#{host}/#{path}" url += "?#{opts.map {|k, v| "#{k}=#{v}"}.join("&")}" if opts.any? uri = URI(url) response = http_response(:get, uri) JSON.parse(response.body) end |