Class: Pubby::Pubnub
- Inherits:
-
Object
- Object
- Pubby::Pubnub
- Defined in:
- lib/pubby/pubnub.rb
Instance Attribute Summary collapse
-
#pubnub ⇒ Object
readonly
Returns the value of attribute pubnub.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(pubnub) ⇒ Pubnub
constructor
A new instance of Pubnub.
- #publish(channel_name, message) ⇒ Object
Constructor Details
#initialize(pubnub) ⇒ Pubnub
Returns a new instance of Pubnub.
7 8 9 |
# File 'lib/pubby/pubnub.rb', line 7 def initialize(pubnub) @pubnub = pubnub end |
Instance Attribute Details
#pubnub ⇒ Object (readonly)
Returns the value of attribute pubnub.
5 6 7 |
# File 'lib/pubby/pubnub.rb', line 5 def pubnub @pubnub end |
Class Method Details
.from_config(config) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pubby/pubnub.rb', line 15 def self.from_config(config) new( Pubnub.new( config.fetch('publish_key') { raise "publish_key is required" }, config.fetch('subscribe_key', ''), config.fetch('secret_key', ''), config.fetch('ssl_on', false) ) ) end |
Instance Method Details
#publish(channel_name, message) ⇒ Object
11 12 13 |
# File 'lib/pubby/pubnub.rb', line 11 def publish(channel_name, ) @pubnub.publish('channel' => channel_name, 'message' => ) end |