Module: Booru::API::Note

Included in:
Client
Defined in:
lib/booru/api/note.rb

Instance Method Summary collapse

Instance Method Details

#list_notes(options = {}) ⇒ Object

List: This action retrieves a list of notes for a specified post

options - The Hash used to refine the selection (default: {}):

:post_id - The post id number to retrieve notes for.


10
11
12
13
14
# File 'lib/booru/api/note.rb', line 10

def list_notes(options = {})
  base_url = '/note/index'
  query = query_string(base_url, options)
  parse(get(query))
end

#note_history(options = {}) ⇒ Object

History: This action retrieves a note’s history (previous versions)

You can either specify id, post_id, or nothing. Specifying nothing will give you a list of every note verison.

options - The Hash used to refine the selection (default: {}):

:limit   - How many versions to retrieve.
:page    - The offset.
:post_id - The post id number to retrieve note versions for.
:id      - The note id number to retrieve versions for.


36
37
38
39
40
# File 'lib/booru/api/note.rb', line 36

def note_history(options = {})
  base_url = '/note/history'
  query = query_string(base_url, options)
  parse(get(query))
end

#revert_note(options = {}) ⇒ Object

Revert: This action reverts a note to a previous version

options - The Hash used to refine the selection (default: {}):

:id      - The note id to update.
:version - The version to revert to.

Potential error reasons: “Post is locked”



49
50
51
52
53
# File 'lib/booru/api/note.rb', line 49

def revert_note(options = {})
  base_url = '/note/revert'
  query = query_string(base_url, options)
  parse(post(query))
end

#search_notes(options = {}) ⇒ Object

Search: This action searches and retrieves a list of notes

options - The Hash used to refine the selection (default: {}):

:query - A word or phrase to search for.


20
21
22
23
24
# File 'lib/booru/api/note.rb', line 20

def search_notes(options = {})
  base_url = '/note/search'
  query = query_string(base_url, options)
  parse(get(query))
end

#update_note(options = {}) ⇒ Object

Create/Update: This action creates or modifies an existing note

Notes differ from the other controllers in that the interface for creation and updates is the same. If you supply an id parameter, then Danbooru will assume you’re updating an existing note. Otherwise, it will create a new note.

options - The Hash used to refine the selection (default: {}):

:id              - If you are updating a note, this is
                   the note id number to update.
:note[post_id]   - The post id number of this note.
:note[x]         - The x coordinate of the note.
:note[y]         - The y coordinate of the note.
:note[width]     - The width of the note.
:note[height]    - The height of the note.
:note[is_active] - Whether or not the note is visible.
                   Set to 1 for active, 0 for inactive.
:note[body]      - The note message.

Potential error reasons: “Post is locked”



75
76
77
78
79
# File 'lib/booru/api/note.rb', line 75

def update_note(options = {})
  base_url = '/note/update'
  query = query_string(base_url, options)
  parse(post(query))
end