Sha256: eb07fd6e2386c0c45faef5bf6d05a6cd3a551c4c4f97d728086bcf21ff564fde

Contents?: true

Size: 693 Bytes

Versions: 33

Compression:

Stored size: 693 Bytes

Contents

require 'intercom/utils'

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

33 entries across 33 versions & 1 rubygems

Version Path
intercom-3.9.5 lib/intercom/api_operations/find.rb
intercom-3.9.4 lib/intercom/api_operations/find.rb
intercom-3.9.3 lib/intercom/api_operations/find.rb
intercom-3.9.2 lib/intercom/api_operations/find.rb
intercom-3.9.0 lib/intercom/api_operations/find.rb
intercom-3.8.1 lib/intercom/api_operations/find.rb
intercom-3.8.0 lib/intercom/api_operations/find.rb
intercom-3.7.7 lib/intercom/api_operations/find.rb
intercom-3.7.6 lib/intercom/api_operations/find.rb
intercom-3.7.5 lib/intercom/api_operations/find.rb
intercom-3.7.4 lib/intercom/api_operations/find.rb
intercom-3.7.3 lib/intercom/api_operations/find.rb
intercom-3.7.2 lib/intercom/api_operations/find.rb
intercom-3.7.1 lib/intercom/api_operations/find.rb
intercom-3.7.0 lib/intercom/api_operations/find.rb
intercom-3.6.2 lib/intercom/api_operations/find.rb
intercom-3.6.1 lib/intercom/api_operations/find.rb
intercom-3.6.0 lib/intercom/api_operations/find.rb
intercom-3.5.26 lib/intercom/api_operations/find.rb
intercom-3.5.25 lib/intercom/api_operations/find.rb