Class: Hypertube::Utils::Http2ConnectionData

Inherits:
ConnectionData show all
Defined in:
lib/hypertube-ruby-sdk/utils/http2_connection_data.rb

Constant Summary collapse

DEFAULT_CONNECT_TIMEOUT_SECONDS =
60

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ConnectionData

#add_header, #add_headers, #headers, #set_headers

Constructor Details

#initialize(hostname, timeout = DEFAULT_CONNECT_TIMEOUT_SECONDS) ⇒ Http2ConnectionData

Returns a new instance of Http2ConnectionData.



11
12
13
14
15
# File 'lib/hypertube-ruby-sdk/utils/http2_connection_data.rb', line 11

def initialize(hostname, timeout = DEFAULT_CONNECT_TIMEOUT_SECONDS)
  super()
  @hostname = hostname
  @timeout = timeout
end

Instance Attribute Details

#hostnameObject

Returns the value of attribute hostname.



9
10
11
# File 'lib/hypertube-ruby-sdk/utils/http2_connection_data.rb', line 9

def hostname
  @hostname
end

#timeoutObject

Returns the value of attribute timeout.



9
10
11
# File 'lib/hypertube-ruby-sdk/utils/http2_connection_data.rb', line 9

def timeout
  @timeout
end

Instance Method Details

#connection_typeObject



17
18
19
# File 'lib/hypertube-ruby-sdk/utils/http2_connection_data.rb', line 17

def connection_type
  Hypertube::Utils::ConnectionType::HTTP2
end

#serialize_connection_dataObject



21
22
23
# File 'lib/hypertube-ruby-sdk/utils/http2_connection_data.rb', line 21

def serialize_connection_data
  [connection_type, 0, 0, 0, 0, 0, 0]
end

#to_canonical_keyObject



29
30
31
32
33
34
# File 'lib/hypertube-ruby-sdk/utils/http2_connection_data.rb', line 29

def to_canonical_key
  headers_for_key = serialize_headers_for_key
  return to_s if headers_for_key.empty?

  "#{to_s}|h:#{headers_for_key}"
end

#to_sObject



25
26
27
# File 'lib/hypertube-ruby-sdk/utils/http2_connection_data.rb', line 25

def to_s
  "http2|#{@hostname}"
end