Sha256: e5c1085eefaec73b291903b27e89cb75d65c461f604efa0eee347d960abe78b5

Contents?: true

Size: 886 Bytes

Versions: 1

Compression:

Stored size: 886 Bytes

Contents

module Picky
  class Client
    
    # TODO Rename?
    #
    # Parameters:
    #   * index_name: An index that exists in the Picky server.
    #   * data: A hash in the form of { :id => 1234, :attr1 => 'attr1', :attr2 => 'attr2', ... }.
    #
    def replace index_name, data
      request Net::HTTP::Post.new(self.path), index_name, data
    end
    
    # TODO Rename?
    #
    # Parameters:
    #   * index_name: An index that exists in the Picky server.
    #   * data: A hash in the form of { :id => 1234 }.
    #
    def remove index_name, data
      request Net::HTTP::Delete.new(self.path), index_name, data
    end
    
    # Sends a request to the Picky server.
    #
    def request request, index_name, data
      request.form_data = { :index => index_name, :data => data }
      Net::HTTP.new(self.host, self.port).start { |http| http.request request }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picky-client-4.0.7 lib/picky-client/client_index.rb