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

Parameters:

  • repository (Integer, 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:

  • (Sawyer::Resource)

    A single milestone object

See Also:



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

def create_milestone(repository, title, options = {})
  post "#{Repository.path 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)

Parameters:

  • repository (Integer, String, Repository, Hash)

    A GitHub repository

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

    A customizable set of options.

Options Hash (options):

  • :milestone (Integer)

    Milestone number.

Returns:

  • (Boolean)

    Success

See Also:



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

def delete_milestone(repository, number, options = {})
  boolean_from_response :delete, "#{Repository.path 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")

Parameters:

  • repository (Integer, 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, closed, or all.

  • :sort (String) — default: created

    Sort: created, updated, or comments.

  • :direction (String) — default: desc

    Direction: asc or desc.

Returns:

  • (Array<Sawyer::Resource>)

    A list of milestones for a repository.

See Also:



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

def list_milestones(repository, options = {})
  paginate "#{Repository.path 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)

Parameters:

  • repository (Integer, String, Repository, Hash)

    A GitHub repository

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

    A customizable set of options.

Options Hash (options):

  • :milestone (Integer)

    Milestone number.

Returns:

  • (Sawyer::Resource)

    A single milestone from a repository.

See Also:



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

def milestone(repository, number, options = {})
  get "#{Repository.path 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'})

Parameters:

  • repository (Integer, String, Repository, Hash)

    A GitHub repository

  • number (String, Integer)

    ID of the 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:

  • (Sawyer::Resource)

    A single milestone object

See Also:



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

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