Sha256: 99bec41fc0d7f5ef82d5ddd7d4615e73f7de1e71cecda1a154b0f5955069048c

Contents?: true

Size: 636 Bytes

Versions: 6

Compression:

Stored size: 636 Bytes

Contents

# frozen_string_literal: true

require 'rack'
require 'proxes/request'

module ProxES
  class Request
    class Cat < Request
      attr_reader :index, :type, :id

      def index=(idx)
        @index = idx
        self.path_info = '/' + [endpoint, type, index]
                         .map { |v| v.is_a?(Array) ? v.join(',') : v }
                         .select { |v| !v.nil? && v != '' }.join('/')
      end

      def endpoint
        '_cat'
      end

      def parse
        @type  ||= check_part(path_parts[1])
        @index ||= check_part(path_parts[2])
      end

      def indices?
        true
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
proxes-0.6.1 lib/proxes/request/cat.rb
proxes-0.6.0 lib/proxes/request/cat.rb
proxes-0.5.2 lib/proxes/request/cat.rb
proxes-0.5.1 lib/proxes/request/cat.rb
proxes-0.5.0 lib/proxes/request/cat.rb
proxes-0.4.4 lib/proxes/request/cat.rb