Class: Poke::Checks::Blacklist::FreeBlacklistCheck
- Inherits:
-
Poke::Check
- Object
- Poke::Check
- Poke::Checks::Blacklist::FreeBlacklistCheck
- Defined in:
- lib/poke/checks/blacklist/free_blacklist_check.rb
Instance Attribute Summary
Attributes inherited from Poke::Check
Instance Method Summary collapse
-
#initialize(ip) ⇒ FreeBlacklistCheck
constructor
A new instance of FreeBlacklistCheck.
-
#run ⇒ Object
Run the check.
Constructor Details
#initialize(ip) ⇒ FreeBlacklistCheck
Returns a new instance of FreeBlacklistCheck.
17 18 19 20 21 |
# File 'lib/poke/checks/blacklist/free_blacklist_check.rb', line 17 def initialize(ip) name = "Blacklist of #{ip} (postmaster free)" @ip = ip super name end |
Instance Method Details
#run ⇒ Object
Run the check
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/poke/checks/blacklist/free_blacklist_check.rb', line 24 def run html = URI.parse("http://postmaster.free.fr/showipstate.pl?ip=#{@ip}").read doc = Nokogiri::HTML(html) nodes = doc.search("//div[@class='level1']/font") = nodes.at(0).inner_text if =~ /blacklist/ return :error, end return :ok, end |