Class: AddressBookImporter::Importer

Inherits:
Object
  • Object
show all
Defined in:
lib/address_book_importer.rb

Direct Known Subclasses

Gmail, Hotmail, Yahoo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(login, password) ⇒ Importer

Returns a new instance of Importer.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/address_book_importer.rb', line 16

def initialize(, password)
  begin
    @agent = ::WWW::Mechanize.new {|a| a.log = nil }
    #@agent.user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"
    @agent.user_agent = "Mozilla/5.0 (X11; U; Linux i686; en; rv:1.8.1.1) Gecko/20060601 Epiphany/2.16 Firefox/2.0.0.1 (Ubuntu-edgy)"
    p = (, password)
    @contacts = fetch_contacts(p)
  rescue Exception => e
    raise ParseException.new("Error parsing website + " + e.to_s + e.backtrace.inspect)
  end
  raise EmptyEmailException if @contacts.empty?
end

Instance Attribute Details

#agentObject

Returns the value of attribute agent.



14
15
16
# File 'lib/address_book_importer.rb', line 14

def agent
  @agent
end

#contactsObject

Returns the value of attribute contacts.



14
15
16
# File 'lib/address_book_importer.rb', line 14

def contacts
  @contacts
end

Instance Method Details

#fetch_contacts(page) ⇒ Object



32
33
# File 'lib/address_book_importer.rb', line 32

def fetch_contacts(page)
end

#login(login, pass) ⇒ Object



29
30
# File 'lib/address_book_importer.rb', line 29

def (, pass)
end