Class: AddressBook::Rambler
Constant Summary collapse
- LOGIN_URL =
"http://id.rambler.ru/script/auth.cgi"
- ADDRESS_BOOK_URL =
"http://mail.rambler.ru/mail/contacts.cgi"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(login, password) ⇒ Rambler
constructor
A new instance of Rambler.
Methods inherited from Base
Constructor Details
#initialize(login, password) ⇒ Rambler
Returns a new instance of Rambler.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/address_book/rambler.rb', line 8 def initialize(login, password) response = session.post LOGIN_URL, { :login => login, :domain => AddressBook.extract_domain(login), :passw => password } if response.body.index "errorbox" raise AuthenticationError, "Username or password are incorrect" end response = session.get ADDRESS_BOOK_URL self.contacts = Nokogiri::XML.parse(response.body).css("#mailbox-list tbody tr").map do |e| name = e.at_css(".mtbox-name").content.strip email = e.at_css(".mtbox-email").content.strip [name, email] end end |