Module: Douban::Client::Note
- Included in:
- Douban::Client
- Defined in:
- lib/douban_api/client/note.rb
Overview
豆瓣日记 API V2 developers.douban.com/wiki/?title=note_v2
Instance Method Summary collapse
- #create_note(options = {}) ⇒ Object
- #create_note_comment(id, content) ⇒ Object
- #like_note(id) ⇒ Object
- #liked_notes(user_id = nil, format = "text", options = {}) ⇒ Object
- #note(id, format = "text") ⇒ Object
- #note_comment(note_id, comment_id) ⇒ Object
- #note_comments(id, options = {}) ⇒ Object
- #notes(user_id = nil, format = "text", options = {}) ⇒ Object
- #notes_guesses(user_id = nil, format = "text", options = {}) ⇒ Object
- #remove_note(id) ⇒ Object
- #remove_note_comment(note_id, comment_id) ⇒ Object
- #unlike_note(id) ⇒ Object
- #update_note(id, options = {}) ⇒ Object
- #upload_photon_to_note(id, options) ⇒ Object
Instance Method Details
#create_note(options = {}) ⇒ Object
6 7 8 |
# File 'lib/douban_api/client/note.rb', line 6 def create_note(={}) post "v2/notes", end |
#create_note_comment(id, content) ⇒ Object
80 81 82 |
# File 'lib/douban_api/client/note.rb', line 80 def create_note_comment(id, content) post "v2/note/#{id}/comments", {:content => content} end |
#like_note(id) ⇒ Object
55 56 57 |
# File 'lib/douban_api/client/note.rb', line 55 def like_note(id) post "v2/note/#{id}/like" end |
#liked_notes(user_id = nil, format = "text", options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/douban_api/client/note.rb', line 22 def liked_notes(user_id=nil, format="text", ={}) .merge!(:format => format) if user_id.nil? response = get("v2/note/user_liked/#{get_user_id}", ) else response = get("v2/note/user_liked/#{user_id}", ) end response["notes"] end |
#note(id, format = "text") ⇒ Object
46 47 48 49 |
# File 'lib/douban_api/client/note.rb', line 46 def note(id, format="text") .merge!(:format => format) get "v2/note/#{id}", end |
#note_comment(note_id, comment_id) ⇒ Object
85 86 87 |
# File 'lib/douban_api/client/note.rb', line 85 def note_comment(note_id, comment_id) get "v2/note/#{note_id}/comment/#{comment_id}" end |
#note_comments(id, options = {}) ⇒ Object
75 76 77 78 |
# File 'lib/douban_api/client/note.rb', line 75 def note_comments(id, ={}) response = get("v2/note/#{id}/comments", ) response["comments"] end |
#notes(user_id = nil, format = "text", options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/douban_api/client/note.rb', line 10 def notes(user_id=nil, format="text", ={}) .merge!(:format => format) if user_id.nil? response = get("v2/note/user_created/#{get_user_id}", ) else response = get("v2/note/user_created/#{user_id}", ) end response["notes"] end |
#notes_guesses(user_id = nil, format = "text", options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/douban_api/client/note.rb', line 34 def notes_guesses(user_id=nil, format="text", ={}) .merge!(:format => format) if user_id.nil? response = get("/v2/note/people_notes/#{get_user_id}/guesses", ) else response = get("v2/note/user_liked/#{user_id}", ) end response["notes"] end |
#remove_note(id) ⇒ Object
71 72 73 |
# File 'lib/douban_api/client/note.rb', line 71 def remove_note(id) delete("v2/note/#{id}")["status"] == 200 end |
#remove_note_comment(note_id, comment_id) ⇒ Object
89 90 91 |
# File 'lib/douban_api/client/note.rb', line 89 def remove_note_comment(note_id, comment_id) delete "v2/note/#{note_id}/comment/#{comment_id}" end |
#unlike_note(id) ⇒ Object
59 60 61 |
# File 'lib/douban_api/client/note.rb', line 59 def unlike_note(id) delete "v2/note/#{id}/like" end |
#update_note(id, options = {}) ⇒ Object
63 64 65 |
# File 'lib/douban_api/client/note.rb', line 63 def update_note(id, ={}) put "v2/note/#{id}", end |
#upload_photon_to_note(id, options) ⇒ Object
67 68 69 |
# File 'lib/douban_api/client/note.rb', line 67 def upload_photon_to_note(id, ) post "v2/note/#{id}", end |