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

Included in:
BWAPI::Client::Projects
Defined in:
lib/bwapi/client/projects/categories.rb

Instance Method Summary collapse

Instance Method Details

#categories(id, opts = {}) ⇒ Hashie::Mash

Get all categories in project

Parameters:

  • 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:

  • (Hashie::Mash)

    All categories in project



13
14
15
# File 'lib/bwapi/client/projects/categories.rb', line 13

def categories id, opts={}
  get "projects/#{id}/categories", opts
end

#create_category(id, opts = {}) ⇒ Hashie::Mash

Create a new category in project

Parameters:

  • 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:

  • (Hashie::Mash)

    New category



38
39
40
# File 'lib/bwapi/client/projects/categories.rb', line 38

def create_category id, opts={}
  post "projects/#{id}/categories", opts
end

#delete_category(project_id, category_id) ⇒ Hashie::Mash

Delete and existing category in project

Parameters:

  • project_id (Integer)

    Id of project

  • category_id (Integer)

    Id of query group

Returns:

  • (Hashie::Mash)

    Deleted category



63
64
65
# File 'lib/bwapi/client/projects/categories.rb', line 63

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

#update_category(project_id, category_id, opts = {}) ⇒ Hashie::Mash

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):

  • projectId (Integer)

    Id of the project

  • 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:

  • (Hashie::Mash)

    Updated category



53
54
55
# File 'lib/bwapi/client/projects/categories.rb', line 53

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