Module: Octokit::Client::Milestones

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

Instance Method Summary collapse

Instance Method Details

#create_milestone(repository, title, options = {}) ⇒ Milestone

Create a milestone for a repository

Examples:

Create a milestone for a repository

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

Parameters:

  • repository (String, Repository, Hash)

    A GitHub repository.

  • title (String)

    A unique title.

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

    A customizable set of options.

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

Returns:

  • (Milestone)

    A single milestone object

See Also:



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

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

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

Delete a single milestone for a repository

Examples:

Delete a single milestone from a repository

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

Parameters:

  • repository (String, Repository, Hash)

    A GitHub repository.

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

    A customizable set of options.

Options Hash (options):

  • :milestone (Integer)

    Milestone number.

Returns:

  • (Response)

    Response with status 204, no content

See Also:



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

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

#list_milestones(repository, options = {}) ⇒ Array Also known as: milestones

List milestones for a repository

Examples:

List milestones for a repository

Octokit.list_milestones("pengwynn/octokit")

Parameters:

  • repository (String, Repository, Hash)

    A GitHub repository.

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

    A customizable set of options.

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.

Returns:

  • (Array)

    A list of milestones for a repository.

See Also:



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

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

#milestone(repository, number, options = {}) ⇒ Milestone

Get a single milestone for a repository

Examples:

Get a single milestone for a repository

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

Parameters:

  • repository (String, Repository, Hash)

    A GitHub repository.

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

    A customizable set of options.

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.

Returns:

  • (Milestone)

    A single milestone from a repository.

See Also:



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

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

#update_milestone(repository, number, options = {}) ⇒ Milestone Also known as: edit_milestone

Update a milestone for a repository

Examples:

Update a milestone for a repository

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

Parameters:

  • repository (String, Repository, Hash)

    A GitHub repository.

  • number (String, Integer)

    Number ID of a milestone

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

    A customizable set of options.

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

Returns:

  • (Milestone)

    A single milestone object

See Also:



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

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