Class: Contacts::WebDe
Constant Summary collapse
- DETECTED_DOMAINS =
[ /web\.de/i ]
- LOGIN_URL =
"https://uas2.uilogin.de/centrallogin-3.1/login"
- ADDRESS_BOOK_URL =
"https://mm.web.de/contacts"
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.
8 9 10 |
# File 'lib/contacts/web_de.rb', line 8 def @cookies end |
Instance Method Details
#contacts ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/contacts/web_de.rb', line 27 def contacts url = ADDRESS_BOOK_URL @contacts = [] begin data, resp, self., forward = get(url, self.) data, resp, , forward = get(forward, self.) doc = Nokogiri(data) (doc/'ul[id=addressLines]/li').each do |li| links = (li/'a') name = links[0].text.strip name = name.split(', ').reverse.join(' ') next if links[1].nil? match = links[1]['href'].match('to=([^&]+)') next if !match email = match[1].strip @contacts << [ name, email ] end a_next = doc.at('a[id=go-next]') unless a_next.nil? url = ADDRESS_BOOK_URL + '?' + a_next[:href].split('?')[1] else url = nil end end while !url.nil? @contacts end |
#real_connect ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/contacts/web_de.rb', line 10 def real_connect postdata = "serviceID=%s&username=%s&password=%s" % [ CGI.escape('mobile.web.mail.webde.live'), CGI.escape(login), CGI.escape(password) ] data, resp, self., forward = post(LOGIN_URL, postdata, "") if !forward.index("/success") raise AuthenticationError, "Username and password do not match" end data, resp, self., forward = get(forward, self.) end |
#skip_gzip? ⇒ Boolean
67 68 69 |
# File 'lib/contacts/web_de.rb', line 67 def skip_gzip? false end |