Class: AddressBook::MailRu
Constant Summary collapse
- LOGIN_URL =
"https://auth.mail.ru/cgi-bin/auth"
- ADDRESS_BOOK_URL =
"http://e.mail.ru/cgi-bin/abexport/addressbook.csv"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(login, password) ⇒ MailRu
constructor
A new instance of MailRu.
Methods inherited from Base
Constructor Details
#initialize(login, password) ⇒ MailRu
Returns a new instance of MailRu.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/address_book/mailru.rb', line 10 def initialize(login, password) response = session.post LOGIN_URL, { :Login => login, :Domain => AddressBook.extract_domain(login), :Password => password } if response.body.index "fail=1" raise AuthenticationError, "Username or password are incorrect" end response = session.post ADDRESS_BOOK_URL, { :confirm => 1, :abtype => 6 } self.contacts = CSV.parse(response.body).drop(1).map do |row| [row[0], row[4]] end end |