Module: Gitlab::Client::Milestones

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

Overview

Defines methods related to milestones.

Instance Method Summary collapse

Instance Method Details

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

Creates a new milestone.

Examples:

Gitlab.create_milestone(5, 'v1.0')

Options Hash (options):

  • :description (String)

    The description of a milestone.

  • :due_date (String)

    The due date of a milestone.



56
57
58
59
# File 'lib/gitlab/client/milestones.rb', line 56

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

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

Updates a milestone.

Examples:

Gitlab.edit_milestone(5, 2, { state_event: 'activate' })

Options Hash (options):

  • :title (String)

    The title of a milestone.

  • :description (String)

    The description of a milestone.

  • :due_date (String)

    The due date of a milestone.

  • :state_event (String)

    The state of a milestone ('close' or 'activate').



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

def edit_milestone(project, id, options={})
  put("/projects/#{project}/milestones/#{id}", body: options)
end

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

Gets a single milestone.

Examples:

Gitlab.milestone(5, 36)


27
28
29
# File 'lib/gitlab/client/milestones.rb', line 27

def milestone(project, id)
  get("/projects/#{project}/milestones/#{id}")
end

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

Gets the issues of a given milestone.

Examples:

Gitlab.milestone_issues(5, 2)

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.



41
42
43
# File 'lib/gitlab/client/milestones.rb', line 41

def milestone_issues(project, milestone, options={})
  get("/projects/#{project}/milestones/#{milestone}/issues", query: options)
end

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

Gets a list of project's milestones.

Examples:

Gitlab.milestones(5)

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.



15
16
17
# File 'lib/gitlab/client/milestones.rb', line 15

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