Sha256: 4886ab362d756772da79ec5932bd46170b15fd4a325719d67186012a460d231b

Contents?: true

Size: 667 Bytes

Versions: 8

Compression:

Stored size: 667 Bytes

Contents

module Intercom
  module ApiOperations
    module Find
      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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
intercom-3.5.9 lib/intercom/api_operations/find.rb
intercom-3.5.8 lib/intercom/api_operations/find.rb
intercom-3.5.7 lib/intercom/api_operations/find.rb
intercom-3.5.6 lib/intercom/api_operations/find.rb
intercom-3.5.5 lib/intercom/api_operations/find.rb
intercom-3.5.4 lib/intercom/api_operations/find.rb
intercom-3.5.3 lib/intercom/api_operations/find.rb
intercom-3.5.2 lib/intercom/api_operations/find.rb