Module: FIR::Http
- Included in:
- Util::ClassMethods
- Defined in:
- lib/fir/util/http.rb
Constant Summary collapse
- DEFAULT_TIMEOUT =
300
Instance Method Summary collapse
Instance Method Details
#get(url, params = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fir/util/http.rb', line 8 def get url, params = {} begin res = ::RestClient::Request.execute( method: :get, url: url, timeout: DEFAULT_TIMEOUT, headers: default_headers.merge(params: params) ) rescue => e logger.error e..to_s + " - " + e.response.to_s exit 1 end JSON.parse(res.body.force_encoding("UTF-8"), symbolize_names: true) end |