Class: Spanx::Notifier::Campfire
- Defined in:
- lib/spanx/notifier/campfire.rb
Overview
Notify Campfire room of a new IP blocked
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#room_id ⇒ Object
Returns the value of attribute room_id.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #_init(account, room_id, token) ⇒ Object
- #enabled? ⇒ Boolean
-
#initialize(config) ⇒ Campfire
constructor
A new instance of Campfire.
- #publish(blocked_ip) ⇒ Object
Constructor Details
#initialize(config) ⇒ Campfire
Returns a new instance of Campfire.
10 11 12 13 14 15 |
# File 'lib/spanx/notifier/campfire.rb', line 10 def initialize(config) @enabled = config[:campfire][:enabled] if self.enabled? _init(config[:campfire][:account], config[:campfire][:room_id], config[:campfire][:token]) end end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
8 9 10 |
# File 'lib/spanx/notifier/campfire.rb', line 8 def account @account end |
#room_id ⇒ Object
Returns the value of attribute room_id.
8 9 10 |
# File 'lib/spanx/notifier/campfire.rb', line 8 def room_id @room_id end |
#token ⇒ Object
Returns the value of attribute token.
8 9 10 |
# File 'lib/spanx/notifier/campfire.rb', line 8 def token @token end |
Instance Method Details
#_init(account, room_id, token) ⇒ Object
21 22 23 24 25 |
# File 'lib/spanx/notifier/campfire.rb', line 21 def _init(account, room_id, token) @account = account @room_id = room_id @token = token end |
#enabled? ⇒ Boolean
27 28 29 |
# File 'lib/spanx/notifier/campfire.rb', line 27 def enabled? @enabled end |
#publish(blocked_ip) ⇒ Object
17 18 19 |
# File 'lib/spanx/notifier/campfire.rb', line 17 def publish(blocked_ip) speak (blocked_ip) if enabled? end |