Module: Intercom::ApiOperations::Load

Instance Method Summary collapse

Instance Method Details

#load(object) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/intercom/api_operations/load.rb', line 8

def load(object)
  if object.id
    response = @client.get("/#{collection_name}/#{object.id}", {})
  else
    raise "Cannot load #{collection_class} as it does not have a valid id."
  end
  raise Intercom::HttpError, 'Http Error - No response entity returned' unless response

  object.from_response(response)
end