Method: Frontapp::Client#create

Defined in:
lib/frontapp/client.rb

#create(path, body) ⇒ Object



63
64
65
66
67
68
69
70
# File 'lib/frontapp/client.rb', line 63

def create(path, body)
  res = @headers.post("#{base_url}#{path}", json: body)
  response = JSON.parse(res.to_s)
  if !res.status.success?
    raise "Response: #{res.inspect}\n Body: #{res.body}\nRequest: #{body.to_json.inspect}"
  end
  response
end