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,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Weibo2
|
3
|
+
module Interface
|
4
|
+
|
5
|
+
# Register API
|
6
|
+
#
|
7
|
+
# @see http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2#.E6.B3.A8.E5.86.8C
|
8
|
+
class Register < Base
|
9
|
+
|
10
|
+
# 验证昵称是否可用,并给予建议昵称
|
11
|
+
#
|
12
|
+
# @param [String] nickname 需要验证的昵称。4-20个字符,支持中英文、数字、"_"或减号
|
13
|
+
# @see http://open.weibo.com/wiki/2/register/verify_nickname
|
14
|
+
def verify_nickname(nickname)
|
15
|
+
get 'register/verify_nickname.json', :params => {:nickname => nickname}
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Weibo2
|
3
|
+
module Interface
|
4
|
+
|
5
|
+
# Search API
|
6
|
+
#
|
7
|
+
# @see http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2#.E6.90.9C.E7.B4.A2
|
8
|
+
class Search < Base
|
9
|
+
|
10
|
+
# 搜索用户时的联想搜索建议
|
11
|
+
#
|
12
|
+
# @param [String] q 搜索的关键字
|
13
|
+
# @param [Hash] opts
|
14
|
+
# @option opts [int] :count 返回的记录条数,默认为10
|
15
|
+
#
|
16
|
+
# @see http://open.weibo.com/wiki/2/search/suggestions/users
|
17
|
+
def suggestions_users(q, opts={})
|
18
|
+
get 'search/suggestions/users.json', :params => {:q => q}.merge(opts)
|
19
|
+
end
|
20
|
+
|
21
|
+
# 搜索微博时的联想搜索建议
|
22
|
+
#
|
23
|
+
# @param [String] q 搜索的关键字
|
24
|
+
# @param [Hash] opts
|
25
|
+
# @option opts [int] :count 返回的记录条数,默认为10
|
26
|
+
#
|
27
|
+
# @see http://open.weibo.com/wiki/2/search/suggestions/statuses
|
28
|
+
def suggestions_statuses(q, opts={})
|
29
|
+
get 'search/suggestions/statuses.json', :params => {:q => q}.merge(opts)
|
30
|
+
end
|
31
|
+
|
32
|
+
# 搜索学校时的联想搜索建议
|
33
|
+
#
|
34
|
+
# @param [String] q 搜索的关键字
|
35
|
+
# @param [Hash] opts
|
36
|
+
# @option opts [int] :count 返回的记录条数,默认为10
|
37
|
+
# @option opts [int] :type 学校类型,0:全部、1:大学、2:高中、3:中专技校、4:初中、5:小学,默认为0
|
38
|
+
#
|
39
|
+
# @see http://open.weibo.com/wiki/2/search/suggestions/schools
|
40
|
+
def suggestions_schools(q, opts={})
|
41
|
+
get 'search/suggestions/schools.json', :params => {:q => q}.merge(opts)
|
42
|
+
end
|
43
|
+
|
44
|
+
# 搜索公司时的联想搜索建议
|
45
|
+
#
|
46
|
+
# @param [String] q 搜索的关键字
|
47
|
+
# @param [Hash] opts
|
48
|
+
# @option opts [int] :count 返回的记录条数,默认为10
|
49
|
+
#
|
50
|
+
# @see http://open.weibo.com/wiki/2/search/suggestions/companies
|
51
|
+
def suggestions_companies(q, opts={})
|
52
|
+
get 'search/suggestions/companies.json', :params => {:q => q}.merge(opts)
|
53
|
+
end
|
54
|
+
|
55
|
+
# 搜索应用时的联想搜索建议
|
56
|
+
#
|
57
|
+
# @param [String] q 搜索的关键字
|
58
|
+
# @param [Hash] opts
|
59
|
+
# @option opts [int] :count 返回的记录条数,默认为10
|
60
|
+
#
|
61
|
+
# @see http://open.weibo.com/wiki/2/search/suggestions/apps
|
62
|
+
def suggestions_apps(q, opts={})
|
63
|
+
get 'search/suggestions/apps.json', :params => {:q => q}.merge(opts)
|
64
|
+
end
|
65
|
+
|
66
|
+
# @用户时的联想建议
|
67
|
+
#
|
68
|
+
# @param [String] q 搜索的关键字
|
69
|
+
# @param [int] type 联想类型,0:关注、1:粉丝
|
70
|
+
# @param [Hash] opts
|
71
|
+
# @option opts [int] :count 返回的记录条数,默认为10,粉丝最多1000,关注最多2000
|
72
|
+
# @option opts [int] :range 联想范围,0:只联想关注人、1:只联想关注人的备注、2:全部,默认为2
|
73
|
+
#
|
74
|
+
# @see http://open.weibo.com/wiki/2/search/suggestions/at_users
|
75
|
+
def suggestions_at_users(q, type, opts={})
|
76
|
+
get 'search/suggestions/at_users.json', :params => {:q => q, :type => type}.merge(opts)
|
77
|
+
end
|
78
|
+
|
79
|
+
#TODO:test no pass
|
80
|
+
# 综合联想,包含用户、微群、应用等的联想建议
|
81
|
+
#
|
82
|
+
# @param [String] query 搜索的关键字
|
83
|
+
# @param [Hash] opts
|
84
|
+
# @option opts [int] :sort_user 用户排序,0:按专注人最多,默认为0
|
85
|
+
# @option opts [int] :sort_app 应用排序,0:按用户数最多,默认为0
|
86
|
+
# @option opts [int] :sort_grp 微群排序,0:按成员数最多,默认为0
|
87
|
+
# @option opts [int] :user_count 返回的用户记录条数,默认为4
|
88
|
+
# @option opts [int] :app_count 返回的应用记录条数,默认为1
|
89
|
+
# @option opts [int] :grp_count 返回的微群记录条数,默认为1
|
90
|
+
#
|
91
|
+
# @see http://open.weibo.com/wiki/2/search/suggestions/integrate
|
92
|
+
def suggestions_integrate(q, opts={})
|
93
|
+
get 'search/suggestions/integrate.json', :params => {:query => q}.merge(opts)
|
94
|
+
end
|
95
|
+
|
96
|
+
# 搜索与指定的一个或多个条件相匹配的微博 [Privilege]
|
97
|
+
#
|
98
|
+
# @param [Hash] opts
|
99
|
+
# @option opts [String] :q 搜索的关键字
|
100
|
+
# @option opts [int] :filter_ori 过滤器,是否为原创,0:全部、1:原创、2:转发,默认为0
|
101
|
+
# @option opts [int] :filter_pic 过滤器。是否包含图片,0:全部、1:包含、2:不包含,默认为0
|
102
|
+
# @option opts [int64] :fuid 搜索的微博作者的用户UID
|
103
|
+
# @option opts [int] :province 搜索的省份范围,省份ID
|
104
|
+
# @option opts [int] :city 搜索的城市范围,城市ID
|
105
|
+
# @option opts [int64] :starttime 开始时间,Unix时间戳
|
106
|
+
# @option opts [int64] :endtime 结束时间,Unix时间戳
|
107
|
+
# @option opts [int] :count 单页返回的记录条数,默认为10
|
108
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
109
|
+
# @option opts [boolean] :needcount 返回结果中是否包含返回记录数,true:返回、false:不返回,默认为false
|
110
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
111
|
+
#
|
112
|
+
# @see http://open.weibo.com/wiki/2/search/statuses
|
113
|
+
def statuses(opts={})
|
114
|
+
get 'search/statuses.json', :params => opts
|
115
|
+
end
|
116
|
+
|
117
|
+
# 获取指定地点周边的微博列表 [Privilege]
|
118
|
+
#
|
119
|
+
# @param [float] longitude 经度。有效范围:-180.0到+180.0,+表示东经
|
120
|
+
# @param [float] latitude 纬度。有效范围:-90.0到+90.0,+表示北纬
|
121
|
+
# @param [Hash] opts
|
122
|
+
# @option opts [int] :range 搜索范围,单位米,默认500米,最大11132米
|
123
|
+
# @option opts [int] :time 返回结果所在的时间段,单位为分钟,指从现在开始之前的时间段
|
124
|
+
# @option opts [int] :sort_type 排序方式。默认为0,按时间排序;为1时按与中心点距离进行排序
|
125
|
+
# @option opts [int] :page 返回结果页码。默认为1
|
126
|
+
# @option opts [int] :count 每页结果数。默认10,最大50
|
127
|
+
# @option opts [int] :base_app 是否根据当前应用返回数据。默认0:全部应用;1:仅限当前应用
|
128
|
+
#
|
129
|
+
# @see http://open.weibo.com/wiki/2/search/geo/statuses
|
130
|
+
def geo_statuses(longitude, latitude, opts={})
|
131
|
+
get 'search/geo/statuses.json', :params => {:longitude => longitude, :latitude => latitude}.merge(opts)
|
132
|
+
end
|
133
|
+
|
134
|
+
# 通过关键词搜索用户 [Privilege]
|
135
|
+
#
|
136
|
+
# @param [Hash] opts
|
137
|
+
# @option opts [String] :q 搜索的关键字
|
138
|
+
# @option opts [int] :snick 搜索范围是否包含昵称,0:不包含、1:包含
|
139
|
+
# @option opts [int] :sdomain 搜索范围是否包含个性域名,0:不包含、1:包含
|
140
|
+
# @option opts [int] :sintro 搜索范围是否包含简介,0:不包含、1:包含
|
141
|
+
# @option opts [int] :stag 搜索范围是否包含标签,0:不包含、1:包含
|
142
|
+
# @option opts [int] :province 搜索的省份范围,省份ID
|
143
|
+
# @option opts [int] :city 搜索的城市范围,城市ID
|
144
|
+
# @option opts [String] :gender 搜索的性别范围,m:男、f:女
|
145
|
+
# @option opts [String] :comorsch 搜索的公司学校名称
|
146
|
+
# @option opts [int] :sort 排序方式,1:按更新时间、2:按粉丝数,默认为1
|
147
|
+
# @option opts [int] :count 单页返回的记录条数,默认为10
|
148
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
149
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
150
|
+
#
|
151
|
+
# @see http://open.weibo.com/wiki/2/search/users
|
152
|
+
def users(opts={})
|
153
|
+
get 'search/users.json', :params => opts
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,300 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Weibo2
|
3
|
+
module Interface
|
4
|
+
|
5
|
+
# Statuses API
|
6
|
+
#
|
7
|
+
# @see http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2#.E5.BE.AE.E5.8D.9A
|
8
|
+
class Statuses < Base
|
9
|
+
|
10
|
+
# 返回最新的公共微博
|
11
|
+
#
|
12
|
+
# @param [Hash] opts
|
13
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
14
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
15
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
16
|
+
#
|
17
|
+
# @see http://open.weibo.com/wiki/2/statuses/public_timeline
|
18
|
+
def public_timeline(opts={})
|
19
|
+
get 'statuses/public_timeline.json', :params => opts
|
20
|
+
end
|
21
|
+
|
22
|
+
# 获取当前登录用户及其所关注用户的最新微博
|
23
|
+
#
|
24
|
+
# @param [Hash] opts
|
25
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的微博(即比since_id时间晚的微博),默认为0
|
26
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的微博,默认为0
|
27
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
28
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
29
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
30
|
+
# @option opts [int] :feature 过滤类型ID,0:全部、1:原创、2:图片、3:视频、4:音乐,默认为0
|
31
|
+
#
|
32
|
+
# @see http://open.weibo.com/wiki/2/statuses/friends_timeline
|
33
|
+
def friends_timeline(opts={})
|
34
|
+
get 'statuses/friends_timeline.json', :params => opts
|
35
|
+
end
|
36
|
+
|
37
|
+
# 获取当前登录用户及其所关注用户的最新微博
|
38
|
+
#
|
39
|
+
# @param [Hash] opts
|
40
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的微博(即比since_id时间晚的微博),默认为0
|
41
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的微博,默认为0
|
42
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
43
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
44
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
45
|
+
# @option opts [int] :feature 过滤类型ID,0:全部、1:原创、2:图片、3:视频、4:音乐,默认为0
|
46
|
+
#
|
47
|
+
# @see http://open.weibo.com/wiki/2/statuses/home_timeline
|
48
|
+
def home_timeline(opts={})
|
49
|
+
get 'statuses/home_timeline.json', :params => opts
|
50
|
+
end
|
51
|
+
|
52
|
+
# 获取某个用户最新发表的微博列表
|
53
|
+
#
|
54
|
+
# @param [Hash] opts
|
55
|
+
# @option opts [int64] :uid 需要查询的用户ID
|
56
|
+
# @option opts [String] :screen_name 需要查询的用户昵称
|
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
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
62
|
+
# @option opts [int] :feature 过滤类型ID,0:全部、1:原创、2:图片、3:视频、4:音乐,默认为0
|
63
|
+
# @option opts [int] :trim_user 返回值中user信息开关,0:返回完整的user信息、1:user字段仅返回user_id,默认为0
|
64
|
+
#
|
65
|
+
# @see http://open.weibo.com/wiki/2/statuses/user_timeline
|
66
|
+
def user_timeline(opts={})
|
67
|
+
get 'statuses/user_timeline.json', :params => opts
|
68
|
+
end
|
69
|
+
|
70
|
+
# 批量获取指定的一批用户的微博列表 [Privilege]
|
71
|
+
#
|
72
|
+
# @option opts [String] :uids 需要查询的用户ID,用半角逗号分隔,一次最多20个
|
73
|
+
# @option opts [String] :screen_name 需要查询的用户昵称,用半角逗号分隔,一次最多20个
|
74
|
+
# @option opts [int] :count 单页返回的记录条数,默认为20
|
75
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
76
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
77
|
+
# @option opts [int] :feature 过滤类型ID,0:全部、1:原创、2:图片、3:视频、4:音乐,默认为0
|
78
|
+
# @see http://open.weibo.com/wiki/2/statuses/timeline_batch
|
79
|
+
def timeline_batch(opts={})
|
80
|
+
get 'statuses/timeline_batch.json', :params => opts
|
81
|
+
end
|
82
|
+
|
83
|
+
# 获取指定微博的转发微博列表
|
84
|
+
#
|
85
|
+
# @param [int64] id 需要查询的微博ID
|
86
|
+
# @param [Hash] opts
|
87
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的微博(即比since_id时间晚的微博),默认为0
|
88
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的微博,默认为0
|
89
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
90
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
91
|
+
# @option opts [int] :filter_by_author 作者筛选类型,0:全部、1:我关注的人、2:陌生人,默认为0
|
92
|
+
#
|
93
|
+
# @see http://open.weibo.com/wiki/2/statuses/repost_timeline
|
94
|
+
def repost_timeline(id, opts={})
|
95
|
+
get 'statuses/repost_timeline.json', :params => {:id => id}.merge(opts)
|
96
|
+
end
|
97
|
+
|
98
|
+
# 获取当前用户最新转发的微博列表
|
99
|
+
#
|
100
|
+
# @param [Hash] opts
|
101
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的微博(即比since_id时间晚的微博),默认为0
|
102
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的微博,默认为0
|
103
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
104
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
105
|
+
#
|
106
|
+
# @see http://open.weibo.com/wiki/2/statuses/repost_by_me
|
107
|
+
def repost_by_me(opts={})
|
108
|
+
get 'statuses/repost_by_me.json', :params => opts
|
109
|
+
end
|
110
|
+
|
111
|
+
# 获取最新的提到登录用户的微博列表,即@我的微博
|
112
|
+
#
|
113
|
+
# @param [Hash] opts
|
114
|
+
# @option opts [int64] :since_id 若指定此参数,则返回ID比since_id大的微博(即比since_id时间晚的微博),默认为0
|
115
|
+
# @option opts [int64] :max_id 若指定此参数,则返回ID小于或等于max_id的微博,默认为0
|
116
|
+
# @option opts [int] :count 单页返回的记录条数,默认为50
|
117
|
+
# @option opts [int] :page 返回结果的页码,默认为1
|
118
|
+
# @option opts [int] :filter_by_author 作者筛选类型,0:全部、1:我关注的人、2:陌生人,默认为0
|
119
|
+
# @option opts [int] :filter_by_source 来源筛选类型,0:全部、1:来自微博、2:来自微群,默认为0
|
120
|
+
# @option opts [int] :filter_by_type 原创筛选类型,0:全部微博、1:原创的微博,默认为0
|
121
|
+
#
|
122
|
+
# @see http://open.weibo.com/wiki/2/statuses/mentions
|
123
|
+
def mentions(opts={})
|
124
|
+
get 'statuses/mentions.json', :params => opts
|
125
|
+
end
|
126
|
+
|
127
|
+
# 根据微博ID获取单条微博内容
|
128
|
+
#
|
129
|
+
# @param [int] id 需要获取的微博ID
|
130
|
+
#
|
131
|
+
# @see http://open.weibo.com/wiki/2/statuses/show
|
132
|
+
def show(id)
|
133
|
+
get 'statuses/show.json', :params => {:id => id}
|
134
|
+
end
|
135
|
+
|
136
|
+
# 根据微博ID批量获取微博信息 [Privilege]
|
137
|
+
#
|
138
|
+
# @param [String] ids 需要查询的微博ID,用半角逗号分隔,最多不超过50个
|
139
|
+
#
|
140
|
+
# @see http://open.weibo.com/wiki/2/statuses/show_batch
|
141
|
+
def show_batch(ids)
|
142
|
+
get 'statuses/show_batch.json', :params => {:ids => ids}
|
143
|
+
end
|
144
|
+
|
145
|
+
# 通过微博(评论、私信)ID获取其MID
|
146
|
+
#
|
147
|
+
# @param [int64] id 需要查询的微博(评论、私信)ID,批量模式下,用半角逗号分隔,最多不超过20个
|
148
|
+
# @param [int] type 获取类型,1:微博、2:评论、3:私信,默认为1
|
149
|
+
# @param [Hash] opts
|
150
|
+
# @option opts [int] :is_batch 是否使用批量模式,0:否、1:是,默认为0
|
151
|
+
#
|
152
|
+
# @see http://open.weibo.com/wiki/2/statuses/querymid
|
153
|
+
def querymid(id, type=1, opts={})
|
154
|
+
get 'statuses/querymid.json', :params => {:id => id, :type => type}.merge(opts)
|
155
|
+
end
|
156
|
+
|
157
|
+
# test failed
|
158
|
+
# 通过微博(评论、私信)MID获取其ID
|
159
|
+
#
|
160
|
+
# @param [String] mid 需要查询的微博(评论、私信)MID,批量模式下,用半角逗号分隔,最多不超过20个
|
161
|
+
# @param [int] type 获取类型,1:微博、2:评论、3:私信,默认为1
|
162
|
+
# @param [Hash] opts
|
163
|
+
# @option opts [int] :is_batch 是否使用批量模式,0:否、1:是,默认为0
|
164
|
+
# @option opts [int] :inbox 仅对私信有效,当MID类型为私信时用此参数,0:发件箱、1:收件箱,默认为0
|
165
|
+
# @option opts [int] :isBase62 MID是否是base62编码,0:否、1:是,默认为0
|
166
|
+
#
|
167
|
+
# @see http://open.weibo.com/wiki/2/statuses/queryid
|
168
|
+
def queryid(mid, type=1, opts={})
|
169
|
+
get 'statuses/queryid.json', :params => {:mid => mid, :type => type}.merge(opts)
|
170
|
+
end
|
171
|
+
|
172
|
+
# 按天返回热门微博转发榜的微博列表
|
173
|
+
#
|
174
|
+
# @param [Hash] opts
|
175
|
+
# @option opts [int] :count 返回的记录条数,最大不超过50,默认为20
|
176
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
177
|
+
#
|
178
|
+
# @see http://open.weibo.com/wiki/2/statuses/hot/repost_daily
|
179
|
+
def hot_repost_daily(opts={})
|
180
|
+
get 'statuses/hot/repost_daily.json', :params => opts
|
181
|
+
end
|
182
|
+
|
183
|
+
# 按周返回热门微博转发榜的微博列表
|
184
|
+
#
|
185
|
+
# @param [Hash] opts
|
186
|
+
# @option opts [int] :count 返回的记录条数,最大不超过50,默认为20
|
187
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
188
|
+
#
|
189
|
+
# @see http://open.weibo.com/wiki/2/statuses/hot/repost_weekly
|
190
|
+
def hot_repost_weekly(opts={})
|
191
|
+
get 'statuses/hot/repost_weekly.json', :params => opts
|
192
|
+
end
|
193
|
+
|
194
|
+
# 按天返回热门微博评论榜的微博列表
|
195
|
+
#
|
196
|
+
# @param [Hash] opts
|
197
|
+
# @option opts [int] :count 返回的记录条数,最大不超过50,默认为20
|
198
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
199
|
+
#
|
200
|
+
# @see http://open.weibo.com/wiki/2/statuses/hot/comments_daily
|
201
|
+
def hot_comments_daily(opts={})
|
202
|
+
get 'statuses/hot/comments_daily.json', :params => opts
|
203
|
+
end
|
204
|
+
|
205
|
+
# 按周返回热门微博评论榜的微博列表
|
206
|
+
#
|
207
|
+
# @param [Hash] opts
|
208
|
+
# @option opts [int] :count 返回的记录条数,最大不超过50,默认为20
|
209
|
+
# @option opts [int] :base_app 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用),默认为0
|
210
|
+
#
|
211
|
+
# @see http://open.weibo.com/wiki/2/statuses/hot/comments_weekly
|
212
|
+
def hot_comments_weekly(opts={})
|
213
|
+
get 'statuses/hot/comments_weekly.json', :params => opts
|
214
|
+
end
|
215
|
+
|
216
|
+
|
217
|
+
#
|
218
|
+
# write
|
219
|
+
#
|
220
|
+
|
221
|
+
# 转发一条微博
|
222
|
+
#
|
223
|
+
# @param [int64] id 要转发的微博ID
|
224
|
+
# @param [Hash] opts
|
225
|
+
# @option opts [String] :status 添加的转发文本,必须做URLencode,内容不超过140个汉字,不填则默认为“转发微博”
|
226
|
+
# @option opts [int] :is_comment 是否在转发的同时发表评论,0:否、1:评论给当前微博、2:评论给原微博、3:都评论,默认为0
|
227
|
+
#
|
228
|
+
# @see http://open.weibo.com/wiki/2/statuses/repost
|
229
|
+
def repost(id, opts={})
|
230
|
+
post 'statuses/repost.json', :body => {:id => id}.merge(opts)
|
231
|
+
end
|
232
|
+
|
233
|
+
# 根据微博ID删除指定微博
|
234
|
+
#
|
235
|
+
# @param [int64] id 需要删除的微博ID
|
236
|
+
#
|
237
|
+
# @see http://open.weibo.com/wiki/2/statuses/destroy
|
238
|
+
def destroy(id)
|
239
|
+
post 'statuses/destroy.json', :body => {:id => id}
|
240
|
+
end
|
241
|
+
|
242
|
+
# no tested
|
243
|
+
# 发布一条新微博
|
244
|
+
#
|
245
|
+
# @param [String] status 要发布的微博文本内容,内容不超过140个汉字
|
246
|
+
# @param [Hash] opts
|
247
|
+
# @option opts [float] :lat 纬度,有效范围:-90.0到+90.0,+表示北纬,默认为0.0
|
248
|
+
# @option opts [float] :long 经度,有效范围:-180.0到+180.0,+表示东经,默认为0.0
|
249
|
+
# @option opts [String] :annotations 元数据,主要是为了方便第三方应用记录一些适合于自己使用的信息,每条微博
|
250
|
+
# 可以包含一个或者多个元数据,必须以json字串的形式提交,字串长度不超过512个字符,具体内容可以自定
|
251
|
+
#
|
252
|
+
# @see http://open.weibo.com/wiki/2/statuses/update
|
253
|
+
def update(status, opts={})
|
254
|
+
post 'statuses/update.json', :body => {:status => status}.merge(opts)
|
255
|
+
end
|
256
|
+
|
257
|
+
# no tested
|
258
|
+
# 上传图片并发布一条新微博
|
259
|
+
#
|
260
|
+
# @param [String] status 要发布的微博文本内容,内容不超过140个汉字
|
261
|
+
# @param [binary] pic 要上传的图片,仅支持JPEG、GIF、PNG格式,图片大小小于5M
|
262
|
+
# @param [Hash] opts
|
263
|
+
# @option opts [float] :lat 纬度,有效范围:-90.0到+90.0,+表示北纬,默认为0.0
|
264
|
+
# @option opts [float] :long 经度,有效范围:-180.0到+180.0,+表示东经,默认为0.0
|
265
|
+
# @option opts [String] :annotations 元数据,主要是为了方便第三方应用记录一些适合于自己使用的信息,每条微博
|
266
|
+
# 可以包含一个或者多个元数据,必须以json字串的形式提交,字串长度不超过512个字符,具体内容可以自定
|
267
|
+
#
|
268
|
+
# @see http://open.weibo.com/wiki/2/statuses/upload
|
269
|
+
def upload(status, pic, opts={})
|
270
|
+
post 'statuses/upload.json', :body => {:status => status, :pic => pic}.merge(opts)
|
271
|
+
end
|
272
|
+
|
273
|
+
# 指定一个图片URL地址抓取后上传并同时发布一条新微博 [Privilege]
|
274
|
+
#
|
275
|
+
# @param [Hash] opts
|
276
|
+
# @option opts [String] :status 要发布的微博文本内容,内容不超过140个汉字
|
277
|
+
# @option opts [String] :url 图片的URL地址,必须以http开头
|
278
|
+
# @option opts [float] :lat 纬度,有效范围:-90.0到+90.0,+表示北纬,默认为0.0
|
279
|
+
# @option opts [float] :long 经度,有效范围:-180.0到+180.0,+表示东经,默认为0.0
|
280
|
+
# @option opts [String] :annotations 元数据,主要是为了方便第三方应用记录一些适合于自己使用的信息,每条微博
|
281
|
+
# 可以包含一个或者多个元数据,必须以json字串的形式提交,字串长度不超过512个字符,具体内容可以自定
|
282
|
+
#
|
283
|
+
# @see http://open.weibo.com/wiki/2/statuses/upload_url_text
|
284
|
+
def upload_url_text(opts={})
|
285
|
+
post 'statuses/upload_url_text.json', :body => opts
|
286
|
+
end
|
287
|
+
|
288
|
+
# 获取微博官方表情的详细信息
|
289
|
+
#
|
290
|
+
# @param [Hash] opts
|
291
|
+
# @option opts [String] :type 表情类别,face:普通表情、ani:魔法表情、cartoon:动漫表情,默认为face
|
292
|
+
# @option opts [String] :language 语言类别,cnname:简体、twname:繁体,默认为cnname
|
293
|
+
#
|
294
|
+
# @see http://open.weibo.com/wiki/2/emotions
|
295
|
+
def emotions(opts={})
|
296
|
+
get 'emotions.json', :params => opts
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|