Module: Catch::Note
- Included in:
- Client
- Defined in:
- lib/catch/note.rb
Instance Method Summary collapse
-
#add_note(params = {}) ⇒ Object
Create a new note.
-
#delete_note(id) ⇒ Object
Deletes a note, or annotations of a note if specified.
-
#modify_note(id, params = {}) ⇒ Object
Modify a note.
-
#note(id) ⇒ Object
Retrieves a single note.
-
#notes(params = {}) ⇒ Object
Lists multiple notes for the current user.
Instance Method Details
#add_note(params = {}) ⇒ Object
Create a new note.
Waiting on annotations
47 48 49 50 51 |
# File 'lib/catch/note.rb', line 47 def add_note(params={}) payload = params.map {|k,v| "#{k}=#{v}"}.join("&") response = connection.post "notes", payload response.body.notes.first end |
#delete_note(id) ⇒ Object
Deletes a note, or annotations of a note if specified
78 79 80 |
# File 'lib/catch/note.rb', line 78 def delete_note(id) connection.delete("notes/#{id}").body.status == 'ok' end |
#modify_note(id, params = {}) ⇒ Object
Modify a note
Waiting on annotations
69 70 71 72 73 |
# File 'lib/catch/note.rb', line 69 def modify_note(id, params={}) payload = params.map {|k,v| "#{k}=#{v}"}.join("&") response = connection.post "notes/#{id}", payload response.body.notes.first end |
#note(id) ⇒ Object
Retrieves a single note
27 28 29 |
# File 'lib/catch/note.rb', line 27 def note(id) connection.get("notes/#{id}").body.notes.first end |
#notes(params = {}) ⇒ Object
Lists multiple notes for the current user.
Specifies a note sort order. Valid sort orders are: created_asc sort by note creation date in ascending order (most recent first) create_dec sort by note creation date in descending order (most recent last) modified_asc sort by note modification date in ascending order (most recent first) modified_dec sort by note modification date in descending order (most recent last) text_asc sort by the note text content from in ascending order (A to Z) text_dec sort by the note text content from in descending order (Z to A)
16 17 18 19 20 21 |
# File 'lib/catch/note.rb', line 16 def notes(params={}) connection.get do |req| req.url("notes") req.params.merge!(params) end.body.notes end |