Module: BWAPI::Client::Projects::Categories

Includes:
Copy
Included in:
BWAPI::Client::Projects
Defined in:
lib/bwapi/client/projects/categories.rb,
lib/bwapi/client/projects/categories/copy.rb

Overview

Categories module for projects/categories endpoints

Defined Under Namespace

Modules: Copy

Instance Method Summary collapse

Methods included from Copy

#copy_category

Instance Method Details

#categories(project_id, opts = {}) ⇒ Hash

Get all categories in project

Parameters:

  • project_id (Integer)

    Id of project

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • page (Integer)

    Page of projects to retrieve

  • pageSize (Integer)

    Results per page of results

Returns:

  • (Hash)

    All categories in project



15
16
17
# File 'lib/bwapi/client/projects/categories.rb', line 15

def categories(project_id, opts = {})
  get "projects/#{project_id}/categories", opts
end

#create_category(project_id, opts = {}) ⇒ Hash

Create a new category in project

Parameters:

  • project_id (Integer)

    Id of project

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • id (Integer)

    Id of the category

  • name (String)

    Name of the category

  • children (Array)

    The children of the category

  • multiple (Boolean)

    Whether multiple sub categories can be selected

Returns:

  • (Hash)

    New category



28
29
30
# File 'lib/bwapi/client/projects/categories.rb', line 28

def create_category(project_id, opts = {})
  post "projects/#{project_id}/categories", opts
end

#delete_category(project_id, category_id) ⇒ Hash

Delete and existing category in project

Parameters:

  • project_id (Integer)

    Id of project

  • category_id (Integer)

    Id of query group

Returns:

  • (Hash)

    Deleted category



51
52
53
# File 'lib/bwapi/client/projects/categories.rb', line 51

def delete_category(project_id, category_id)
  delete "projects/#{project_id}/categories/#{category_id}"
end

#update_category(project_id, category_id, opts = {}) ⇒ Hash

Update an existing category in project

Parameters:

  • project_id (Integer)

    Id of project

  • category_id (Integer)

    Id of category

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • id (Integer)

    Id of the category

  • name (String)

    Name of the category

  • children (Array)

    The children of the category

  • multiple (Boolean)

    Whether multiple sub categories can be selected

Returns:

  • (Hash)

    Updated category



42
43
44
# File 'lib/bwapi/client/projects/categories.rb', line 42

def update_category(project_id, category_id, opts = {})
  put "projects/#{project_id}/categories/#{category_id}", opts
end