Sha256: ee16997fae9cd2a93e9a074047c1bb95655723275256f62ef9724da85667572e

Contents?: true

Size: 1020 Bytes

Versions: 7

Compression:

Stored size: 1020 Bytes

Contents

module Kafka
  module Protocol

    class ApiVersionsResponse
      class ApiInfo
        attr_reader :api_key, :min_version, :max_version

        def initialize(api_key:, min_version:, max_version:)
          @api_key, @min_version, @max_version = api_key, min_version, max_version
        end

        def api_name
          Protocol.api_name(api_key)
        end

        def to_s
          "#{api_name}=#{min_version}..#{max_version}"
        end

        def inspect
          "#<Kafka api version #{to_s}>"
        end
      end

      attr_reader :error_code, :apis

      def initialize(error_code:, apis:)
        @error_code = error_code
        @apis = apis
      end

      def self.decode(decoder)
        error_code = decoder.int16

        apis = decoder.array do
          ApiInfo.new(
            api_key: decoder.int16,
            min_version: decoder.int16,
            max_version: decoder.int16,
          )
        end

        new(error_code: error_code, apis: apis)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruby-kafka-0.5.2 lib/kafka/protocol/api_versions_response.rb
ruby-kafka-0.5.2.beta3 lib/kafka/protocol/api_versions_response.rb
ruby-kafka-0.5.2.beta2 lib/kafka/protocol/api_versions_response.rb
ruby-kafka-0.5.2.beta1 lib/kafka/protocol/api_versions_response.rb
ruby-kafka-0.5.1 lib/kafka/protocol/api_versions_response.rb
ruby-kafka-0.5.1.beta2 lib/kafka/protocol/api_versions_response.rb
ruby-kafka-0.5.1.beta1 lib/kafka/protocol/api_versions_response.rb