Module: Douban::Client::Album
- Included in:
- Douban::Client
- Defined in:
- lib/douban_api/client/album.rb
Overview
豆瓣日记 API V2 developers.douban.com/wiki/?title=note_v2
Instance Method Summary collapse
- #album(id) ⇒ Object
- #album_photos(id, options) ⇒ Object
- #albums(user_id, options) ⇒ Object
- #create_album(options = {}) ⇒ Object
-
#create_photo_comment(id, content) ⇒ Object
回复照片.
- #delete_photo(id) ⇒ Object
- #like_album(id) ⇒ Object
- #like_photo(id) ⇒ Object
- #liked_albums(user_id, options) ⇒ Object
- #photo(id) ⇒ Object
-
#photo_comment(photo_id, comment_id) ⇒ Object
获得照片单条回复.
-
#photo_comments(id, options = {}) ⇒ Object
照片回复列表.
- #remove_album(id) ⇒ Object
-
#remove_photo_comment(photo_id, comment_id) ⇒ Object
删除照片单条回复.
- #unlike_photo(id) ⇒ Object
- #unline_album(id) ⇒ Object
- #update_album(id, options = {}) ⇒ Object
- #update_photo(id, desc) ⇒ Object
- #upload_photo(album_id, image_path, options = {}) ⇒ Object
Instance Method Details
#album(id) ⇒ Object
6 7 8 |
# File 'lib/douban_api/client/album.rb', line 6 def album(id) get "v2/album/#{id}" end |
#album_photos(id, options) ⇒ Object
22 23 24 25 |
# File 'lib/douban_api/client/album.rb', line 22 def album_photos(id, ) response = get("v2/album/#{id}/photos", ) response["photos"] end |
#albums(user_id, options) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/douban_api/client/album.rb', line 35 def albums(user_id, ) if user_id.nil? response = get("v2/album/user_created/#{get_user_id}", ) else response = get("v2/album/user_created/#{user_id}", ) end response["albums"] end |
#create_album(options = {}) ⇒ Object
10 11 12 |
# File 'lib/douban_api/client/album.rb', line 10 def create_album(={}) post "v2/albums", end |
#create_photo_comment(id, content) ⇒ Object
回复照片
86 87 88 |
# File 'lib/douban_api/client/album.rb', line 86 def create_photo_comment(id, content) create_comment('photo', id, content) end |
#delete_photo(id) ⇒ Object
66 67 68 |
# File 'lib/douban_api/client/album.rb', line 66 def delete_photo(id) delete "v2/photo/#{id}" end |
#like_album(id) ⇒ Object
27 28 29 |
# File 'lib/douban_api/client/album.rb', line 27 def like_album(id) post "v2/album/#{id}/like" end |
#like_photo(id) ⇒ Object
70 71 72 |
# File 'lib/douban_api/client/album.rb', line 70 def like_photo(id) post "v2/photo/#{id}/like" end |
#liked_albums(user_id, options) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/douban_api/client/album.rb', line 44 def liked_albums(user_id, ) if user_id.nil? response = get("v2/album/user_liked/#{get_user_id}", ) else response = get("v2/album/user_liked/#{user_id}", ) end response["albums"] end |
#photo(id) ⇒ Object
53 54 55 |
# File 'lib/douban_api/client/album.rb', line 53 def photo(id) get "v2/photo/#{id}" end |
#photo_comment(photo_id, comment_id) ⇒ Object
获得照片单条回复
92 93 94 |
# File 'lib/douban_api/client/album.rb', line 92 def photo_comment(photo_id, comment_id) comment('photo', photo_id, comment_id) end |
#photo_comments(id, options = {}) ⇒ Object
照片回复列表
80 81 82 |
# File 'lib/douban_api/client/album.rb', line 80 def photo_comments(id, ={}) comments('photo', id, ={}) end |
#remove_album(id) ⇒ Object
18 19 20 |
# File 'lib/douban_api/client/album.rb', line 18 def remove_album(id) delete "v2/album/#{id}" end |
#remove_photo_comment(photo_id, comment_id) ⇒ Object
删除照片单条回复
98 99 100 |
# File 'lib/douban_api/client/album.rb', line 98 def remove_photo_comment(photo_id, comment_id) remove_comment('photo', photo_id, comment_id) end |
#unlike_photo(id) ⇒ Object
74 75 76 |
# File 'lib/douban_api/client/album.rb', line 74 def unlike_photo(id) delete "v2/photo/#{id}/like" end |
#unline_album(id) ⇒ Object
31 32 33 |
# File 'lib/douban_api/client/album.rb', line 31 def unline_album(id) delete "v2/album/#{id}/like" end |
#update_album(id, options = {}) ⇒ Object
14 15 16 |
# File 'lib/douban_api/client/album.rb', line 14 def update_album(id, ={}) put "v2/album/#{id}", end |
#update_photo(id, desc) ⇒ Object
62 63 64 |
# File 'lib/douban_api/client/album.rb', line 62 def update_photo(id, desc) put "v2/photo/#{id}", {:desc => desc} end |
#upload_photo(album_id, image_path, options = {}) ⇒ Object
57 58 59 60 |
# File 'lib/douban_api/client/album.rb', line 57 def upload_photo(album_id, image_path, ={}) file = Faraday::UploadIO.new(image_path, [:content_type]) post "v2/album/#{album_id}", .merge(:image => file) end |