Class: ForeignOffice::Busses::PusherBus
- Inherits:
-
GenericBus
- Object
- GenericBus
- ForeignOffice::Busses::PusherBus
- Defined in:
- lib/foreign_office/busses/pusher_bus.rb
Class Method Summary collapse
- .app_id ⇒ Object
- .app_id=(app_id) ⇒ Object
- .config(config) ⇒ Object
- .connection ⇒ Object
- .key ⇒ Object
- .key=(key) ⇒ Object
- .publish(message) ⇒ Object
- .secret ⇒ Object
- .secret=(secret) ⇒ Object
Methods inherited from GenericBus
Class Method Details
.app_id ⇒ Object
12 13 14 |
# File 'lib/foreign_office/busses/pusher_bus.rb', line 12 def self.app_id @app_id end |
.app_id=(app_id) ⇒ Object
8 9 10 |
# File 'lib/foreign_office/busses/pusher_bus.rb', line 8 def self.app_id=(app_id) @app_id = app_id end |
.config(config) ⇒ Object
2 3 4 5 6 |
# File 'lib/foreign_office/busses/pusher_bus.rb', line 2 def self.config(config) self.app_id = config[:app_id] self.key = config[:key] self.secret = config[:secret] end |
.connection ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/foreign_office/busses/pusher_bus.rb', line 32 def self.connection @pusher ||= Pusher::Client.new({ app_id: self.app_id, key: self.key, secret: self.secret }) end |
.key ⇒ Object
20 21 22 |
# File 'lib/foreign_office/busses/pusher_bus.rb', line 20 def self.key @key end |
.key=(key) ⇒ Object
16 17 18 |
# File 'lib/foreign_office/busses/pusher_bus.rb', line 16 def self.key=(key) @key = key end |
.publish(message) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/foreign_office/busses/pusher_bus.rb', line 40 def self.publish() .symbolize_keys! self.connection.trigger( [:channel], 'publish', ) end |
.secret ⇒ Object
28 29 30 |
# File 'lib/foreign_office/busses/pusher_bus.rb', line 28 def self.secret @secret end |
.secret=(secret) ⇒ Object
24 25 26 |
# File 'lib/foreign_office/busses/pusher_bus.rb', line 24 def self.secret=(secret) @secret = secret end |