diff --git a/README.rdoc b/README.rdoc index af6d1dd..f8ec88a 100644 --- a/README.rdoc +++ b/README.rdoc @@ -19,15 +19,16 @@ This Gem requires that you have an Http:BL API key from Project Honeypot. You ca == Usage + require 'project_honeypot' + HTTP:BL lookups through Project Honeypot result in a Url object that gives you the risk score, last activity, and types of offenses the ip address is listed for. The score is worse the higher it is and the last_activity is in days. + === Example #1: Suspicious IP Address -Given an api key of "abcdefghijkl" - - @listing = ProjectHoneypot.lookup("abcdefghijkl", "192.168.1.1") + @listing = ProjectHoneypot.lookup("", "") @listing.safe? # => false @@ -60,7 +61,7 @@ Given an api key of "abcdefghijkl" === Example #2: Safe IP Address - @listing = ProjectHoneypot.lookup("192.168.1.1") + @listing = ProjectHoneypot.lookup("") @listing.safe? # => true diff --git a/lib/project-honeypot.rb b/lib/project-honeypot.rb deleted file mode 100644 index 3db5d09..0000000 --- a/lib/project-honeypot.rb +++ /dev/null @@ -1 +0,0 @@ -require "project_honeypot" diff --git a/lib/project_honeypot.rb b/lib/project_honeypot.rb index 5d5ac47..42b2ee1 100644 --- a/lib/project_honeypot.rb +++ b/lib/project_honeypot.rb @@ -18,12 +18,12 @@ module ProjectHoneypot end end - def self.lookup(api_key_or_url, url=nil) - if url.nil? - url = api_key_or_url - api_key_or_url = ProjectHoneypot.api_key - end - searcher = Base.new(api_key_or_url) + def self.lookup(url, api_key=nil) + api_key ||= ProjectHoneypot.api_key + + raise ArgumentError, 'Must specify an API key' unless api_key + + searcher = Base.new(api_key) searcher.lookup(url) end end