Class: Weibo::Client
- Inherits:
-
Object
- Object
- Weibo::Client
- Defined in:
- lib/weibo/client.rb
Instance Attribute Summary collapse
-
#oauth ⇒ Object
readonly
Returns the value of attribute oauth.
Instance Method Summary collapse
-
#app_send(uids, title, content) ⇒ Object
1.0接口.
-
#comments_by_me(options = {}) ⇒ Object
评论接口.
-
#favorites(options = {}) ⇒ Object
收藏.
- #friendships_create(uid) ⇒ Object
- #friendships_destroy(uid) ⇒ Object
-
#friendships_followers(options = {}) ⇒ Object
关系接口.
- #friendships_friends(options = {}) ⇒ Object
- #friendships_friends_bilateral(uid, options = {}) ⇒ Object
- #friendships_friends_uids(options = {}) ⇒ Object
-
#initialize(access_token, weibo_uid = nil) ⇒ Client
constructor
A new instance of Client.
- #statuses_queryid(mid, options = {}) ⇒ Object
- #statuses_querymid(id, options = {}) ⇒ Object
- #statuses_repost(status_id, options = {}) ⇒ Object
- #statuses_repost_by_me(options = {}) ⇒ Object
- #statuses_show(status_id, options = {}) ⇒ Object
-
#statuses_update(status, options = {}) ⇒ Object
微博接口.
- #statuses_upload(status, pic_path, options = {}) ⇒ Object
- #statuses_upload_url_text(status, url, options = {}) ⇒ Object
- #statuses_user_timeline(options = {}) ⇒ Object
-
#tags(options = {}) ⇒ Object
标签.
-
#users_show(options = {}) ⇒ Object
用户接口.
Constructor Details
#initialize(access_token, weibo_uid = nil) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/weibo/client.rb', line 7 def initialize(access_token, weibo_uid = nil) @oauth = Oauth.new(access_token) @weibo_uid = weibo_uid end |
Instance Attribute Details
#oauth ⇒ Object (readonly)
Returns the value of attribute oauth.
5 6 7 |
# File 'lib/weibo/client.rb', line 5 def oauth @oauth end |
Instance Method Details
#app_send(uids, title, content) ⇒ Object
1.0接口
113 114 115 |
# File 'lib/weibo/client.rb', line 113 def app_send(uids, title, content) self.oauth.post("https://api.t.sina.com.cn/notice/app/send", :uids => uids.join(","), :title => title, :content => content) end |
#comments_by_me(options = {}) ⇒ Object
评论接口
95 96 97 |
# File 'lib/weibo/client.rb', line 95 def comments_by_me( = {}) self.oauth.get "comments/by_me", end |
#favorites(options = {}) ⇒ Object
收藏
100 101 102 |
# File 'lib/weibo/client.rb', line 100 def favorites( = {}) self.oauth.get "favorites", end |
#friendships_create(uid) ⇒ Object
73 74 75 |
# File 'lib/weibo/client.rb', line 73 def friendships_create(uid) self.oauth.post("friendships/create", :uid => uid) end |
#friendships_destroy(uid) ⇒ Object
82 83 84 |
# File 'lib/weibo/client.rb', line 82 def friendships_destroy(uid) self.oauth.post("friendships/destroy", :uid => uid) end |
#friendships_followers(options = {}) ⇒ Object
关系接口
58 59 60 61 |
# File 'lib/weibo/client.rb', line 58 def friendships_followers( = {}) default_params = { :cursor => 0, :count => 200, :uid => @weibo_uid } self.oauth.get "friendships/followers", default_params.merge() end |
#friendships_friends(options = {}) ⇒ Object
63 64 65 66 |
# File 'lib/weibo/client.rb', line 63 def friendships_friends( = {}) default_params = { :cursor => 0, :count => 200, :uid => @weibo_uid } self.oauth.get "friendships/friends", default_params.merge() end |
#friendships_friends_bilateral(uid, options = {}) ⇒ Object
68 69 70 71 |
# File 'lib/weibo/client.rb', line 68 def friendships_friends_bilateral(uid, = {}) default_params = { :page => 1, :count => 50, :sort => 0 } self.oauth.get "friendships/friends/bilateral", default_params.merge() end |
#friendships_friends_uids(options = {}) ⇒ Object
77 78 79 80 |
# File 'lib/weibo/client.rb', line 77 def friendships_friends_uids( = {}) default_params = { :cursor => 0, :count => 200, :uid => @weibo_uid } self.oauth.get "friendships/friends/ids", default_params.merge() end |
#statuses_queryid(mid, options = {}) ⇒ Object
41 42 43 44 |
# File 'lib/weibo/client.rb', line 41 def statuses_queryid(mid, = {}) default_params = { :mid => mid, :type => 1, :isBase62 => 1 } self.oauth.get "statuses/queryid", default_params.merge() end |
#statuses_querymid(id, options = {}) ⇒ Object
36 37 38 39 |
# File 'lib/weibo/client.rb', line 36 def statuses_querymid(id, = {}) default_params = { :id => id, :type => 1 } self.oauth.get "statuses/querymid", default_params.merge() end |
#statuses_repost(status_id, options = {}) ⇒ Object
50 51 52 53 |
# File 'lib/weibo/client.rb', line 50 def statuses_repost(status_id, = {}) default_params = { :id => status_id } self.oauth.post 'statuses/repost', default_params.merge() end |
#statuses_repost_by_me(options = {}) ⇒ Object
46 47 48 |
# File 'lib/weibo/client.rb', line 46 def statuses_repost_by_me( = {}) self.oauth.get "statuses/repost_by_me", end |
#statuses_show(status_id, options = {}) ⇒ Object
27 28 29 |
# File 'lib/weibo/client.rb', line 27 def statuses_show(status_id, = {}) self.oauth.get "statuses/show", :id => status_id end |
#statuses_update(status, options = {}) ⇒ Object
微博接口
14 15 16 |
# File 'lib/weibo/client.rb', line 14 def statuses_update(status, = {}) self.oauth.post "statuses/update", :status => status end |
#statuses_upload(status, pic_path, options = {}) ⇒ Object
18 19 20 |
# File 'lib/weibo/client.rb', line 18 def statuses_upload(status, pic_path, = {}) self.oauth.post 'statuses/upload', :status => status, :pic => File.new(File.(pic_path)) end |
#statuses_upload_url_text(status, url, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/weibo/client.rb', line 22 def statuses_upload_url_text(status, url, = {}) default_params = { :status => status, :url => url } self.oauth.post 'statuses/upload_url_text', default_params.merge() end |
#statuses_user_timeline(options = {}) ⇒ Object
31 32 33 34 |
# File 'lib/weibo/client.rb', line 31 def statuses_user_timeline( = {}) default_params = { :uid => @weibo_uid } self.oauth.get "statuses/user_timeline", default_params.merge() end |
#tags(options = {}) ⇒ Object
标签
106 107 108 109 |
# File 'lib/weibo/client.rb', line 106 def ( = {}) default_params = { :uid => @weibo_uid } self.oauth.get "tags",default_params.merge() end |
#users_show(options = {}) ⇒ Object
用户接口
89 90 91 92 |
# File 'lib/weibo/client.rb', line 89 def users_show( = {}) default_params = { :uid => @weibo_uid } self.oauth.get "users/show", default_params.merge() end |