Class: Krakow::Command::Identify

Inherits:
Krakow::Command show all
Defined in:
lib/krakow/command/identify.rb

Overview

Update client metadata on server / negotiate features

Instance Attribute Summary

Attributes inherited from Krakow::Command

#response

Attributes collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Krakow::Command

#error?, #name, #ok?, response_for

Methods included from Utils::Lazy

included

Methods included from Utils::Logging

level=, #log

Class Method Details

.errorObject



47
48
49
# File 'lib/krakow/command/identify.rb', line 47

def error
  %w(E_INVALID E_BAD_BODY)
end

.okObject



43
44
45
# File 'lib/krakow/command/identify.rb', line 43

def ok
  %w(OK)
end

Instance Method Details

#deflate[TrueClass, FalseClass]

Returns the deflate attribute.

Returns:

  • ([TrueClass, FalseClass])

    the deflate attribute



24
# File 'lib/krakow/command/identify.rb', line 24

attribute :deflate, [TrueClass, FalseClass]

#deflate?TrueClass, FalseClass

Returns truthiness of the deflate attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the deflate attribute



24
# File 'lib/krakow/command/identify.rb', line 24

attribute :deflate, [TrueClass, FalseClass]

#deflate_levelInteger

Returns the deflate_level attribute.

Returns:

  • (Integer)

    the deflate_level attribute



25
# File 'lib/krakow/command/identify.rb', line 25

attribute :deflate_level, Integer

#deflate_level?TrueClass, FalseClass

Returns truthiness of the deflate_level attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the deflate_level attribute



25
# File 'lib/krakow/command/identify.rb', line 25

attribute :deflate_level, Integer

#feature_negotiation[TrueClass, FalseClass]

Returns the feature_negotiation attribute.

Returns:

  • ([TrueClass, FalseClass])

    the feature_negotiation attribute



18
# File 'lib/krakow/command/identify.rb', line 18

attribute :feature_negotiation, [TrueClass, FalseClass]

#feature_negotiation?TrueClass, FalseClass

Returns truthiness of the feature_negotiation attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the feature_negotiation attribute



18
# File 'lib/krakow/command/identify.rb', line 18

attribute :feature_negotiation, [TrueClass, FalseClass]

#heartbeat_intervalNumeric

Returns the heartbeat_interval attribute.

Returns:

  • (Numeric)

    the heartbeat_interval attribute



19
# File 'lib/krakow/command/identify.rb', line 19

attribute :heartbeat_interval, Numeric

#heartbeat_interval?TrueClass, FalseClass

Returns truthiness of the heartbeat_interval attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the heartbeat_interval attribute



19
# File 'lib/krakow/command/identify.rb', line 19

attribute :heartbeat_interval, Numeric

#long_id[String, Numeric]

Returns the long_id attribute.

Returns:

  • ([String, Numeric])

    the long_id attribute



17
# File 'lib/krakow/command/identify.rb', line 17

attribute :long_id, [String, Numeric], :required => true

#long_id?TrueClass, FalseClass

Returns truthiness of the long_id attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the long_id attribute



17
# File 'lib/krakow/command/identify.rb', line 17

attribute :long_id, [String, Numeric], :required => true

#output_buffer_sizeInteger

Returns the output_buffer_size attribute.

Returns:

  • (Integer)

    the output_buffer_size attribute



20
# File 'lib/krakow/command/identify.rb', line 20

attribute :output_buffer_size, Integer

#output_buffer_size?TrueClass, FalseClass

Returns truthiness of the output_buffer_size attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the output_buffer_size attribute



20
# File 'lib/krakow/command/identify.rb', line 20

attribute :output_buffer_size, Integer

#output_buffer_timeoutInteger

Returns the output_buffer_timeout attribute.

Returns:

  • (Integer)

    the output_buffer_timeout attribute



21
# File 'lib/krakow/command/identify.rb', line 21

attribute :output_buffer_timeout, Integer

#output_buffer_timeout?TrueClass, FalseClass

Returns truthiness of the output_buffer_timeout attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the output_buffer_timeout attribute



21
# File 'lib/krakow/command/identify.rb', line 21

attribute :output_buffer_timeout, Integer

#sample_rateInteger

Returns the sample_rate attribute.

Returns:

  • (Integer)

    the sample_rate attribute



26
# File 'lib/krakow/command/identify.rb', line 26

attribute :sample_rate, Integer

#sample_rate?TrueClass, FalseClass

Returns truthiness of the sample_rate attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the sample_rate attribute



26
# File 'lib/krakow/command/identify.rb', line 26

attribute :sample_rate, Integer

#short_id[String, Numeric]

Returns the short_id attribute.

Returns:

  • ([String, Numeric])

    the short_id attribute



16
# File 'lib/krakow/command/identify.rb', line 16

attribute :short_id, [String, Numeric], :required => true

#short_id?TrueClass, FalseClass

Returns truthiness of the short_id attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the short_id attribute



16
# File 'lib/krakow/command/identify.rb', line 16

attribute :short_id, [String, Numeric], :required => true

#snappy[TrueClass, FalseClass]

Returns the snappy attribute.

Returns:

  • ([TrueClass, FalseClass])

    the snappy attribute



23
# File 'lib/krakow/command/identify.rb', line 23

attribute :snappy, [TrueClass, FalseClass]

#snappy?TrueClass, FalseClass

Returns truthiness of the snappy attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the snappy attribute



23
# File 'lib/krakow/command/identify.rb', line 23

attribute :snappy, [TrueClass, FalseClass]

#tls_v1[TrueClass, FalseClass]

Returns the tls_v1 attribute.

Returns:

  • ([TrueClass, FalseClass])

    the tls_v1 attribute



22
# File 'lib/krakow/command/identify.rb', line 22

attribute :tls_v1, [TrueClass, FalseClass]

#tls_v1?TrueClass, FalseClass

Returns truthiness of the tls_v1 attribute.

Returns:

  • (TrueClass, FalseClass)

    truthiness of the tls_v1 attribute



22
# File 'lib/krakow/command/identify.rb', line 22

attribute :tls_v1, [TrueClass, FalseClass]

#to_lineObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/krakow/command/identify.rb', line 30

def to_line
  filtered = Hash[*
    arguments.map do |key, value|
      unless(value.nil?)
        [key, value]
      end
    end.compact.flatten
  ]
  payload = MultiJson.dump(filtered)
  [name, "\n", payload.bytesize, payload].pack('a*a*l>a*')
end