Module: Gitlab::Client::Issues

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

Overview

Defines methods related to issues.

Instance Method Summary collapse

Instance Method Details

#create_issue(project, title, options = {}) ⇒ Gitlab::ObjectifiedHash

Creates a new issue.

Parameters:

  • project (Integer, String)

    The ID or code name of a project.

  • title (String)

    The title of an issue.

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

    A customizable set of options.

Options Hash (options):

  • :description (String)

    The description of an issue.

  • :assignee_id (Integer)

    The ID of a user to assign issue.

  • :milestone_id (Integer)

    The ID of a milestone to assign issue.

  • :labels (String)

    Comma-separated label names for an issue.

Returns:



48
49
50
51
# File 'lib/gitlab/client/issues.rb', line 48

def create_issue(project, title, options={})
  body = {:title => title}.merge(options)
  post("/projects/#{project}/issues", :body => body)
end

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

Updates an issue.

Parameters:

  • project (Integer, String)

    The ID or code name of a project.

  • id (Integer)

    The ID of an issue.

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

    A customizable set of options.

Options Hash (options):

  • :title (String)

    The title of an issue.

  • :description (String)

    The description of an issue.

  • :assignee_id (Integer)

    The ID of a user to assign issue.

  • :milestone_id (Integer)

    The ID of a milestone to assign issue.

  • :labels (String)

    Comma-separated label names for an issue.

  • :closed (Boolean)

    The state of an issue (0 = false, 1 = true).

Returns:



65
66
67
# File 'lib/gitlab/client/issues.rb', line 65

def edit_issue(project, id, options={})
  put("/projects/#{project}/issues/#{id}", :body => options)
end

#issue(project, id) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a single issue.

Examples:

Gitlab.issue(5, 36)
Gitlab.issue('gitlab', 42)

Parameters:

  • project (Integer, String)

    The ID or code name of a project.

  • id (Integer)

    The ID of an issue.

Returns:



34
35
36
# File 'lib/gitlab/client/issues.rb', line 34

def issue(project, id)
  get("/projects/#{project}/issues/#{id}")
end

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

Gets a list of user’s issues. Will return a list of project’s issues if project ID or code name passed.

Examples:

Gitlab.issues
Gitlab.issues(5)
Gitlab.issues('gitlab', :per_page => 40)

Parameters:

  • project (Integer, String) (defaults to: nil)

    The ID or code 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:



17
18
19
20
21
22
23
# File 'lib/gitlab/client/issues.rb', line 17

def issues(project=nil, options={})
  if project.to_i.zero?
    get("/issues", :query => options)
  else
    get("/projects/#{project}/issues", :query => options)
  end
end