Class: Contacts::Mailru
Constant Summary collapse
- DETECTED_DOMAINS =
[ /list\.ru/i, /inbox\.ru/i, /bk\.ru/i, /mail\.ru/i ]
- LOGIN_URL =
"https://auth.mail.ru/cgi-bin/auth"
- ADDRESS_BOOK_URL =
"http://e.mail.ru/cgi-bin/abexport/addressbook.csv"
Instance Attribute Summary collapse
-
#cookies ⇒ Object
Returns the value of attribute cookies.
Instance Method Summary collapse
Methods inherited from Base
#connect, #connected?, #initialize, #login, #password
Constructor Details
This class inherits a constructor from Contacts::Base
Instance Attribute Details
#cookies ⇒ Object
Returns the value of attribute cookies.
9 10 11 |
# File 'lib/contacts/mailru.rb', line 9 def @cookies end |
Instance Method Details
#contacts ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/contacts/mailru.rb', line 31 def contacts postdata = "confirm=1&abtype=6" data, resp, , forward = post(ADDRESS_BOOK_URL, postdata, .join(';')) @contacts = [] CSV.parse(data) do |row| @contacts << [row[0], row[4]] unless header_row?(row) end @contacts end |
#real_connect ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/contacts/mailru.rb', line 11 def real_connect username = login postdata = "Login=%s&Domain=%s&Password=%s" % [ CGI.escape(username), CGI.escape(domain_param(username)), CGI.escape(password) ] data, resp, self., forward = post(LOGIN_URL, postdata, "") if data.index("fail=1") raise AuthenticationError, "Username and password do not match" elsif == "" or data == "" raise ConnectionError, PROTOCOL_ERROR end data, resp, , forward = get(login_token_link(data), .join(';')) end |
#skip_gzip? ⇒ Boolean
43 44 45 |
# File 'lib/contacts/mailru.rb', line 43 def skip_gzip? true end |