Module: Gitlab::Client::Boards

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/boards.rb

Overview

Defines methods related to issue boards.

Instance Method Summary collapse

Instance Method Details

#board(project, id) ⇒ Gitlab::ObjectifiedHash

Get a single board.

Examples:

Gitlab.board(5, 1)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of a board.

Returns:



30
31
32
# File 'lib/gitlab/client/boards.rb', line 30

def board(project, id)
  get("/projects/#{url_encode project}/boards/#{id}")
end

#board_list(project, board_id, id) ⇒ Gitlab::ObjectifiedHash

Gets a single board list

Examples:

Gitlab.board_list(5, 42, 25)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • board_id (Integer)

    The ID of a board.

  • id (Integer)

    The ID of a list.

Returns:



100
101
102
# File 'lib/gitlab/client/boards.rb', line 100

def board_list(project, board_id, id)
  get("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
end

#board_lists(project, id) ⇒ Gitlab::ObjectifiedHash

Gets a board lists

Examples:

Gitlab.board_lists(5, 42)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of a board.

Returns:



86
87
88
# File 'lib/gitlab/client/boards.rb', line 86

def board_lists(project, id)
  get("/projects/#{url_encode project}/boards/#{id}/lists")
end

#boards(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of project’s boards.

Examples:

Gitlab.boards(5)
Gitlab.boards({ per_page: 40 })

Parameters:

  • project (Integer, String)

    The ID or name of a project.

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

    A customizable set of options.

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



18
19
20
# File 'lib/gitlab/client/boards.rb', line 18

def boards(project, options = {})
  get("/projects/#{url_encode project}/boards", query: options)
end

#create_board(project, name) ⇒ Gitlab::ObjectifiedHash

Creates a new board.

Examples:

Gitlab.create_board(5, 'newboard')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • name (String)

    The name of the new board.

Returns:



42
43
44
45
# File 'lib/gitlab/client/boards.rb', line 42

def create_board(project, name)
  body = { name: name }
  post("/projects/#{url_encode project}/boards", body: body)
end

#create_board_list(project, board_id, label_id) ⇒ Gitlab::ObjectifiedHash

Creates a new board list. Only for admins and project owners

Examples:

Gitlab.create_board_list(5, 42, 25)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of a board.

  • label_id (Integer)

    The ID of a label.

Returns:



114
115
116
# File 'lib/gitlab/client/boards.rb', line 114

def create_board_list(project, board_id, label_id)
  post("/projects/#{url_encode project}/boards/#{board_id}/lists", body: { label_id: label_id })
end

#delete_board(project, id) ⇒ void

This method returns an undefined value.

Deletes a board.

Examples:

Gitlab.delete_board(5, 1)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of a board.



74
75
76
# File 'lib/gitlab/client/boards.rb', line 74

def delete_board(project, id)
  delete("/projects/#{url_encode project}/boards/#{id}")
end

#delete_board_list(project, board_id, id) ⇒ Gitlab::ObjectifiedHash

Deletes a board list. Only for admins and project owners

Examples:

Gitlab.delete_board_list(3, 42, 32)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • board_id (Integer)

    The ID of a board.

  • id (Integer)

    The ID of a list.

Returns:



142
143
144
# File 'lib/gitlab/client/boards.rb', line 142

def delete_board_list(project, board_id, id)
  delete("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
end

#edit_board(project, id, options = {}) ⇒ Gitlab::ObjectifiedHash

Updates a board.

Examples:

Gitlab.edit_board(5, 1, name: 'new_name')
Gitlab.edit_board(5, 1, name: 'new_name', assignee_id: 1, milestone_id: 1)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of a board.

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

    A customizable set of options.

Options Hash (options):

  • :name(optional) (String)

    The new name of the board.

  • :assignee_id(optional) (Integer)

    The assignee the board should be scoped to.

  • :milestone_id(optional) (Integer)

    The milestone the board should be scoped to.

  • :labels(optional) (String)

    Comma-separated list of label names which the board should be scoped to.

  • :weight(optional) (Integer)

    The weight range from 0 to 9, to which the board should be scoped to.

Returns:



62
63
64
# File 'lib/gitlab/client/boards.rb', line 62

def edit_board(project, id, options = {})
  put("/projects/#{url_encode project}/boards/#{id}", body: options)
end

#edit_board_list(project, board_id, id, position) ⇒ Gitlab::ObjectifiedHash

Updates a board list. Only for admins and project owners

Examples:

Gitlab.edit_board_list(6, 1, 12, 5)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • board_id (Integer)

    The ID of a board.

  • id (Integer)

    The ID of a list.

Returns:



128
129
130
# File 'lib/gitlab/client/boards.rb', line 128

def edit_board_list(project, board_id, id, position)
  put("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}", body: { position: position })
end