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

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • title (String)

    The title of a milestone.

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

    A customizable set of options.

Options Hash (options):

  • :description (String)

    The description of a milestone.

  • :due_date (String)

    The due date of a milestone.

Returns:



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

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

#delete_milestone(project, id) ⇒ nil

Delete a project milestone.

Examples:

Gitlab.delete_milestone(5, 2)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of a milestone.

Returns:

  • (nil)

    This API call returns an empty response body.



102
103
104
# File 'lib/gitlab/client/milestones.rb', line 102

def delete_milestone(project, id)
  delete("/projects/#{url_encode project}/milestones/#{id}")
end

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

Updates a milestone.

Examples:

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

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of a milestone.

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

    A customizable set of options.

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’).

Returns:



90
91
92
# File 'lib/gitlab/client/milestones.rb', line 90

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

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

Gets a single milestone.

Examples:

Gitlab.milestone(5, 36)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of a milestone.

Returns:



29
30
31
# File 'lib/gitlab/client/milestones.rb', line 29

def milestone(project, id)
  get("/projects/#{url_encode 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)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • milestone (Integer, String)

    The ID of a milestone.

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



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

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

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

Gets the merge_requests of a given milestone.

Examples:

Gitlab.milestone_merge_requests(5, 2)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • milestone (Integer, String)

    The ID of a milestone.

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



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

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

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

Gets a list of project’s milestones.

Examples:

Gitlab.milestones(5)

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:



17
18
19
# File 'lib/gitlab/client/milestones.rb', line 17

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