Module: Intercom::ApiOperations::Find

Instance Method Summary collapse

Instance Method Details

#find(params) ⇒ Object

Raises:


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

def find(params)
  raise BadRequestError, "#{self}#find takes a hash as its parameter but you supplied #{params.inspect}" unless params.is_a? Hash
  collection_name = Utils.resource_class_to_collection_name(collection_class)
  if params[:id]
    id = params.delete(:id)
    response = @client.get("/#{collection_name}/#{id}", params)
  else
    response = @client.get("/#{collection_name}", params)
  end
  raise Intercom::HttpError.new('Http Error - No response entity returned') unless response
  from_api(response)
end