Method: ZAWS::Sumoapi::SumoClient#json_request
- Defined in:
- lib/zaws/external/sumoapi/sumo_client.rb
#json_request(method, path, options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/zaws/external/sumoapi/sumo_client.rb', line 44 def json_request(method, path, = {}) if [:body] && ![:body].instance_of?(String) [:body] = [:body].to_json end [:headers] ||= {} [:headers]['Content-Type'] = 'application/json' response = request(method, path, ) JSON.parse(response.body) if (response.body.length > 0 && response.headers['content-type'].match(/json/)) end |