Sha256: 7187c467ab0bebf343f40a0e39d50365b599f738d76c1586a44fea3e166b1c08

Contents?: true

Size: 870 Bytes

Versions: 1

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

require 'proxes/request'
require 'proxes/policies/request/cat_policy'

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

      def index=(idx)
        @index = idx
        self.path_info = '/' + [endpoint, type, index].compact
                                                      .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?
        return false if type.nil?

        %w[shards indices segments count recovery].include? type.first
      end

      def indices
        @index || []
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
proxes-0.10.1 lib/proxes/request/cat.rb