Method: LucidIntercom::PostRequest#call

Defined in:
lib/lucid_intercom/post_request.rb

#call(path, data) ⇒ Response

Parameters:

  • path (String)

    path relative to the domain

  • data (Hash)

Returns:



20
21
22
23
24
25
26
27
28
# File 'lib/lucid_intercom/post_request.rb', line 20

def call(path, data)
  res = @http.headers(
    'Authorization' => "Bearer #{LucidIntercom.config.access_token}",
    'Accept' => 'application/json',
    'Content-Type' => 'application/json'
  ).post("https://api.intercom.io/#{path}", json: data)

  Response.new(res.code, res.headers.to_h, res.to_s)
end