Class: Contacts::TonlineDe
Constant Summary collapse
- DETECTED_DOMAINS =
[ /t-mobile\.de/i, /t-online\.de/i ]
- URL =
"https://email.t-online.de/V4-0-4-0/srv-bin/aaa?method=deliverLoginBox"
- ADDRESS_BOOK_URL =
"https://email.t-online.de/V4-0-4-0/srv-bin/addressbook?method=exportAdressbook&p%5Bformat%5D=CSV&p%5Bliid%5D="
- PROTOCOL_ERROR =
"t-online.de has changed its protocols"
Instance Attribute Summary collapse
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#tid ⇒ Object
Returns the value of attribute tid.
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/tonline_de.rb', line 8 def @cookies end |
#tid ⇒ Object
Returns the value of attribute tid.
8 9 10 |
# File 'lib/contacts/tonline_de.rb', line 8 def tid @tid end |
Instance Method Details
#contacts ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/contacts/tonline_de.rb', line 44 def contacts @contacts = [] data, resp, self., forward = get(ADDRESS_BOOK_URL, self.) CSV.parse(data) do |row| other, first_name, last_name, email = row name = "#{first_name} #{last_name}".strip email.strip! next unless email.include?('@') @contacts << [name, email] 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/contacts/tonline_de.rb', line 10 def real_connect data, resp, self., forward = get(URL, "") doc = Nokogiri(data) = doc.at('meta[http-equiv=refresh]') if .nil? raise ConnectionError, PROTOCOL_ERROR end forward = ['content'].split('URL=').last data, resp, self., forward = get(forward, self.) doc = Nokogiri(data) self.tid = doc.at('input[name=tid]')['value'] url = doc.at('form[name=login]')['action'] postdata = "appid=0158&lang=de&login=Login&pwd=%s&skinid=30&tid=%s&usr=%s" % [ CGI.escape(password), CGI.escape(self.tid), CGI.escape(username) ] data, resp, self., forward = post(url, postdata, self.) if forward.nil? || !forward.match("loadUser") raise AuthenticationError, "Username and password do not match" end data, resp, self., forward = get(forward, self.) end |
#skip_gzip? ⇒ Boolean
63 64 65 |
# File 'lib/contacts/tonline_de.rb', line 63 def skip_gzip? false end |