Module: Octokit::Client::Milestones

Included in:
Octokit::Client
Defined in:
lib/octokit/client/milestones.rb

Overview

Methods for the Issues Milestones API

See Also:

Instance Method Summary (collapse)

Instance Method Details

- (Sawyer::Resource) create_milestone(repository, title, options = {})

Create a milestone for a repository

Examples:

Create a milestone for a repository

Octokit.create_milestone("octokit/octokit.rb", "0.7.0", {:description => 'Add support for v3 of Github API'})

Options Hash (options):

  • :state (String) — default: open

    State: open or closed.

  • :description (String)

    A meaningful description

  • :due_on (Time)

    Set if the milestone has a due date

See Also:



54
55
56
# File 'lib/octokit/client/milestones.rb', line 54

def create_milestone(repository, title, options = {})
  post "repos/#{Repository.new(repository)}/milestones", options.merge({:title => title})
end

- (Boolean) delete_milestone(repository, number, options = {})

Delete a single milestone for a repository

Examples:

Delete a single milestone from a repository

Octokit.delete_milestone("octokit/octokit.rb", 1)

Options Hash (options):

  • :milestone (Integer)

    Milestone number.

See Also:



85
86
87
# File 'lib/octokit/client/milestones.rb', line 85

def delete_milestone(repository, number, options = {})
  boolean_from_response :delete, "repos/#{Repository.new(repository)}/milestones/#{number}", options
end

- (Array<Sawyer::Resource>) list_milestones(repository, options = {}) Also known as: milestones

List milestones for a repository

Examples:

List milestones for a repository

Octokit.list_milestones("octokit/octokit.rb")

Options Hash (options):

  • :milestone (Integer)

    Milestone number.

  • :state (String) — default: open

    State: open or closed.

  • :sort (String) — default: created

    Sort: created, updated, or comments.

  • :direction (String) — default: desc

    Direction: asc or desc.

See Also:



21
22
23
# File 'lib/octokit/client/milestones.rb', line 21

def list_milestones(repository, options = {})
  paginate "repos/#{Repository.new(repository)}/milestones", options
end

- (Sawyer::Resource) milestone(repository, number, options = {})

Get a single milestone for a repository

Examples:

Get a single milestone for a repository

Octokit.milestone("octokit/octokit.rb", 1)

Options Hash (options):

  • :milestone (Integer)

    Milestone number.

  • :state (String) — default: open

    State: open or closed.

  • :sort (String) — default: created

    Sort: created, updated, or comments.

  • :direction (String) — default: desc

    Direction: asc or desc.

See Also:



38
39
40
# File 'lib/octokit/client/milestones.rb', line 38

def milestone(repository, number, options = {})
  get "repos/#{Repository.new(repository)}/milestones/#{number}", options
end

- (Sawyer::Resource) update_milestone(repository, number, options = {}) Also known as: edit_milestone

Update a milestone for a repository

Examples:

Update a milestone for a repository

Octokit.update_milestone("octokit/octokit.rb", 1, {:description => 'Add support for v3 of Github API'})

Options Hash (options):

  • :title (String)

    A unique title.

  • :state (String) — default: open

    State: open or closed.

  • :description (String)

    A meaningful description

  • :due_on (Time)

    Set if the milestone has a due date

See Also:



71
72
73
# File 'lib/octokit/client/milestones.rb', line 71

def update_milestone(repository, number, options = {})
  patch "repos/#{Repository.new(repository)}/milestones/#{number}", options
end