Class: Spanx::Notifier::Campfire

Inherits:
Base
  • Object
show all
Defined in:
lib/spanx/notifier/campfire.rb

Overview

Notify Campfire room of a new IP blocked

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#accountObject

Returns the value of attribute account.



8
9
10
# File 'lib/spanx/notifier/campfire.rb', line 8

def 
  @account
end

#room_idObject

Returns the value of attribute room_id.



8
9
10
# File 'lib/spanx/notifier/campfire.rb', line 8

def room_id
  @room_id
end

#tokenObject

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(, room_id, token)
  @account = 
  @room_id = room_id
  @token = token
end

#enabled?Boolean

Returns:

  • (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 generate_block_ip_message(blocked_ip) if enabled?
end