module ContactDetective

Constants

VERSION

Public Class Methods

addresses(link) click to toggle source
# File lib/ContactDetective.rb, line 19
def self.addresses(link)
  text = ContactDetective::gethtmlfromlink(link)
  citystatezip = ContactDetective::Addresses.citystatezip(text)
  streets = ContactDetective::Addresses.getstreets(text)
  return citystatezip + streets
end
allcontacts(link) click to toggle source

creates Hash object of all contact data

# File lib/ContactDetective.rb, line 26
def self.allcontacts(link)
  contacts = Hash.new()
  contacts['emails'] = emails(link)
  contacts['phonenumbers'] = phonenumbers(link)
  contacts['addresses'] = addresses(link)
  return contacts
end
contactsjson(link, name) click to toggle source

writes the contact data to a json file

# File lib/ContactDetective.rb, line 34
def self.contactsjson(link, name)
  require 'json'
  contact = allcontacts(link).to_json
  File.open(name, 'w') { |file| file.write(contact) }
end
emails(link) click to toggle source

gets all emails from a link

# File lib/ContactDetective.rb, line 11
def self.emails(link)
  text = ContactDetective::gethtmlfromlink(link)
  text.scan(/[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-z]+/)
end
phonenumbers(link) click to toggle source
# File lib/ContactDetective.rb, line 15
def self.phonenumbers(link)
  text = ContactDetective::gethtmlfromlink(link)
  ContactDetective::Phonenumbers.getallnumbers(text)
end