Sha256: 6bf0664bfea1c1c2274747c8a92db62311c18fa4d120e901e8ad3b591815865d

Contents?: true

Size: 965 Bytes

Versions: 2

Compression:

Stored size: 965 Bytes

Contents

module HBase
  module Request
    class RowRequest < BasicRequest
      attr_reader :table_name
      attr_reader :name
      attr_reader :timestamp

      def initialize(table_name, name, timestamp=nil)
        @table_name, @name, @timestamp = CGI.escape(table_name), CGI.escape(name), timestamp
        path = "/#{@table_name}/#{@name}"
        super(path)
      end

      def show(columns = nil, options = { })
        @path << (columns ? "/#{pack_params(columns)}" : "/")
        @path << "/#{@timestamp}" if @timestamp
        @path << "?v=#{options[:version]}" if options[:version]
        @path
      end

      def create(columns = nil)
        @path << (columns ? "/#{pack_params(columns)}" : "/")
        @path << "/#{@timestamp}" if @timestamp
        @path
      end

      def delete(columns = nil)
        @path << (columns ? "/#{pack_params(columns)}" : "/")
        @path << "/#{@timestamp}" if @timestamp
        @path
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hbase-ruby-1.2.0 lib/hbase/request/row_request.rb
hbase-ruby-1.1.3 lib/hbase/request/row_request.rb