Sha256: 23e88ecf12b44884fa18deecbd7bfb3945b181d37cbb28549b27a9ecdc674712

Contents?: true

Size: 668 Bytes

Versions: 2

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true

require 'proxes/request'
require 'proxes/policies/request/index_policy'

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

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

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

      def indices?
        true
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
proxes-0.7.1 lib/proxes/request/index.rb
proxes-0.7.0 lib/proxes/request/index.rb