weibo2 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +96 -0
- data/Rakefile +26 -0
- data/lib/tasks/weibo2_tasks.rake +4 -0
- data/lib/weibo2.rb +17 -0
- data/lib/weibo2/client.rb +186 -0
- data/lib/weibo2/config.rb +28 -0
- data/lib/weibo2/error.rb +13 -0
- data/lib/weibo2/interface/account.rb +205 -0
- data/lib/weibo2/interface/base.rb +32 -0
- data/lib/weibo2/interface/comments.rb +143 -0
- data/lib/weibo2/interface/favorites.rb +114 -0
- data/lib/weibo2/interface/friendships.rb +193 -0
- data/lib/weibo2/interface/register.rb +20 -0
- data/lib/weibo2/interface/search.rb +158 -0
- data/lib/weibo2/interface/statuses.rb +300 -0
- data/lib/weibo2/interface/suggestions.rb +69 -0
- data/lib/weibo2/interface/tags.rb +71 -0
- data/lib/weibo2/interface/trends.rb +83 -0
- data/lib/weibo2/interface/users.rb +43 -0
- data/lib/weibo2/strategy/auth_code.rb +28 -0
- data/lib/weibo2/strategy/signed_request.rb +49 -0
- data/lib/weibo2/version.rb +3 -0
- metadata +90 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
module Weibo2
|
2
|
+
module Interface
|
3
|
+
|
4
|
+
# The Base class of API
|
5
|
+
class Base
|
6
|
+
def initialize(client)
|
7
|
+
@client = client
|
8
|
+
end
|
9
|
+
|
10
|
+
def request(verb, path, opts={}, &block)
|
11
|
+
unless @client.is_authorized?
|
12
|
+
raise "I can't find a valid access_token. Forgot to get it or expired?"
|
13
|
+
end
|
14
|
+
|
15
|
+
response = @client.token.request(verb, path, opts, &block)
|
16
|
+
if response.error
|
17
|
+
raise Error.new(response)
|
18
|
+
end
|
19
|
+
response
|
20
|
+
end
|
21
|
+
|
22
|
+
def get(path, opts={}, &block)
|
23
|
+
request(:get, path, opts, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
def post(path, opts={}, &block)
|
27
|
+
request(:post, path, opts, &block)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Weibo2
|
3
|
+
module Interface
|
4
|
+
|
5
|
+
# Comments API
|
6
|
+
#
|
7
|
+
# @see http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2#.E8.AF.84.E8.AE.BA
|
8
|
+
class Comments < Base
|
9
|
+
|
10
|
+
# 根据微博ID返回某条微博的评论列表
|
11
|
+
#
|
12
|
+
# @param [int64] id 需要查询的微博ID
|
13
|
+
# @param [Hash] opts
|
14
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0
|
15
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的评论,默认为0
|
16
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
17
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
18
|
+
# @option opts [int] :filter_by_author 作者筛选类型,0:全部、1:我关注的人、2:陌生人,默认为0
|
19
|
+
#
|
20
|
+
# @see http://open.weibo.com/wiki/2/comments/show
|
21
|
+
def show(id, opts={})
|
22
|
+
get 'comments/show.json', :params => {:id => id}.merge(opts)
|
23
|
+
end
|
24
|
+
|
25
|
+
# 获取当前登录用户所发出的评论列表
|
26
|
+
#
|
27
|
+
# @param [Hash] opts
|
28
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0
|
29
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的评论,默认为0
|
30
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
31
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
32
|
+
# @option opts [int] :filter_by_source 来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论,默认为0
|
33
|
+
#
|
34
|
+
# @see http://open.weibo.com/wiki/2/comments/by_me
|
35
|
+
def by_me(opts={})
|
36
|
+
get 'comments/by_me.json', :params => opts
|
37
|
+
end
|
38
|
+
|
39
|
+
# 获取当前登录用户所接收到的评论列表
|
40
|
+
#
|
41
|
+
# @param [Hash] opts
|
42
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0
|
43
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的评论,默认为0
|
44
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
45
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
46
|
+
# @option opts [int] :filter_by_author 作者筛选类型,0:全部、1:我关注的人、2:陌生人,默认为0
|
47
|
+
# @option opts [int] :filter_by_source 来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论,默认为0
|
48
|
+
#
|
49
|
+
# @see http://open.weibo.com/wiki/2/comments/to_me
|
50
|
+
def to_me(opts={})
|
51
|
+
get 'comments/to_me.json', :params => opts
|
52
|
+
end
|
53
|
+
|
54
|
+
# 获取当前登录用户的最新评论包括接收到的与发出的
|
55
|
+
#
|
56
|
+
# @param [Hash] opts
|
57
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0
|
58
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的评论,默认为0
|
59
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
60
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
61
|
+
#
|
62
|
+
# @see http://open.weibo.com/wiki/2/comments/timeline
|
63
|
+
def timeline(opts={})
|
64
|
+
get 'comments/timeline.json', :params => opts
|
65
|
+
end
|
66
|
+
|
67
|
+
# 获取最新的提到当前登录用户的评论,即@我的评论
|
68
|
+
#
|
69
|
+
# @param [Hash] opts
|
70
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的评论(即比since_id时间晚的评论),默认为0
|
71
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的评论,默认为0
|
72
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
73
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
74
|
+
# @option opts [int] :filter_by_author 作者筛选类型,0:全部、1:我关注的人、2:陌生人,默认为0
|
75
|
+
# @option opts [int] :filter_by_source 来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论,默认为0
|
76
|
+
#
|
77
|
+
# @see http://open.weibo.com/wiki/2/comments/mentions
|
78
|
+
def mentions(opts={})
|
79
|
+
get 'comments/mentions.json', :params => opts
|
80
|
+
end
|
81
|
+
|
82
|
+
# 根据评论ID批量返回评论信息
|
83
|
+
#
|
84
|
+
# @param [String] cids 需要查询的批量评论ID,用半角逗号分隔,最大50
|
85
|
+
#
|
86
|
+
# @see http://open.weibo.com/wiki/2/comments/show_batch
|
87
|
+
def show_batch(cids)
|
88
|
+
get 'comments/show_batch.json', :params => {:cids => cids}
|
89
|
+
end
|
90
|
+
|
91
|
+
#
|
92
|
+
# write
|
93
|
+
#
|
94
|
+
|
95
|
+
# 对一条微博进行评论
|
96
|
+
#
|
97
|
+
# @param [String] comment 评论内容,内容不超过140个汉字
|
98
|
+
# @param [int64] id 需要评论的微博ID
|
99
|
+
# @param [Hash] opts
|
100
|
+
# @option opts [int] :comment_on 当评论转发微博时,是否评论给原微博,0:否、1:是,默认为0
|
101
|
+
#
|
102
|
+
# @see http://open.weibo.com/wiki/2/comments/create
|
103
|
+
def create(comment, id)
|
104
|
+
post 'comments/create.json', :body => {:comment => comment, :id => id}
|
105
|
+
end
|
106
|
+
|
107
|
+
# no test
|
108
|
+
# 删除一条评论
|
109
|
+
#
|
110
|
+
# @param [int64] cid 要删除的评论ID,只能删除登录用户自己发布的评论
|
111
|
+
#
|
112
|
+
# @see http://open.weibo.com/wiki/2/comments/destroy
|
113
|
+
def destroy(cid)
|
114
|
+
post 'comments/destroy.json', :body => {:cid => cid}
|
115
|
+
end
|
116
|
+
|
117
|
+
# 根据评论ID批量删除评论
|
118
|
+
#
|
119
|
+
# @param [String] cids 需要删除的评论ID,用半角逗号隔开,最多20个
|
120
|
+
#
|
121
|
+
# @see http://open.weibo.com/wiki/2/comments/destroy_batch
|
122
|
+
def destroy_batch(cids)
|
123
|
+
post 'comments/destroy_batch.json', :body => {:cids => cids}
|
124
|
+
end
|
125
|
+
|
126
|
+
# no test
|
127
|
+
# 回复一条评论
|
128
|
+
#
|
129
|
+
# @param [int64] cid 需要回复的评论ID
|
130
|
+
# @param [int64] id 需要评论的微博ID
|
131
|
+
# @param [String] comment 回复评论内容,内容不超过140个汉字
|
132
|
+
# @param [Hash] opts
|
133
|
+
# @option opts [int] :without_mention 回复中是否自动加入“回复@用户名”,0:是、1:否,默认为0
|
134
|
+
# @option opts [int] :comment_on 当评论转发微博时,是否评论给原微博,0:否、1:是,默认为0
|
135
|
+
#
|
136
|
+
# @see http://open.weibo.com/wiki/2/comments/reply
|
137
|
+
def reply(cid, id, comment, opts={})
|
138
|
+
post 'comments/reply.json', :body => {:cid => cid, :id => id, :comment => comment}.merge(opts)
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Weibo2
|
3
|
+
module Interface
|
4
|
+
|
5
|
+
# Favorites API
|
6
|
+
#
|
7
|
+
# @see http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2#.E6.94.B6.E8.97.8F
|
8
|
+
class Favorites < Base
|
9
|
+
|
10
|
+
# 获取当前登录用户的收藏列表
|
11
|
+
#
|
12
|
+
# @param [Hash] opts
|
13
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
14
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
15
|
+
#
|
16
|
+
# @see http://open.weibo.com/wiki/2/favorites
|
17
|
+
def favorites(opts={})
|
18
|
+
get 'favorites.json', :params => opts
|
19
|
+
end
|
20
|
+
|
21
|
+
# 根据收藏ID获取指定的收藏信息
|
22
|
+
#
|
23
|
+
# @param [int64] id 需要查询的收藏ID
|
24
|
+
#
|
25
|
+
# @see http://open.weibo.com/wiki/2/favorites/show
|
26
|
+
def show(id)
|
27
|
+
get 'favorites/show.json', :params => {:id => id}
|
28
|
+
end
|
29
|
+
|
30
|
+
# 根据标签获取当前登录用户该标签下的收藏列表
|
31
|
+
#
|
32
|
+
# @param [int64] tid 需要查询的标签ID
|
33
|
+
# @param [Hash] opts
|
34
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
35
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
36
|
+
#
|
37
|
+
# @see http://open.weibo.com/wiki/2/favorites/by_tags
|
38
|
+
def by_tags(tid, opts={})
|
39
|
+
get 'favorites/by_tags.json', :params => {:tid => tid}.merge(opts)
|
40
|
+
end
|
41
|
+
|
42
|
+
# 获取当前登录用户的收藏标签列表
|
43
|
+
#
|
44
|
+
# @param [Hash] opts
|
45
|
+
# @option opts [int] :count 单页返回的记录条数,默认为10
|
46
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
47
|
+
#
|
48
|
+
# @see http://open.weibo.com/wiki/2/favorites/tags
|
49
|
+
def tags(opts={})
|
50
|
+
get 'favorites/tags.json', :params => opts
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# write
|
55
|
+
#
|
56
|
+
|
57
|
+
#test no pass below
|
58
|
+
# 添加一条微博到收藏里
|
59
|
+
#
|
60
|
+
# @param [int64] id 要收藏的微博ID
|
61
|
+
#
|
62
|
+
# @see http://open.weibo.com/wiki/2/favorites/create
|
63
|
+
def create(id)
|
64
|
+
post 'favorites/create.json', :body => {:id => id}
|
65
|
+
end
|
66
|
+
|
67
|
+
# 取消收藏一条微博
|
68
|
+
#
|
69
|
+
# @param [int64] id 要取消收藏的微博ID
|
70
|
+
#
|
71
|
+
# @see http://open.weibo.com/wiki/2/favorites/destroy
|
72
|
+
def destroy(id)
|
73
|
+
post 'favorites/destroy.json', :body => {:id => id}
|
74
|
+
end
|
75
|
+
|
76
|
+
# 根据收藏ID批量取消收藏
|
77
|
+
#
|
78
|
+
# @param [String] ids 要取消收藏的收藏ID,用半角逗号分隔,最多不超过10个
|
79
|
+
# @see http://open.weibo.com/wiki/2/favorites/destroy_batch
|
80
|
+
def destroy_batch(ids)
|
81
|
+
post 'favorites/destroy_batch.json', :body => {:ids => ids}
|
82
|
+
end
|
83
|
+
|
84
|
+
# 更新一条收藏的收藏标签
|
85
|
+
#
|
86
|
+
# @param [int64] id 需要更新的收藏ID
|
87
|
+
# @param [Hash] opts
|
88
|
+
# @option opts [String] :tags 需要更新的标签内容,用半角逗号分隔,最多不超过2条
|
89
|
+
#
|
90
|
+
# @see http://open.weibo.com/wiki/2/favorites/tags/update
|
91
|
+
def tags_update(id, opt={})
|
92
|
+
post 'favorites/tags/update.json', :body => {:id => id}.merge(opts)
|
93
|
+
end
|
94
|
+
|
95
|
+
# 更新当前登录用户所有收藏下的指定标签
|
96
|
+
#
|
97
|
+
# @param [int64] tid 需要更新的标签ID
|
98
|
+
# @param [String] tag 需要更新的标签内容
|
99
|
+
# @see http://open.weibo.com/wiki/2/favorites/tags/update_batch
|
100
|
+
def tags_update_batch(tid, tag)
|
101
|
+
post 'favorites/tags/update_batch.json', :body => {:tid => tid, :tag => tag}
|
102
|
+
end
|
103
|
+
|
104
|
+
# 删除当前登录用户所有收藏下的指定标签
|
105
|
+
#
|
106
|
+
# @param [int64] tid 需要删除的标签ID
|
107
|
+
#
|
108
|
+
# @see http://open.weibo.com/wiki/2/favorites/tags/destroy_batch
|
109
|
+
def tags_destroy_batch(tid)
|
110
|
+
post 'favorites/tags/destroy_batch.json', :body => {:tid => tid}
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,193 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Weibo2
|
3
|
+
module Interface
|
4
|
+
|
5
|
+
# Friendships API
|
6
|
+
#
|
7
|
+
# @see http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2#.E5.85.B3.E7.B3.BB
|
8
|
+
class Friendships < Base
|
9
|
+
|
10
|
+
# 获取用户的关注列表
|
11
|
+
#
|
12
|
+
# @param [Hash] opts
|
13
|
+
# @option opts [int64] :uid 需要查询的用户UID
|
14
|
+
# @option opts [String] :screen_name 需要查询的用户昵称
|
15
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50,最大不超过200
|
16
|
+
# @option opts [int] :cursor 返回结果的游标,下一页用返回值里的next_cursor,上一页用previous_cursor,默认为0
|
17
|
+
#
|
18
|
+
# @see http://open.weibo.com/wiki/2/friendships/friends
|
19
|
+
def friends(opts={})
|
20
|
+
get 'friendships/friends.json', :params => opts
|
21
|
+
end
|
22
|
+
|
23
|
+
# 获取两个用户之间的共同关注人列表
|
24
|
+
#
|
25
|
+
# @param [int64] uid 需要获取共同关注关系的用户UID
|
26
|
+
# @param [Hash] opts
|
27
|
+
# @option opts [int64] :suid 需要获取共同关注关系的用户UID,默认为当前登录用户
|
28
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
29
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
30
|
+
#
|
31
|
+
# @see http://open.weibo.com/wiki/2/friendships/friends/in_common
|
32
|
+
def friends_in_common(uid, opts={})
|
33
|
+
get 'friendships/friends/in_common.json', :params => {:uid => uid}.merge(opts)
|
34
|
+
end
|
35
|
+
|
36
|
+
# 获取用户的双向关注列表,即互粉列表
|
37
|
+
#
|
38
|
+
# @param [int64] uid 需要获取双向关注列表的用户UID
|
39
|
+
# @param [Hash] opts
|
40
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
41
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
42
|
+
# @option opts [int] :sort 排序类型,0:按关注时间最近排序,默认为0
|
43
|
+
#
|
44
|
+
# @see http://open.weibo.com/wiki/2/friendships/friends/bilateral
|
45
|
+
def friends_bilateral(uid, opts={})
|
46
|
+
get 'friendships/friends/bilateral.json', :params => {:uid => uid}.merge(opts)
|
47
|
+
end
|
48
|
+
|
49
|
+
# 获取用户双向关注的用户ID列表,即互粉UID列表
|
50
|
+
#
|
51
|
+
# @param [int64] uid 需要获取双向关注列表的用户UID
|
52
|
+
# @param [Hash] opts
|
53
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50,最大不超过2000
|
54
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
55
|
+
# @option opts [int] :sort 排序类型,0:按关注时间最近排序,默认为0
|
56
|
+
#
|
57
|
+
# @see http://open.weibo.com/wiki/2/friendships/friends/bilateral/ids
|
58
|
+
def friends_bilateral_ids(uid, opts={})
|
59
|
+
get 'friendships/friends/bilateral/ids.json', :params => {:uid => uid}.merge(opts)
|
60
|
+
end
|
61
|
+
|
62
|
+
# 获取用户关注的用户UID列表
|
63
|
+
#
|
64
|
+
# @param [Hash] opts
|
65
|
+
# @option opts [int64] :uid 需要查询的用户UID
|
66
|
+
# @option opts [String] :screen_name 需要查询的用户昵称
|
67
|
+
# @option opts [int] :count 单页返回的记录条数,默认为500,最大不超过5000
|
68
|
+
# @option opts [int] :cursor 返回结果的游标,下一页用返回值里的next_cursor,上一页用previous_cursor,默认为0
|
69
|
+
#
|
70
|
+
# @see http://open.weibo.com/wiki/2/friendships/friends/ids
|
71
|
+
def friends_ids(opts={})
|
72
|
+
get 'friendships/friends/ids.json', :params => opts
|
73
|
+
end
|
74
|
+
|
75
|
+
# 批量获取当前登录用户的关注人的备注信息 [Privilege]
|
76
|
+
#
|
77
|
+
# @param [String] uids 需要获取备注的用户UID,用半角逗号分隔,最多不超过50个
|
78
|
+
#
|
79
|
+
# @see http://open.weibo.com/wiki/2/friendships/friends/remark_batch
|
80
|
+
def friends_remark_batch(uids)
|
81
|
+
get 'friendships/friends/remark_batch.json', :params => {:uids => uids}
|
82
|
+
end
|
83
|
+
|
84
|
+
# 获取用户的粉丝列表
|
85
|
+
#
|
86
|
+
# @param [Hash] opts
|
87
|
+
# @option opts [int64] :uid 需要查询的用户UID
|
88
|
+
# @option opts [String] :screen_name 需要查询的用户昵称
|
89
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50,最大不超过200
|
90
|
+
# @option opts [int] :cursor 返回结果的游标,下一页用返回值里的next_cursor,上一页用previous_cursor,默认为0
|
91
|
+
#
|
92
|
+
# @see http://open.weibo.com/wiki/2/friendships/followers
|
93
|
+
def followers(opts={})
|
94
|
+
get 'friendships/followers.json', :params => opts
|
95
|
+
end
|
96
|
+
|
97
|
+
# 获取用户粉丝的用户UID列表
|
98
|
+
#
|
99
|
+
# @param [Hash] opts
|
100
|
+
# @option opts [int64] :uid 需要查询的用户UID
|
101
|
+
# @option opts [String] :screen_name 需要查询的用户昵称
|
102
|
+
# @option opts [int] :count 单页返回的记录条数,默认为500,最大不超过5000
|
103
|
+
# @option opts [int] :cursor 返回结果的游标,下一页用返回值里的next_cursor,上一页用previous_cursor,默认为0
|
104
|
+
#
|
105
|
+
# @see http://open.weibo.com/wiki/2/friendships/followers/ids
|
106
|
+
def followers_ids(opts={})
|
107
|
+
get 'friendships/followers/ids.json', :params => opts
|
108
|
+
end
|
109
|
+
|
110
|
+
# 获取用户的活跃粉丝列表
|
111
|
+
# @param [int64] uid 需要查询的用户UID
|
112
|
+
# @param [Hash] opts
|
113
|
+
# @option opts [int] :count 返回的记录条数,默认为20,最大不超过200
|
114
|
+
#
|
115
|
+
# @see http://open.weibo.com/wiki/2/friendships/followers/active
|
116
|
+
def followers_active(uid, opts={})
|
117
|
+
get 'friendships/followers/active.json', :params => {:uid => uid}.merge(opts)
|
118
|
+
end
|
119
|
+
|
120
|
+
# 获取当前登录用户的关注人中又关注了指定用户的用户列表
|
121
|
+
#
|
122
|
+
# @param [int64] uid 指定的关注目标用户UID
|
123
|
+
# @param [Hash] opts
|
124
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
125
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
126
|
+
#
|
127
|
+
# @see http://open.weibo.com/wiki/2/friendships/friends_chain/followers
|
128
|
+
def friends_chain_followers(uid, opts={})
|
129
|
+
get 'friendships/friends_chain/followers.json', :params => {:uid => uid}.merge(opts)
|
130
|
+
end
|
131
|
+
|
132
|
+
# 获取两个用户之间的详细关注关系情况
|
133
|
+
#
|
134
|
+
# @param [Hash] opts
|
135
|
+
# @option opts [int64] :source_id 源用户的UID
|
136
|
+
# @option opts [String] :source_screen_name 源用户的微博昵称
|
137
|
+
# @option opts [int64] :target_id 目标用户的UID
|
138
|
+
# @option opts [String] :target_screen_name 目标用户的微博昵称
|
139
|
+
#
|
140
|
+
# @see http://open.weibo.com/wiki/2/friendships/show
|
141
|
+
def show(opts={})
|
142
|
+
get 'friendships/show.json', :params => opts
|
143
|
+
end
|
144
|
+
|
145
|
+
#
|
146
|
+
# write
|
147
|
+
#
|
148
|
+
|
149
|
+
# no test below
|
150
|
+
# 关注一个用户
|
151
|
+
#
|
152
|
+
# @param [Hash] opts
|
153
|
+
# @option opts [int64] :uid 需要关注的用户ID
|
154
|
+
# @option opts [String] :screen_name 需要关注的用户昵称
|
155
|
+
#
|
156
|
+
# @see http://open.weibo.com/wiki/2/friendships/create
|
157
|
+
def create(opts={})
|
158
|
+
post 'friendships/create.json', :body => opts
|
159
|
+
end
|
160
|
+
|
161
|
+
# 根据用户UID批量关注用户 [Privilege]
|
162
|
+
#
|
163
|
+
# @param [String] uids 要关注的用户UID,用半角逗号分隔,最多不超过20个
|
164
|
+
#
|
165
|
+
# @see http://open.weibo.com/wiki/2/friendships/create_batch
|
166
|
+
def create_batch(uids)
|
167
|
+
post 'friendships/create_batch.json', :body => {:uids => uids}
|
168
|
+
end
|
169
|
+
|
170
|
+
# 取消关注一个用户
|
171
|
+
#
|
172
|
+
# @param [Hash] opts
|
173
|
+
# @option opts [int64] :uid 需要取消关注的用户ID
|
174
|
+
# @option opts [String] :screen_name 需要取消关注的用户昵称
|
175
|
+
#
|
176
|
+
# @see http://open.weibo.com/wiki/2/friendships/destroy
|
177
|
+
def destroy(opts={})
|
178
|
+
post 'friendships/destroy.json', :body => opts
|
179
|
+
end
|
180
|
+
|
181
|
+
# 更新当前登录用户所关注的某个好友的备注信息 [Privilege]
|
182
|
+
#
|
183
|
+
# @param [int64] uid 需要修改备注信息的用户UID
|
184
|
+
# @param [String] remark 备注信息
|
185
|
+
#
|
186
|
+
# @see http://open.weibo.com/wiki/2/friendships/remark/update
|
187
|
+
def remark_update(uid, remark)
|
188
|
+
post 'friendships/remark/update.json', :body => {:uid => uid, :remark => remark}
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|