Class: RBKubeMQ::Client

Inherits:
Object
  • Object
show all
Includes:
Check
Defined in:
lib/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Check

#is_class?, #is_in_list?

Constructor Details

#initialize(host:, port: "9090", tls: false) ⇒ Client

Returns a new instance of Client.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/client.rb', line 5

def initialize(host:, port: "9090", tls: false)
  @host = host
  @port = port
  is_class?(tls, [FalseClass, TrueClass], "tls")
  @tls  = tls
  @uri = "http"
  @uri += "s" if @tls
  @uri += "://#{host}:#{port}"
  @ws = "ws"
  @ws += "s" if @tls
  @ws += "://#{host}:#{port}"
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



18
19
20
# File 'lib/client.rb', line 18

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



18
19
20
# File 'lib/client.rb', line 18

def port
  @port
end

#tlsObject (readonly)

Returns the value of attribute tls.



18
19
20
# File 'lib/client.rb', line 18

def tls
  @tls
end

#uriObject (readonly)

Returns the value of attribute uri.



18
19
20
# File 'lib/client.rb', line 18

def uri
  @uri
end

#wsObject (readonly)

Returns the value of attribute ws.



18
19
20
# File 'lib/client.rb', line 18

def ws
  @ws
end

Instance Method Details

#sender(*args) ⇒ Object



20
21
22
23
24
# File 'lib/client.rb', line 20

def sender(*args)
  args[0] ||= {}
  args[0][:client] = self if args[0].is_a?(Hash)
  RBKubeMQ::Sender.new(*args)
end

#streamer(*args) ⇒ Object



26
27
28
29
30
# File 'lib/client.rb', line 26

def streamer(*args)
  args[0] ||= {}
  args[0][:client] = self if args[0].is_a?(Hash)
  RBKubeMQ::Streamer.new(*args)
end

#subscriber(*args) ⇒ Object



32
33
34
35
36
# File 'lib/client.rb', line 32

def subscriber(*args)
  args[0] ||= {}
  args[0][:client] = self if args[0].is_a?(Hash)
  RBKubeMQ::Subscriber.new(*args)
end