Module: ChartMogul::API::Actions::Custom::ClassMethods

Defined in:
lib/chartmogul/api/actions/custom.rb

Instance Method Summary collapse

Instance Method Details

#custom!(http_method, http_path, body_data = {}) ⇒ Object



31
32
33
34
# File 'lib/chartmogul/api/actions/custom.rb', line 31

def custom!(http_method, http_path, body_data = {})
  json = custom_without_assign!(http_method, http_path, body_data)
  new_from_json(json)
end

#custom_without_assign!(http_method, http_path, body_data = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/chartmogul/api/actions/custom.rb', line 21

def custom_without_assign!(http_method, http_path, body_data = {})
  resp = handling_errors do
    connection.send(http_method, http_path) do |req|
      req.headers['Content-Type'] = 'application/json'
      req.body = JSON.dump(body_data)
    end
  end
  ChartMogul::Utils::JSONParser.parse(resp.body, immutable_keys: immutable_keys)
end