Class: FastlyNsq::TlsOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/fastly_nsq/tls_options.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context = nil) ⇒ TlsOptions

Returns a new instance of TlsOptions.



12
13
14
# File 'lib/fastly_nsq/tls_options.rb', line 12

def initialize(context = nil)
  @context = context || {}
end

Class Method Details

.as_hash(context = nil) ⇒ Object

Return hash of TLS options for creating an NSQ connection.

Parameters:

  • context (Hash) (defaults to: nil)


8
9
10
# File 'lib/fastly_nsq/tls_options.rb', line 8

def self.as_hash(context = nil)
  new(context).to_h
end

Instance Method Details

#to_hObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fastly_nsq/tls_options.rb', line 16

def to_h
  merge_contexts
  if @context.empty?
    {}
  else
    {
      tls_v1: true,
      tls_options: @context
    }
  end
end