Module: GitHub::Client::Issues

Included in:
GitHub::Client
Defined in:
lib/github_api_v3/client/issues.rb

Overview

Methods for the Issues API.

@ see developer.github.com/v3/issues/

Instance Method Summary collapse

Instance Method Details

#create_issue(owner, repo, title, options = {}) ⇒ Hash

Create an issue.

Requires authentication.

Examples:

client.create_issue('caseyscarborough', 'github', 'Found a bug', :assignee => 'caseyscarborough', :labels => ['label1', 'label2', 'label3'])

Parameters:

  • owner (String)

    The repository owner’s username.

  • repo (String)

    The repository name.

  • title (String)

    The issue title.

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

    Parameters.

Options Hash (options):

  • :body (String)
  • :assignee (String)

    Login for user to assign the issue to (must have push access).

  • :milestone (Integer)

    The milestone to associate the issue with (must have push access).

  • :labels (Array)

    Array of strings of labels to associate with this issue.

Returns:

See Also:



123
124
125
126
# File 'lib/github_api_v3/client/issues.rb', line 123

def create_issue(owner, repo, title, options={})
  options.merge!(title: title)
  post "/repos/#{owner}/#{repo}/issues", body: options
end

#edit_issue(owner, repo, number, options = {}) ⇒ Object

Edit an issue.

Requires authentication.

Examples:

client.edit_issue('caseyscarborough', 'github', 3, body: 'This is the body.', state: 'closed')

Parameters:

  • owner (String)

    The repository owner’s username.

  • repo (String)

    The repository name.

  • number (Integer)

    The issue number.

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

    Parameters.

Options Hash (options):

  • :title (String)
  • :body (String)
  • :assignee (String)

    Login for user to assign the issue to (must have push access).

  • :state (String)

    open or closed

  • :milestone (Integer)

    The milestone to associate the issue with (must have push access).

  • :labels (Array)

    Array of strings of labels to associate with this issue.

See Also:



145
146
147
# File 'lib/github_api_v3/client/issues.rb', line 145

def edit_issue(owner, repo, number, options={})
  patch "/repos/#{owner}/#{repo}/issues/#{number}", body: options
end

#issue(owner, repo, number) ⇒ Hash

Get a single issue.

Examples:

client.issue('caseyscarborough', 'github', 123)

Parameters:

  • owner (String)

    The repository owner’s username.

  • repo (String)

    The repository name.

  • number (Integer)

    The issue number.

Returns:

See Also:



103
104
105
# File 'lib/github_api_v3/client/issues.rb', line 103

def issue(owner, repo, number)
  get "/repos/#{owner}/#{repo}/issues/#{number}"
end

#issues(options = {}) ⇒ Array

List all issues for an authenticated user, including owned, member, and org repos.

Requires authentication.

Examples:

client.issues(:filter => 'created', :state => 'closed', :sort => 'updated')

Parameters:

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

    Optional parameters.

Options Hash (options):

  • :filter (String)

    assigned (default), created, mentioned, subscribed, all

  • :state (String)

    open (default), closed

  • :labels (String)

    String list of comma separated label names, ex. “bug,ui,@high”

  • :sort (String)

    created (default), updated, comments

  • :directions (String)

    asc (default), desc

  • :since (String)

    Optional string of a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ)

Returns:

  • (Array)

    List of all issues.

See Also:



24
25
26
# File 'lib/github_api_v3/client/issues.rb', line 24

def issues(options={})
  get '/issues', params: options
end

#org_issues(org, options = {}) ⇒ Array

List all issues for a given organization for the authenticated user.

Requires authentication.

Examples:

client.org_issues('facebook', :filter => 'mentioned', :state => 'closed')

Parameters:

  • org (String)

    The organization name.

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

    Optional parameters.

Options Hash (options):

  • :filter (String)

    assigned (default), created, mentioned, subscribed, all

  • :state (String)

    open (default), closed

  • :labels (String)

    String list of comma separated label names, ex. “bug,ui,@high”

  • :sort (String)

    created (default), updated, comments

  • :directions (String)

    asc (default), desc

  • :since (String)

    Optional string of a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ)

Returns:

  • (Array)

    List of all issues.

See Also:



63
64
65
# File 'lib/github_api_v3/client/issues.rb', line 63

def org_issues(org, options={})
  get "/orgs/#{org}/issues", params: options
end

#repo_issues(owner, repo, options = {}) ⇒ Array

List issues for a repository.

Examples:

Closed repo issues since 2013-08-10 created by @caseyscarborough for the caseyscarborough/github repository.

client.repo_issues(
  'caseyscarborough',
  'github', 
  :state => 'closed'
  :since => '2013-08-09T19:00:00-05:00'
)

Parameters:

  • owner (String)

    The repository owner’s username.

  • repo (String)

    The repository name.

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

    Optional parameters.

Options Hash (options):

  • :milestone (Integer, String)

    Milestone number (Integer), ‘none’, or ‘*’ for issues with any milestone.

  • :state (String)

    open (default), closed

  • :assignee (String)

    User login, ‘none’, or ‘*’ for issues with any milestone.

  • :creator (String)

    User login

  • :mentioned (String)

    User login

  • :labels (String)

    String list of comma separated label names, ex. “bug,ui,@high”

  • :sort (String)

    created (default), updated, comments

  • :directions (String)

    asc (default), desc

  • :since (String)

    Optional string of a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ)

Returns:

  • (Array)

    List of issues.

See Also:



90
91
92
# File 'lib/github_api_v3/client/issues.rb', line 90

def repo_issues(owner, repo, options={})
  get "/repos/#{owner}/#{repo}/issues"
end

#user_issues(options = {}) ⇒ Array

List all issues across owned and member repositories for the authenticated user.

Requires authentication.

Examples:

client.user_issues(:filter => 'created')

Parameters:

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

    Optional parameters.

Options Hash (options):

  • :filter (String)

    assigned (default), created, mentioned, subscribed, all

  • :state (String)

    open (default), closed

  • :labels (String)

    String list of comma separated label names, ex. “bug,ui,@high”

  • :sort (String)

    created (default), updated, comments

  • :directions (String)

    asc (default), desc

  • :since (String)

    Optional string of a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ)

Returns:

  • (Array)

    List of all issues.

See Also:



43
44
45
# File 'lib/github_api_v3/client/issues.rb', line 43

def user_issues(options={})
  get '/user/issues', params: options
end