Module: Intercom::ApiOperations::FindAll

Instance Method Summary collapse

Instance Method Details

#find_all(params) ⇒ Object

Raises:


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

def find_all(params)
  raise BadRequestError, "#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)
  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
  collection_proxy_class.new(collection_name, finder_details: finder_details,  client: @client)
end