Class: PGP
Instance Attribute Summary collapse
-
#emails ⇒ Object
Returns the value of attribute emails.
Instance Method Summary collapse
-
#initialize(maxhits = 0) ⇒ PGP
constructor
A new instance of PGP.
- #search(query) ⇒ Object
Methods included from Searchy
#clean, #fix, #hash_url, #maxhits=, #print_emails, #search_depth, #search_docs, #search_emails, #search_office_xml, #search_pdfs, #search_txts
Constructor Details
#initialize(maxhits = 0) ⇒ PGP
Returns a new instance of PGP.
8 9 10 11 12 |
# File 'lib/esearchy/OtherEngines/pgp.rb', line 8 def initialize(maxhits=0) @totalhits = maxhits @emails = [] @lock = Mutex.new end |
Instance Attribute Details
#emails ⇒ Object
Returns the value of attribute emails.
13 14 15 |
# File 'lib/esearchy/OtherEngines/pgp.rb', line 13 def emails @emails end |
Instance Method Details
#search(query) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/esearchy/OtherEngines/pgp.rb', line 15 def search(query) @query = query http = Net::HTTP.new("pgp.mit.edu",11371) begin http.start do |http| request = Net::HTTP::Get.new( "/pks/lookup?search=#{@query}", {'User-Agent' => UserAgent::fetch}) response = http.request(request) case response when Net::HTTPSuccess, Net::HTTPRedirection ESearchy::LOG.puts "Searching #{self.class}" search_emails(response.body) else return response.error! end end rescue Net::HTTPFatalError ESearchy::LOG.puts "Error: Something went wrong with the HTTP request" end end |