Module: Intercom::ApiOperations::FindAll

Instance Method Summary collapse

Instance Method Details

#find_all(params) ⇒ Object

Raises:



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

def find_all(params)
  raise BadRequestError, "#find takes a hash as its parameter but you supplied #{params.inspect}" unless params.is_a? Hash

  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, collection_class, details: finder_details, client: @client)
end