douban_api 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.yardopts CHANGED
@@ -1,4 +1,5 @@
1
1
  --no-private
2
- --charset utf-8
3
- --tag authenticated:"需要认证"
4
- --tag scope:"需要的scope"
2
+ --protected
3
+ --tag authenticated:"是否需要认证"
4
+ --tag douban.scope:"需要的scope"
5
+ --charset utf-8
data/README.md CHANGED
@@ -3,14 +3,139 @@ Simple Ruby wrapper for [Douban API V2](http://developers.douban.com/wiki/?title
3
3
  这个项目仍在开发中,缺少文档和测试,欢迎贡献。
4
4
  ## Installation
5
5
  gem install douban_api
6
-
7
- ## Examples
8
6
 
9
- ### 获取某部电影
10
- Douban.movie('1292000')
11
7
 
12
- <Hashie::Mash alt="http://movie.douban.com/movie/1292000" alt_title="搏击俱乐部 / 搏击会" attrs=#<Hashie::Mash cast=["爱德华·诺顿 Edward Norton", "布拉德·皮特 Brad Pitt", "海伦娜·邦汉·卡特 Helena Bonham Carter", "杰瑞德·莱托 Jared Leto"] country=["美国", "德国"] director=["大卫·芬奇 David Fincher"] language=["英语"] movie_duration=["139 分钟"] movie_type=["剧情", "悬疑", "惊悚"] pubdate=["1999-10-15"] title=["Fight Club"] writer=["恰克·帕拉尼克 Chuck Palahniuk", "Jim Uhls"] year=["1999"]> author=[#<Hashie::Mash name="大卫·芬奇 David Fincher">] collection_link="http://api.douban.com/collection/218762015" id="http://api.douban.com/movie/1292000" image="http://img3.douban.com/spic/s1447851.jpg" mobile_link="http://m.douban.com/movie/subject/1292000/" rating=#<Hashie::Mash average="9.1" max=10 min=0 numRaters=200291> summary="杰克(爱德华•诺顿 饰)是一个大汽车公司的职员,患有严重的失眠症,对周围的一切充满危机和憎恨。\n一个偶然的机会,杰克遇上了卖肥皂的商人泰勒(布拉德•皮特),一个浑身充满叛逆、残酷和暴烈的痞子英雄,并因为自己公寓失火而住进了泰勒破旧不堪的家中。两人因缘际会地成为了好朋友,并创立了“搏击俱乐部”:一个让人们不戴护具而徒手搏击,宗旨在于发泄情绪的地下组织。\n俱乐部吸引了越来越多的人,逐渐发展成为一个全国性的地下组织,而泰勒也以自己个人的魅力,吸引着那些盲目的信徒。俱乐部的成员们到处滋事打架、大肆破坏,泰勒本人的行为也越来越疯狂。\n杰克对于“搏击俱乐部”的现况及泰勒的行为越来越无法忍受,和泰勒发生争执,泰勒离开了他。然而,杰克发现,他走到何处都无法摆脱泰勒的影子,他开始思考:我到底是谁?" tags=[#<Hashie::Mash count=29736 name="美国">, #<Hashie::Mash count=27727 name="心理">, #<Hashie::Mash count=22910 name="暴力">, #<Hashie::Mash count=20650 name="经典">, #<Hashie::Mash count=18032 name="悬疑">, #<Hashie::Mash count=12505 name="剧情">, #<Hashie::Mash count=9023 name="黑色">, #<Hashie::Mash count=5578 name="犯罪">] title="Fight Club">
13
-
14
-
8
+ ## Sample Sinatra App
9
+ require 'rubygems'
10
+ require 'sinatra'
11
+ require 'haml'
12
+ require 'douban_api'
13
+
14
+ enable :sessions
15
+
16
+ set :app_file, __FILE__
17
+ set :root, File.dirname(__FILE__)
18
+ set :views, 'views'
19
+ set :public_folder, 'public'
20
+
21
+ # 设置回调的URL和所需的scope(http://developers.douban.com/wiki/?title=oauth2)
22
+ set :callback_url, "http://doubanapi.notimportant.org/connect"
23
+ set :scope, "douban_basic_common,shuo_basic_r,shuo_basic_w"
24
+
25
+
26
+ # 设置 apikey和secret,可在 http://developers.douban.com/apikey/ 处查看
27
+ Douban.configure do |config|
28
+ config.client_id = ENV['DOUBAN_API_KEY']
29
+ config.client_secret = ENV['DOUBAN_API_SECRET']
30
+ end
31
+
32
+
33
+ get '/' do
34
+ haml :index, :layout => :'layouts/application'
35
+ end
36
+
37
+ get '/login' do
38
+ redirect Douban.authorize_url(:redirect_uri => settings.callback_url, :scope => settings.scope)
39
+ end
40
+
41
+ get '/connect' do
42
+ response = Douban.get_access_token(params[:code], :redirect_uri => settings.callback_url)
43
+ session[:access_token] = response.access_token
44
+ session[:user_id] = response.douban_user_id
45
+ redirect "/timeline"
46
+ end
47
+
48
+ get '/timeline' do
49
+ @client = Douban.client(:access_token => session[:access_token], :user_id => session[:user_id])
50
+ @statuses = @client.timeline
51
+ haml :timeline, :layout => :'layouts/application'
52
+ end
53
+
54
+ ## API Useage Examples
55
+
56
+ client = Douban.client(:access_token=>access_token, :user_id => user_id)
57
+
58
+ # 获取已认证用户对音乐的所有标签
59
+ client.user_music_tags
60
+
61
+ => [{"count"=>166, "alt"=>"http://music.douban.com/tag/内地", "title"=>"内地"},
62
+ {"count"=>155, "alt"=>"http://music.douban.com/tag/摇滚", "title"=>"摇滚"},
63
+ {"count"=>139, "alt"=>"http://music.douban.com/tag/美国", "title"=>"美国"},
64
+ {"count"=>127, "alt"=>"http://music.douban.com/tag/台湾", "title"=>"台湾"},
65
+ {"count"=>109, "alt"=>"http://music.douban.com/tag/Pop", "title"=>"Pop"},
66
+ {"count"=>105, "alt"=>"http://music.douban.com/tag/2011", "title"=>"2011"},
67
+ {"count"=>100, "alt"=>"http://music.douban.com/tag/华语", "title"=>"华语"},
68
+ {"count"=>97, "alt"=>"http://music.douban.com/tag/女声", "title"=>"女声"},
69
+ {"count"=>87, "alt"=>"http://music.douban.com/tag/Rock", "title"=>"Rock"},
70
+ {"count"=>83, "alt"=>"http://music.douban.com/tag/民谣", "title"=>"民谣"},
71
+ {"count"=>80, "alt"=>"http://music.douban.com/tag/2010", "title"=>"2010"},
72
+ {"count"=>77, "alt"=>"http://music.douban.com/tag/欧美", "title"=>"欧美"},
73
+ {"count"=>73, "alt"=>"http://music.douban.com/tag/英国", "title"=>"英国"},
74
+ {"count"=>73, "alt"=>"http://music.douban.com/tag/中国", "title"=>"中国"},
75
+ {"count"=>65, "alt"=>"http://music.douban.com/tag/2012", "title"=>"2012"},
76
+ {"count"=>60, "alt"=>"http://music.douban.com/tag/男声", "title"=>"男声"},
77
+ {"count"=>55, "alt"=>"http://music.douban.com/tag/流行", "title"=>"流行"},
78
+ {"count"=>52, "alt"=>"http://music.douban.com/tag/indie", "title"=>"indie"},
79
+ {"count"=>52, "alt"=>"http://music.douban.com/tag/rock", "title"=>"rock"},
80
+ {"count"=>48, "alt"=>"http://music.douban.com/tag/Indie", "title"=>"Indie"}]
81
+
82
+ # 已登录用户的豆邮收件箱
83
+ client.inbox
84
+
85
+ => [{"status"=>"R",
86
+ "sender"=>
87
+ {"avatar"=>
88
+ "http://img3.douban.com/view/site/small/public/fc82eb2dcec6ed0.jpg",
89
+ "alt"=>"http://site.douban.com/fuzz/",
90
+ "id"=>"104427",
91
+ "name"=>"THE FUZZ 法兹",
92
+ "uid"=>"fuzz"},
93
+ "title"=>"近期动向",
94
+ "published"=>"2012-12-07 11:32:04",
95
+ "content"=>
96
+ "打扰各位,近期2场演出后我们将休整一段时间,开始专辑的准备和录制工作!\r\n\r\n2场演出分别是\r\n12.21 月亮钥匙 W 刺猬\r\n12.28 光圈 地下丝绒45周年致敬演出 "receiver"=>
97
+ {"avatar"=>"http://img3.douban.com/icon/u2217855-34.jpg",
98
+ "alt"=>"http://www.douban.com/people/xiaosong/",
99
+ "id"=>"2217855",
100
+ "name"=>"小松其实还没有",
101
+ "uid"=>"xiaosong"},
102
+ "id"=>"283060020"},
103
+ {"status"=>"R",………………………………
104
+
105
+ # 发送一条广播
106
+ client.shuo("呵呵后")
107
+
108
+ => {"category"=>nil,
109
+ "reshared_count"=>0,
110
+ "attachments"=>[],
111
+ "entities"=>{"user_mentions"=>[], "topics"=>[], "urls"=>[]},
112
+ "muted"=>false,
113
+ "text"=>"呵呵后",
114
+ "created_at"=>"2012-12-07 14:58:49",
115
+ "title"=>"说:",
116
+ "can_reply"=>1,
117
+ "liked"=>false,
118
+ "source"=>{"href"=>"", "title"=>"douReminder"},
119
+ "like_count"=>0,
120
+ "comments_count"=>0,
121
+ "user"=>
122
+ {"description"=>"",
123
+ "small_avatar"=>"http://img3.douban.com/icon/u2217855-34.jpg",
124
+ "uid"=>"xiaosong",
125
+ "type"=>"user",
126
+ "id"=>"2217855",
127
+ "screen_name"=>"小松其实还没有"},
128
+ "is_follow"=>false,
129
+ "has_photo"=>true,
130
+ "type"=>"text",
131
+ "id"=>1059068526}
132
+
133
+ 更多请查看[文档](http://rdoc.info/github/seansay/douban_api/master/frames) 或阅读 [源码](https://github.com/seansay/douban_api/tree/master/lib/douban_api/client)
134
+
135
+ ## TODOs
136
+
137
+ * Test, test, test……
138
+ * 文档
139
+
15
140
  ## Copyright
16
141
  This project a fork of [instagram-ruby-gem](https://github.com/Instagram/instagram-ruby-gem), see [LICENSE](https://github.com/seansay/douban_api/blob/master/LICENSE.md) for details.
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require File.expand_path('../connection', __FILE__)
2
3
  require File.expand_path('../request', __FILE__)
3
4
  require File.expand_path('../oauth', __FILE__)
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 豆瓣日记 API V2 http://developers.douban.com/wiki/?title=note_v2
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 图书Api V2
@@ -7,7 +8,7 @@ module Douban
7
8
  # 获取图书信息
8
9
  #
9
10
  # @see http://developers.douban.com/wiki/?title=book_v2#get_book
10
- # @scope book_basic_r
11
+ # @douban.scope book_basic_r
11
12
  # @authenticated false
12
13
  # @param id [String] 图书的id
13
14
  # @return [Hashie::Mash] 图书信息
@@ -19,7 +20,7 @@ module Douban
19
20
 
20
21
  # 根据isbn获取图书信息
21
22
  #
22
- # @scope book_basic_r
23
+ # @douban.scope book_basic_r
23
24
  # @see http://developers.douban.com/wiki/?title=book_v2#get_isbn_book
24
25
  # @authenticated false
25
26
  # @param id [String] 图书的id
@@ -32,7 +33,7 @@ module Douban
32
33
 
33
34
  # 通过关键字搜索图书
34
35
  #
35
- # @scope book_basic_r
36
+ # @douban.scope book_basic_r
36
37
  # @see http://developers.douban.com/wiki/?title=book_v2#get_book_search
37
38
  # @authenticated false
38
39
  # @param q [String] 查询关键字
@@ -46,7 +47,7 @@ module Douban
46
47
 
47
48
  # 通过tag搜索图书
48
49
  #
49
- # @scope book_basic_r
50
+ # @douban.scope book_basic_r
50
51
  # @see http://developers.douban.com/wiki/?title=book_v2#get_book_search
51
52
  # @authenticated false
52
53
  # @param tag [String] 查询的tag
@@ -60,7 +61,7 @@ module Douban
60
61
 
61
62
  # 某个图书中标记最多的标签, 最多返回前50个tag
62
63
  #
63
- # @scope book_basic_r
64
+ # @douban.scope book_basic_r
64
65
  # @see http://developers.douban.com/wiki/?title=book_v2#get_book_tags
65
66
  # @authenticated false
66
67
  # @param id [String] 图书的id
@@ -74,7 +75,7 @@ module Douban
74
75
 
75
76
  # 获取用户对图书的所有标签
76
77
  #
77
- # @scope book_basic_r
78
+ # @douban.scope book_basic_r
78
79
  # @see http://developers.douban.com/wiki/?title=book_v2#get_user_book_tags
79
80
  # @authenticated false
80
81
  # @param name [String] 用户uid或者数字id
@@ -95,7 +96,7 @@ module Douban
95
96
 
96
97
  # 发表新评论
97
98
  #
98
- # @scope douban_basic_common
99
+ # @douban.scope douban_basic_common
99
100
  # @see http://developers.douban.com/wiki/?title=book_v2#post_book_review
100
101
  # @authenticated true
101
102
  # @param id [String] 图书的id
@@ -111,13 +112,13 @@ module Douban
111
112
  # 嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻...(省略一些嘻)",
112
113
  # :rating => 5
113
114
  # })
114
- def create_book_review(book_id, options={})
115
- post "v2/book/reviews", options.merge(:book => book_id)
115
+ def create_book_review(id, options={})
116
+ post "v2/book/reviews", options.merge(:book => id)
116
117
  end
117
118
 
118
119
  # 修改评论
119
120
  #
120
- # @scope douban_basic_common
121
+ # @douban.scope douban_basic_common
121
122
  # @see http://developers.douban.com/wiki/?title=book_v2#put_book_review
122
123
  # @authenticated true
123
124
  # @param id [String] 评论的id
@@ -139,7 +140,7 @@ module Douban
139
140
 
140
141
  # 删除评论
141
142
  #
142
- # @scope douban_basic_common
143
+ # @douban.scope douban_basic_common
143
144
  # @see http://developers.douban.com/wiki/?title=book_v2#delete_book_review
144
145
  # @authenticated true
145
146
  # @param id [String] 图书的id
@@ -157,7 +158,7 @@ module Douban
157
158
 
158
159
  # 获取某篇笔记的信息
159
160
  #
160
- # @scope book_basic_r
161
+ # @douban.scope book_basic_r
161
162
  # @see http://developers.douban.com/wiki/?title=book_v2#delete_book_review
162
163
  # @authenticated true
163
164
  # @param id [String] 笔记的id
@@ -173,7 +174,7 @@ module Douban
173
174
 
174
175
  # 获取某本图书的所有笔记
175
176
  #
176
- # @scope book_basic_r
177
+ # @douban.scope book_basic_r
177
178
  # @see http://developers.douban.com/wiki/?title=book_v2#get_book_annotations
178
179
  # @authenticated false
179
180
  # @param id [String] 图书的id
@@ -193,7 +194,7 @@ module Douban
193
194
 
194
195
  # 用户给某本图书写笔记
195
196
  #
196
- # @scope book_basic_w
197
+ # @douban.scope book_basic_w
197
198
  # @see http://developers.douban.com/wiki/?title=book_v2#post_book_annotation
198
199
  # @authenticated true
199
200
  # @param id [String] 图书的id
@@ -218,7 +219,7 @@ module Douban
218
219
 
219
220
  # 用户修改某篇笔记
220
221
  #
221
- # @scope book_basic_w
222
+ # @douban.scope book_basic_w
222
223
  # @see http://developers.douban.com/wiki/?title=book_v2#put_annotation
223
224
  # @authenticated true
224
225
  # @param id [String] 图书的id
@@ -243,7 +244,7 @@ module Douban
243
244
 
244
245
  # 用户删除某篇笔记
245
246
  #
246
- # @scope book_basic_w
247
+ # @douban.scope book_basic_w
247
248
  # @see http://developers.douban.com/wiki/?title=book_v2#delete_annotation
248
249
  # @authenticated true
249
250
  # @param id [String] 笔记的id
@@ -261,7 +262,7 @@ module Douban
261
262
 
262
263
  # 获取某个用户的所有笔记
263
264
  #
264
- # @scope book_basic_r
265
+ # @douban.scope book_basic_r
265
266
  # @see http://developers.douban.com/wiki/?title=book_v2#get_user_annotations
266
267
  # @authenticated false
267
268
  # @param name [String] 用户uid或者数字id
@@ -282,7 +283,7 @@ module Douban
282
283
 
283
284
  # 获取用户对某本图书的收藏信息
284
285
  #
285
- # @scope book_basic_r
286
+ # @douban.scope book_basic_r
286
287
  # @see http://developers.douban.com/wiki/?title=book_v2#get_book_collection
287
288
  # @authenticated true
288
289
  # @param id [String] 图书的id
@@ -295,7 +296,7 @@ module Douban
295
296
 
296
297
  # 获取某个用户的所有图书收藏信息
297
298
  #
298
- # @scope book_basic_r
299
+ # @douban.scope book_basic_r
299
300
  # @see http://developers.douban.com/wiki/?title=book_v2#get_user_collections
300
301
  # @authenticated false
301
302
  # @param name [String] 用户uid或者数字id
@@ -328,7 +329,7 @@ module Douban
328
329
 
329
330
  # 获取某个用户的所有图书收藏信息
330
331
  #
331
- # @scope book_basic_w
332
+ # @douban.scope book_basic_w
332
333
  # @see http://developers.douban.com/wiki/?title=book_v2#post_book_collection
333
334
  # @authenticated true
334
335
  # @param id [String] 图书的id
@@ -352,7 +353,7 @@ module Douban
352
353
 
353
354
  # 获取某个用户的所有图书收藏信息
354
355
  #
355
- # @scope book_basic_w
356
+ # @douban.scope book_basic_w
356
357
  # @see http://developers.douban.com/wiki/?title=book_v2#put_book_collection
357
358
  # @authenticated true
358
359
  # @param id [String] 图书的id
@@ -377,7 +378,7 @@ module Douban
377
378
 
378
379
  # 用户删除某篇笔记
379
380
  #
380
- # @scope book_basic_w
381
+ # @douban.scope book_basic_w
381
382
  # @see http://developers.douban.com/wiki/?title=book_v2#delete_book_collection
382
383
  # @authenticated true
383
384
  # @param id [String] 图书的id
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 回复Api V2
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 论坛API V2 http://developers.douban.com/wiki/?title=discussion_v2
@@ -1,11 +1,13 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 豆邮Api V2 http://developers.douban.com/wiki/?title=doumail_v2
4
5
  module Doumail
6
+
5
7
  # 获取一封邮件
6
8
  #
7
9
  # @see http://developers.douban.com/wiki/?title=doumail_v2#get_mail
8
- # @scope community_advanced_doumail_r
10
+ # @douban.scope community_advanced_doumail_r
9
11
  # @authenticated true
10
12
  # @param id [String] 豆邮的id
11
13
  # @return [Hashie::Mash] 豆邮信息
@@ -18,7 +20,7 @@ module Douban
18
20
  # 获取用户收件箱
19
21
  #
20
22
  # @see http://developers.douban.com/wiki/?title=doumail_v2#inbox
21
- # @scope community_advanced_doumail_r
23
+ # @douban.scope community_advanced_doumail_r
22
24
  # @authenticated true
23
25
  # @return [Array<Hashie::Mash>] 豆邮列表
24
26
  # @example 获取当前用户的收件箱
@@ -31,7 +33,7 @@ module Douban
31
33
  # 获取用户发件箱
32
34
  #
33
35
  # @see http://developers.douban.com/wiki/?title=doumail_v2#outbox
34
- # @scope community_advanced_doumail_r
36
+ # @douban.scope community_advanced_doumail_r
35
37
  # @authenticated true
36
38
  # @return [Array<Hashie::Mash>] 豆邮列表
37
39
  # @example 获取当前用户的发件箱
@@ -44,7 +46,7 @@ module Douban
44
46
  # 获取用户未读邮件
45
47
  #
46
48
  # @see http://developers.douban.com/wiki/?title=doumail_v2#unread
47
- # @scope community_advanced_doumail_r
49
+ # @douban.scope community_advanced_doumail_r
48
50
  # @authenticated true
49
51
  # @return [Array<Hashie::Mash>] 豆邮列表
50
52
  # @example 获取当前用户未读邮件
@@ -57,11 +59,10 @@ module Douban
57
59
  # 标记已读邮件
58
60
  #
59
61
  # @see http://developers.douban.com/wiki/?title=doumail_v2#read
60
- # @scope community_advanced_doumail_w
62
+ # @douban.scope community_advanced_doumail_w
61
63
  # @authenticated true
62
- # @param id [String] 豆邮的id
63
- # @param id [Array<String>] 豆邮id的列表
64
- # @return [Hashie::Mash] 豆邮信息
64
+ # @param id [Array<String>, String] 豆邮id的列表或豆邮的id
65
+ # @return [Array<Hashie::Mash>, Hashie::Mash] 豆邮信息或者豆邮列表
65
66
  # @example 标记id为281740901的
66
67
  # client.read("281740901")
67
68
  # @example 标记多个豆邮为已读
@@ -78,10 +79,9 @@ module Douban
78
79
  # 删除豆邮
79
80
  #
80
81
  # @see http://developers.douban.com/wiki/?title=doumail_v2#delete
81
- # @scope community_advanced_doumail_w
82
+ # @douban.scope community_advanced_doumail_w
82
83
  # @authenticated true
83
- # @param id [String] 豆邮的id
84
- # @param id [Array<String>] 豆邮id的列表
84
+ # @param id [Array<String>, String] 豆邮id的列表或豆邮的id
85
85
  # @return [Hashie::Mash] 豆邮信息
86
86
  # @example 删除id为281740901的删除
87
87
  # client.delete_doumail("281740901")
@@ -98,7 +98,7 @@ module Douban
98
98
  # 发送一封豆邮
99
99
  #
100
100
  # @see http://developers.douban.com/wiki/?title=doumail_v2#send
101
- # @scope community_advanced_doumail_w
101
+ # @douban.scope community_advanced_doumail_w
102
102
  # @authenticated true
103
103
  # @param receiver_id [String] 收件人的id
104
104
  # @option options [String] :title 豆邮标题: 必填字段
@@ -107,10 +107,10 @@ module Douban
107
107
  # @option options [String] :captcha_string 用户输入验证码: 选填字段
108
108
  # @return [Hashie::Mash] 豆邮信息
109
109
  # @example 发送一封豆邮
110
- # client.send_doumail('48576635', {
111
- # :title => "test",
112
- # :content => "只是test"
113
- # })
110
+ # client.send_doumail('48576635', {
111
+ # :title => "test",
112
+ # :content => "只是test"
113
+ # })
114
114
  def send_doumail(receiver_id, options={})
115
115
  options["receiver_id"] = receiver_id
116
116
  post("v2/doumails", options) == {}
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 豆瓣同城 V2 http://developers.douban.com/wiki/?title=event_v2
@@ -130,7 +131,7 @@ module Douban
130
131
  # @see http://developers.douban.com/wiki/?title=event_v2#loc_get
131
132
  # @scope event_basic_r
132
133
  # @authenticated false
133
- # @param loc_id [String] 城市id
134
+ # @param id [String] 城市id
134
135
  # @return [Hashie::Mash] 活动列表
135
136
  # @example 查看北京的信息
136
137
  # Douban.loc('108288')
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 电影Api V2 http://developers.douban.com/wiki/?title=movie_v2
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 音乐Api V2 http://developers.douban.com/wiki/?title=music_v2
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 豆瓣日记 API V2 http://developers.douban.com/wiki/?title=note_v2
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # Douban api online onlines
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 豆瓣广播 Api V2 http://developers.douban.com/wiki/?title=shuo_v2
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # 豆瓣用户API V2 http://developers.douban.com/wiki/?title=user_v2
@@ -8,7 +9,7 @@ module Douban
8
9
  # @scope douban_basic_common
9
10
  # @see http://developers.douban.com/wiki/?title=user_v2#get_user
10
11
  # @authenticated false
11
- # @param id [String] 用户uid或者数字id
12
+ # @param user_id [String] 用户uid或者数字id
12
13
  # @return [Hashie::Mash] 用户信息
13
14
  # @example 查看ahbei的信息
14
15
  # Douban.user('ahbei')
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  class Client
3
4
  # @private
@@ -12,4 +13,4 @@ module Douban
12
13
  end
13
14
  end
14
15
  end
15
- end
16
+ end
@@ -1,8 +1,8 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  # Wrapper for the Douban REST API
3
4
  #
4
- # @note All methods have been separated into modules and follow the same grouping used in {TODO:doc_URL the Douban API Documentation}.
5
- # @see TODO:doc_url
5
+ # @note All methods have been separated into modules and follow the same grouping used in the Douban API Documentation.
6
6
  class Client < API
7
7
  Dir[File.expand_path('../client/*.rb', __FILE__)].each{|f| require f}
8
8
 
@@ -22,4 +22,4 @@ module Douban
22
22
  include Douban::Client::Comment
23
23
 
24
24
  end
25
- end
25
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'faraday'
2
3
  require File.expand_path('../../faraday/parts/filepart', __FILE__)
3
4
  require File.expand_path('../version', __FILE__)
@@ -58,7 +59,6 @@ module Douban
58
59
  # The user agent that will be sent to the API endpoint if none is set
59
60
  DEFAULT_USER_AGENT = "Douban Ruby Gem #{Douban::VERSION}".freeze
60
61
 
61
- # @private
62
62
  attr_accessor *VALID_OPTIONS_KEYS
63
63
 
64
64
  # When this module is extended, set all configuration options to their default values
@@ -91,4 +91,4 @@ module Douban
91
91
  self.proxy = DEFAULT_PROXY
92
92
  end
93
93
  end
94
- end
94
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'faraday_middleware'
2
3
  Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f}
3
4
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  # Custom error class for rescuing from all Douban errors
3
4
  class Error < StandardError; end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  # Defines HTTP request methods
3
4
  module OAuth
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
3
  # Defines HTTP request methods
3
4
  module Request
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Douban
2
- VERSION = '0.1.2'.freeze unless defined?(::Douban::VERSION)
3
+ VERSION = '0.1.3'.freeze unless defined?(::Douban::VERSION)
3
4
  end
data/lib/douban_api.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require File.expand_path('../douban_api/error', __FILE__)
2
3
  require File.expand_path('../douban_api/configuration', __FILE__)
3
4
  require File.expand_path('../douban_api/api', __FILE__)
@@ -24,4 +25,4 @@ module Douban
24
25
  return client.respond_to?(method) || super
25
26
  end
26
27
 
27
- end
28
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'faraday'
2
3
 
3
4
  # @private
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # monkey patch from @liluo https://gist.github.com/4176272
2
3
  class Faraday::Parts::FilePart
3
4
  def initialize(boundary, name, io)
@@ -7,4 +8,4 @@ class Faraday::Parts::FilePart
7
8
  @length = @head.length + file_length
8
9
  @io = CompositeReadIO.new(StringIO.new(@head), io, StringIO.new("\r\n"))
9
10
  end
10
- end
11
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'faraday'
2
3
 
3
4
  # @private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: douban_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
12
+ date: 2012-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -253,7 +253,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
253
  version: '0'
254
254
  segments:
255
255
  - 0
256
- hash: 4460312008487973802
256
+ hash: 3076719196697556601
257
257
  required_rubygems_version: !ruby/object:Gem::Requirement
258
258
  none: false
259
259
  requirements: