Module: NginxStreamPusher

Extended by:
NginxStreamPusher
Included in:
NginxStreamPusher
Defined in:
lib/nginx_stream_pusher.rb

Constant Summary collapse

RootCA =
'/etc/ssl/certs'
DEFAULT_URL =
Addressable::URI.parse 'https://localhost:8123/live-pub'
DEFAULT_TIMEOUT =
10
@@base_url =
nil
@@user =
nil
@@pass =
nil
@@timeout =
nil

Instance Method Summary collapse

Instance Method Details

#base_urlObject



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

def base_url
  @@base_url || DEFAULT_URL
end

#base_url=(url) ⇒ Object



15
16
17
# File 'lib/nginx_stream_pusher.rb', line 15

def base_url=(url)
  @@base_url = Addressable::URI.parse url
end

#passObject



34
35
36
# File 'lib/nginx_stream_pusher.rb', line 34

def pass
  @@pass
end

#pass=(password) ⇒ Object



31
32
33
# File 'lib/nginx_stream_pusher.rb', line 31

def pass=(password)
  @@pass = password
end

#publish!(channel, text) ⇒ Object



46
47
48
49
50
# File 'lib/nginx_stream_pusher.rb', line 46

def publish!(channel, text)
  url = base_url.dup
  url.query_values = { :id => channel }
  post_url(url, text)
end

#timeoutObject



42
43
44
# File 'lib/nginx_stream_pusher.rb', line 42

def timeout
  @@timeout || DEFAULT_TIMEOUT
end

#timeout=(new_timeout) ⇒ Object



39
40
41
# File 'lib/nginx_stream_pusher.rb', line 39

def timeout=(new_timeout)
  @@timeout = new_timeout
end

#userObject



26
27
28
# File 'lib/nginx_stream_pusher.rb', line 26

def user
  @@user
end

#user=(username) ⇒ Object



23
24
25
# File 'lib/nginx_stream_pusher.rb', line 23

def user=(username)
  @@user = username
end