Sha256: ff7f3bff41a8ab98d01626d801e2b44df5fb7c85c8404dfcc4a255d089d2d914

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module HBase
  module Response
    class ScannerResponse < BasicResponse
      attr_reader :method

      def initialize(raw_data, method)
        @method = method
        super(raw_data)
      end

      def parse_content(raw_data)
        case @method
        when :open_scanner
          case raw_data
          when Net::HTTPCreated
            HBase::Model::Scanner.new(:scanner_url => raw_data["Location"])
          else
            raise StandardError, "Unable to open scanner. Received the following message: #{raw_data.message}"
          end
        when :get_rows
          # Dispatch it to RowResponse, since that method is made
          # to deal with rows already.
          RowResponse.new(raw_data).parse
        when :close_scanner
          case raw_data
          when Net::HTTPOK
            return true
          else
            raise StandardError, "Unable to close scanner. Received the following message: #{raw_data.message}"
          end
        else
          puts "method '#{@method}' not supported yet"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hbase-ruby-1.1.0 lib/hbase/response/scanner_response.rb