Module: Booru::API::Pool

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

Instance Method Summary collapse

Instance Method Details

#add_pool_post(options = {}) ⇒ Object Also known as: add_post_to_pool

Add Post: This action adds a post to the specified pool

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

:pool_id - The pool to add the post to.
:post_id - The post to add.

Potential error reasons: “Post already exists”, “access denied”



77
78
79
80
81
# File 'lib/booru/api/pool.rb', line 77

def add_pool_post(options = {})
  base_url = '/pool/add_post'
  query = query_string(base_url, options)
  parse(post(query))
end

#create_pool(options = {}) ⇒ Object

Create: This action creates a pool with the specified attributes

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

:pool[name]        - The name.
:pool[is_public]   - 1 or 0, whether or not the pool is
                     public.
:pool[description] - A description of the pool.


52
53
54
55
56
# File 'lib/booru/api/pool.rb', line 52

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

#destroy_pool(options = {}) ⇒ Object Also known as: delete_pool

Destroy: This action deletes a pool

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

:id - The pool id number.


62
63
64
65
66
# File 'lib/booru/api/pool.rb', line 62

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

#list_pool_posts(options = {}) ⇒ Object

List Posts: This action retrieves a list of posts in a specified pool. If you don’t specify any parameters you’ll get a list of all pools.

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

:id   - The pool id number (optional).
:page - The page (optional).


25
26
27
28
29
# File 'lib/booru/api/pool.rb', line 25

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

#list_pools(options = {}) ⇒ Object

List pools: This action searches and retrieves a list of pools. If you don’t specify any parameters you’ll get a list of all pools.

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

:query - The title (optional).
:page  - The page (optional).


12
13
14
15
16
# File 'lib/booru/api/pool.rb', line 12

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

#remove_pool_post(options = {}) ⇒ Object Also known as: remove_post_from_pool

Remove Post: This action remove a post from the specified pool

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

:pool_id - The pool to remove the post from.
:post_id - The post to remove.

Potential error reasons: “access denied”



92
93
94
95
96
# File 'lib/booru/api/pool.rb', line 92

def remove_pool_post(options = {})
  base_url = '/pool/remove_post'
  query = query_string(base_url, options)
  parse(post(query))
end

#update_pool(options = {}) ⇒ Object

Update: This action modifies a pool’s attributes

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

:id                - The pool id number.
:pool[name]        - The name.
:pool[is_public]   - 1 or 0, whether or not the pool is
                     public.
:pool[description] - A description of the pool.


39
40
41
42
43
# File 'lib/booru/api/pool.rb', line 39

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