Module: Intercom::ApiOperations::FindAll::ClassMethods

Defined in:
lib/intercom/api_operations/find_all.rb

Instance Method Summary collapse

Instance Method Details

#find_all(params) ⇒ Object

Raises:



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

def find_all(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(self)
  finder_details = {}
  if params[:id] && !type_switched_finder?(params)
    finder_details[:url] = "/#{collection_name}/#{params[:id]}"
    finder_details[:params] = {}
  else
    finder_details[:url] = "/#{collection_name}"
    finder_details[:params] = params
  end
  CollectionProxy.new(collection_name, finder_details)
end