Module: Douban::Client::Note

Included in:
Douban::Client
Defined in:
lib/douban_api/client/note.rb

Overview

Instance Method Summary collapse

Instance Method Details

#create_note(options = {}) ⇒ Object



6
7
8
# File 'lib/douban_api/client/note.rb', line 6

def create_note(options={})
  post "v2/notes", options
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", options={})
  options.merge!(:format => format)
  
  if user_id.nil?
    response = get("v2/note/user_liked/#{get_user_id}", options)
  else
    response = get("v2/note/user_liked/#{user_id}", options)
  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")
  options.merge!(:format => format)
  get "v2/note/#{id}", options
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, options={})
  response = get("v2/note/#{id}/comments", options)
  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", options={})
  options.merge!(:format => format)
  
  if user_id.nil?
    response = get("v2/note/user_created/#{get_user_id}", options)
  else
    response = get("v2/note/user_created/#{user_id}", options)
  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", options={})
  options.merge!(:format => format)
  
  if user_id.nil?
    response = get("/v2/note/people_notes/#{get_user_id}/guesses", options)
  else
    response = get("v2/note/user_liked/#{user_id}", options)
  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, options={})
  put "v2/note/#{id}", options
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, options)
  post "v2/note/#{id}", options
end