Sha256: ac0a4dd0a64b8732ba3f82ea05371ae19075cc8a6e32ab8430641ce9829f2589

Contents?: true

Size: 727 Bytes

Versions: 5

Compression:

Stored size: 727 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?
        true
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
proxes-0.8.4 lib/proxes/request/cat.rb
proxes-0.8.3 lib/proxes/request/cat.rb
proxes-0.8.2 lib/proxes/request/cat.rb
proxes-0.8.1 lib/proxes/request/cat.rb
proxes-0.8.0 lib/proxes/request/cat.rb