Module: Octokit::Client::Labels
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/labels.rb
Overview
Methods for the Issue Labels API
Instance Method Summary collapse
-
#add_label(repo, label, color = "ffffff", options = {}) ⇒ Sawyer::Resource
Add a label to a repository.
-
#add_labels_to_an_issue(repo, number, labels) ⇒ Array<Sawyer::Resource>
Add label(s) to an Issue.
-
#delete_label!(repo, label, options = {}) ⇒ Boolean
Delete a label from a repository.
-
#label(repo, name, options = {}) ⇒ Sawyer::Resource
Get single label for a repository.
-
#labels(repo, options = {}) ⇒ Array<Sawyer::Resource>
List available labels for a repository.
-
#labels_for_issue(repo, number, options = {}) ⇒ Array<Sawyer::Resource>
List labels for a given issue.
-
#labels_for_milestone(repo, number, options = {}) ⇒ Array<Sawyer::Resource>
Get labels for every issue in a milestone.
-
#remove_all_labels(repo, number, options = {}) ⇒ Boolean
Remove all label from an Issue.
-
#remove_label(repo, number, label, options = {}) ⇒ Array<Sawyer::Resource>
Remove a label from an Issue.
-
#replace_all_labels(repo, number, labels, options = {}) ⇒ Array<Sawyer::Resource>
Replace all labels on an Issue.
-
#update_label(repo, label, options = {}) ⇒ Sawyer::Resource
Update a label.
Instance Method Details
#add_label(repo, label, color = "ffffff", options = {}) ⇒ Sawyer::Resource
Add a label to a repository
43 44 45 |
# File 'lib/octokit/client/labels.rb', line 43 def add_label(repo, label, color="ffffff", = {}) post "#{Repository.path repo}/labels", .merge({:name => label, :color => color}) end |
#add_labels_to_an_issue(repo, number, labels) ⇒ Array<Sawyer::Resource>
Add label(s) to an Issue
126 127 128 |
# File 'lib/octokit/client/labels.rb', line 126 def add_labels_to_an_issue(repo, number, labels) post "#{Repository.path repo}/issues/#{number}/labels", labels end |
#delete_label!(repo, label, options = {}) ⇒ Boolean
Delete a label from a repository.
This deletes the label from the repository, and removes it from all issues.
72 73 74 |
# File 'lib/octokit/client/labels.rb', line 72 def delete_label!(repo, label, = {}) boolean_from_response :delete, "#{Repository.path repo}/labels/#{label}", end |
#label(repo, name, options = {}) ⇒ Sawyer::Resource
Get single label for a repository
30 31 32 |
# File 'lib/octokit/client/labels.rb', line 30 def label(repo, name, = {}) get "#{Repository.path repo}/labels/#{name}", end |
#labels(repo, options = {}) ⇒ Array<Sawyer::Resource>
List available labels for a repository
18 19 20 |
# File 'lib/octokit/client/labels.rb', line 18 def labels(repo, = {}) paginate "#{Repository.path repo}/labels", end |
#labels_for_issue(repo, number, options = {}) ⇒ Array<Sawyer::Resource>
List labels for a given issue
113 114 115 |
# File 'lib/octokit/client/labels.rb', line 113 def labels_for_issue(repo, number, = {}) paginate "#{Repository.path repo}/issues/#{number}/labels", end |
#labels_for_milestone(repo, number, options = {}) ⇒ Array<Sawyer::Resource>
Get labels for every issue in a milestone
151 152 153 |
# File 'lib/octokit/client/labels.rb', line 151 def labels_for_milestone(repo, number, = {}) paginate "#{Repository.path repo}/milestones/#{number}/labels", end |
#remove_all_labels(repo, number, options = {}) ⇒ Boolean
Remove all label from an Issue
This removes the label from the Issue
101 102 103 |
# File 'lib/octokit/client/labels.rb', line 101 def remove_all_labels(repo, number, = {}) boolean_from_response :delete, "#{Repository.path repo}/issues/#{number}/labels", end |
#remove_label(repo, number, label, options = {}) ⇒ Array<Sawyer::Resource>
Remove a label from an Issue
This removes the label from the Issue
87 88 89 |
# File 'lib/octokit/client/labels.rb', line 87 def remove_label(repo, number, label, = {}) delete "#{Repository.path repo}/issues/#{number}/labels/#{label}", end |
#replace_all_labels(repo, number, labels, options = {}) ⇒ Array<Sawyer::Resource>
Replace all labels on an Issue
139 140 141 |
# File 'lib/octokit/client/labels.rb', line 139 def replace_all_labels(repo, number, labels, = {}) put "#{Repository.path repo}/issues/#{number}/labels", labels end |
#update_label(repo, label, options = {}) ⇒ Sawyer::Resource
Update a label
58 59 60 |
# File 'lib/octokit/client/labels.rb', line 58 def update_label(repo, label, = {}) patch "#{Repository.path repo}/labels/#{label}", end |