Class: QqClient::Client
- Inherits:
-
Object
- Object
- QqClient::Client
- Defined in:
- lib/qq_client/client.rb
Instance Attribute Summary collapse
-
#oauth ⇒ Object
readonly
Returns the value of attribute oauth.
Instance Method Summary collapse
- #add_blog(uid, title, content) ⇒ Object
-
#add_pic_t(uid, content, pic, options = {}) ⇒ Object
Upload a picture and posted a message on the Tencent microblogging platforms.
-
#add_t(uid, content, options = {}) ⇒ Object
Published a microblogging message (plain text) to the Tencent microblogging platforms.
-
#get_info(uid, options = {}) ⇒ Object
Get Tencent Weibo user’s login information.
- #get_uid ⇒ Object
-
#initialize(access_token) ⇒ Client
constructor
A new instance of Client.
Constructor Details
Instance Attribute Details
#oauth ⇒ Object (readonly)
Returns the value of attribute oauth.
5 6 7 |
# File 'lib/qq_client/client.rb', line 5 def oauth @oauth end |
Instance Method Details
#add_blog(uid, title, content) ⇒ Object
35 36 37 38 |
# File 'lib/qq_client/client.rb', line 35 def add_blog(uid, title, content) params = { :content => content,:title => title,:format => 'json' } @oauth.post uid, "blog/add_one_blog", params end |
#add_pic_t(uid, content, pic, options = {}) ⇒ Object
Upload a picture and posted a message on the Tencent microblogging platforms. More info (wiki.connect.qq.com/add_pic_t)
30 31 32 33 |
# File 'lib/qq_client/client.rb', line 30 def add_pic_t(uid, content, pic, = {}) default_params = { :content => content, :pic => pic, :multipart => true } @oauth.post uid, "t/add_pic_t", default_params.merge() end |
#add_t(uid, content, options = {}) ⇒ Object
Published a microblogging message (plain text) to the Tencent microblogging platforms. More info (wiki.connect.qq.com/add_t)
23 24 25 26 |
# File 'lib/qq_client/client.rb', line 23 def add_t(uid, content, = {}) default_params = { :content => content } @oauth.post uid, "t/add_t", default_params.merge() end |
#get_info(uid, options = {}) ⇒ Object
Get Tencent Weibo user’s login information. More info (wiki.connect.qq.com/get_info)
15 16 17 18 19 |
# File 'lib/qq_client/client.rb', line 15 def get_info(uid, = {}) data = @oauth.post uid, "user/get_info", data['data']['openid'] = uid data end |
#get_uid ⇒ Object
40 41 42 43 |
# File 'lib/qq_client/client.rb', line 40 def get_uid default_params = { :format => 'json' } @oauth.get_uid "oauth2.0/me", default_params end |