Module: Booru::API::Wiki

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

Instance Method Summary collapse

Instance Method Details

#create_wiki_page(options = {}) ⇒ Object

Create: This action creates a wiki page

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

:wiki_page[title] - The title of the wiki page.
:wiki_page[body]  - The body of the wiki page.

Title must be exact (but case and whitespace don’t matter).



27
28
29
30
31
# File 'lib/booru/api/wiki.rb', line 27

def create_wiki_page(options = {})
  base_url = '/wiki/create'
  query = query_string(base_url, options)
  parse(post(query))
end

#destroy_wiki_page(options = {}) ⇒ Object Also known as: delete_wiki_page

Destroy: This action deletes a wiki page

Title must be exact (but case and whitespace don’t matter).

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

:title - The title of the page to delete.

You must be logged in as a moderator to use this action.



72
73
74
75
76
# File 'lib/booru/api/wiki.rb', line 72

def destroy_wiki_page(options = {})
  base_url = '/wiki/destroy'
  query = query_string(base_url, options)
  parse(post(query))
end

#list_wiki_pages(options = {}) ⇒ Object

List: This action retrieves a list of wiki pages.

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

:order - How you want the pages ordered. Can be: title,
         date.
:limit - The number of pages to retrieve.
:page  - The page number.
:query - A word or phrase to search for.


14
15
16
17
18
# File 'lib/booru/api/wiki.rb', line 14

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

#lock_wiki_page(options = {}) ⇒ Object

Lock: This action locks a wiki page from being updated

Title must be exact (but case and whitespace don’t matter).

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

:title - The title of the page to lock.

You must be logged in as a moderator to use this action.



88
89
90
91
92
# File 'lib/booru/api/wiki.rb', line 88

def lock_wiki_page(options = {})
  base_url = '/wiki/lock'
  query = query_string(base_url, options)
  parse(post(query))
end

#revert_wiki_page(options = {}) ⇒ Object

Revert: This action reverts a wiki page to a previous version

Title must be exact (but case and whitespace don’t matter).

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

:title   - The title of the wiki page to update.
:version - The version to revert to.

Potential error reasons: “Page is locked”



117
118
119
120
121
# File 'lib/booru/api/wiki.rb', line 117

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

#show_wiki_page(options = {}) ⇒ Object

Show: This action retrieves a wiki page

Title must be exact (but case and whitespace don’t matter).

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

:title   - The title of the wiki page to retrieve.
:version - The version of the page to retrieve.

Potential error reasons: “artist type”



58
59
60
61
62
# File 'lib/booru/api/wiki.rb', line 58

def show_wiki_page(options = {})
  base_url = '/wiki/show'
  query = query_string(base_url, options)
  parse(get(query))
end

#unlock_wiki_page(options = {}) ⇒ Object

Unlock: This action unlocks a wiki page for updating

Title must be exact (but case and whitespace don’t matter).

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

:title - The title of the page to unlock.

You must be logged in as a moderator to use this action.



102
103
104
105
106
# File 'lib/booru/api/wiki.rb', line 102

def unlock_wiki_page(options = {})
  base_url = '/wiki/unlock'
  query = query_string(base_url, options)
  parse(post(query))
end

#update_wiki_page(options = {}) ⇒ Object

Update: This action updates a wiki page

Title must be exact (but case and whitespace don’t matter).

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

:title            - The title of the wiki page to update.
:wiki_page[title] - The new title of the wiki page.
:wiki_page[body]  - The new body of the wiki page.

Potential error reasons: “Page is locked”



43
44
45
46
47
# File 'lib/booru/api/wiki.rb', line 43

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

#wiki_page_history(options = {}) ⇒ Object

History: This action retrieves versions of the specified wiki page

Title must be exact (but case and whitespace don’t matter).

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

:title - The title of the wiki page to retrieve history.


129
130
131
132
133
# File 'lib/booru/api/wiki.rb', line 129

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