Class: Contacts::Sina
Constant Summary collapse
- URL =
"http://mail.sina.com.cn"
- LOGIN_URL =
{ :sina_cn => "https://mail.sina.com.cn/cgi-bin/cnlogin.php", :sina_com => "https://mail.sina.com.cn/cgi-bin/login.php" }
- LOGIN_COOKIE =
{ :sina_cn => "sina_cn_mail_recid=true", :sina_com => "sina_free_mail_recid=true; sina_free_mail_ltype=uid; sina_vip_mail_recid=false" }
- DOMAIN =
{ :sina_cn => 'sina.cn', :sina_com => 'sina.com' }
- PROTOCOL_ERROR =
"sina has changed its protocols, please upgrade this library first. you can also contact [email protected]"
Instance Method Summary collapse
- #contacts ⇒ Object
-
#initialize(login, password, options = {}) ⇒ Sina
constructor
A new instance of Sina.
- #real_connect ⇒ Object
Methods inherited from Base
#connect, #connected?, #login, #login_with_domain, #login_without_domain, #password
Constructor Details
#initialize(login, password, options = {}) ⇒ Sina
Returns a new instance of Sina.
18 19 20 21 |
# File 'lib/contacts/sina.rb', line 18 def initialize(login, password, ={}) @mail_type = get_mail_type(login) super(login,password,) end |
Instance Method Details
#contacts ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/contacts/sina.rb', line 28 def contacts return @contacts if @contacts if connected? data, resp, , forward = get(@mail_url,@cookies) if resp.code_type != Net::HTTPOK raise ConnectionError, self.class.const_get(:PROTOCOL_ERROR) end parse(data) end end |
#real_connect ⇒ Object
23 24 25 26 |
# File 'lib/contacts/sina.rb', line 23 def real_connect redirect_for_location end |