Class: Contacts::Gmx
Constant Summary collapse
- DETECTED_DOMAINS =
[ /gmx.de/i, /gmx.at/i, /gmx.ch/i, /gmx.net/i ]
- LOGIN_URL =
"https://service.gmx.net/de/cgi/login"
- ADDRESS_BOOK_URL =
"https://service.gmx.net/de/cgi/g.fcgi/addressbook/cab?cc=subnavi_adressbuch&sid="
- EXPORT_URL =
"https://adressbuch.gmx.net/exportcontacts"
Instance Attribute Summary collapse
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#sid ⇒ Object
Returns the value of attribute sid.
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/gmx.rb', line 8 def @cookies end |
#sid ⇒ Object
Returns the value of attribute sid.
8 9 10 |
# File 'lib/contacts/gmx.rb', line 8 def sid @sid end |
Instance Method Details
#contacts ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/contacts/gmx.rb', line 32 def contacts data, resp, , forward = get(ADDRESS_BOOK_URL + self.sid, self.) data, resp, , forward = get(forward, self.) session = forward.match(/session=([^&]+)/)[1] postdata = "language=eng&raw_format=csv_Outlook2003&what=PERSON&session=" + session data, resp, , forward = post(EXPORT_URL, postdata, self.) @contacts = [] CSV.parse(data) do |row| @contacts << ["#{row[2]} #{row[0]}", row[9]] 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 29 30 |
# File 'lib/contacts/gmx.rb', line 10 def real_connect postdata = "AREA=1&EXT=redirect&EXT2=&dlevel=c&id=%s&p=%s&uinguserid=__uuid__" % [ CGI.escape(login), CGI.escape(password) ] data, resp, self., forward = post(LOGIN_URL, postdata, "") if data.index("lose/password") raise AuthenticationError, "Username and password do not match" elsif !forward.nil? && forward.index("login-failed") raise AuthenticationError, "Username and password do not match" elsif == "" or data == "" raise ConnectionError, PROTOCOL_ERROR end data, resp, self., forward = get(forward, self.) self.sid = data.match(/sid=([a-z0-9\.]+)/)[1] end |
#skip_gzip? ⇒ Boolean
51 52 53 |
# File 'lib/contacts/gmx.rb', line 51 def skip_gzip? false end |