Sha256: 3682a6b471dd12253dccc90ceb11ed086e3e7cf6d3d208557062b3f191bbe483
Contents?: true
Size: 912 Bytes
Versions: 32
Compression:
Stored size: 912 Bytes
Contents
require 'intercom/client_collection_proxy' require 'intercom/utils' module Intercom module ApiOperations module FindAll 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 private def type_switched_finder?(params) params.include?(:type) end end end end
Version data entries
32 entries across 32 versions & 1 rubygems