Class: Contacts19::Mailru
Constant Summary collapse
- LOGIN_URL =
"https://auth.mail.ru/cgi-bin/auth"
- ADDRESS_BOOK_URL =
"http://win.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 Contacts19::Base
Instance Attribute Details
#cookies ⇒ Object
Returns the value of attribute cookies.
8 9 10 |
# File 'lib/contacts19/mailru.rb', line 8 def @cookies end |
Instance Method Details
#contacts ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/contacts19/mailru.rb', line 30 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
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/contacts19/mailru.rb', line 10 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
42 43 44 |
# File 'lib/contacts19/mailru.rb', line 42 def skip_gzip? true end |