Module: Intercom::ApiOperations::Load

Included in:
Company, Contact, Conversation, Note, User
Defined in:
lib/intercom/api_operations/load.rb

Instance Method Summary collapse

Instance Method Details

#loadObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/intercom/api_operations/load.rb', line 4

def load
  collection_name = Utils.resource_class_to_collection_name(self.class)
  if id
    response = Intercom.get("/#{collection_name}/#{id}", {})
  else
    raise "Cannot load #{self.class} as it does not have a valid id."
  end
  raise Intercom::HttpError.new('Http Error - No response entity returned') unless response
  from_response(response)
end