Module: Octokit::Client::Milestones

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

Overview

Methods for the Issues Milestones API

Instance Method Summary collapse

Instance Method Details

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

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:



51
52
53
# File 'lib/octokit/client/milestones.rb', line 51

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

#delete_milestone(repository, number, options = {}) ⇒ Boolean

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:



82
83
84
# File 'lib/octokit/client/milestones.rb', line 82

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

#list_milestones(repository, options = {}) ⇒ Array<Sawyer::Resource> 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, closed, or all.

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

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

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.

See Also:



35
36
37
# File 'lib/octokit/client/milestones.rb', line 35

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

#update_milestone(repository, number, options = {}) ⇒ Sawyer::Resource 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:



68
69
70
# File 'lib/octokit/client/milestones.rb', line 68

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