Module: Octokit::Client::Labels
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/labels.rb
Instance Method Summary collapse
-
#add_label(repo, label, color = "ffffff", options = {}) ⇒ Label
Add a label to a repository.
-
#add_labels_to_an_issue(repo, number, labels) ⇒ Array
Add label(s) to an Issue.
-
#delete_label!(repo, label, options = {}) ⇒ Response
Delete a label from a repository.
-
#label(repo, name, options = {}) ⇒ Label
Get single label for a repository.
-
#labels(repo, options = {}) ⇒ Array
List available labels for a repository.
-
#labels_for_issue(repo, number, options = {}) ⇒ Array
List labels for a given issue.
-
#labels_for_milestone(repo, number, options = {}) ⇒ Array
Get labels for every issue in a milestone.
-
#remove_all_labels(repo, number, options = {}) ⇒ Array
Remove all label from an Issue.
-
#remove_label(repo, number, label, options = {}) ⇒ Array
Remove a label from an Issue.
-
#replace_all_labels(repo, number, labels, options = {}) ⇒ Array
Replace all labels on an Issue.
-
#update_label(repo, label, options = {}) ⇒ Label
Update a label.
Instance Method Details
#add_label(repo, label, color = "ffffff", options = {}) ⇒ Label
Add a label to a repository
39 40 41 |
# File 'lib/octokit/client/labels.rb', line 39 def add_label(repo, label, color="ffffff", ={}) post("repos/#{Repository.new(repo)}/labels", .merge({:name => label, :color => color}), 3) end |
#add_labels_to_an_issue(repo, number, labels) ⇒ Array
Add label(s) to an Issue
124 125 126 |
# File 'lib/octokit/client/labels.rb', line 124 def add_labels_to_an_issue(repo, number, labels) post("repos/#{Repository.new(repo)}/issues/#{number}/labels", labels, 3) end |
#delete_label!(repo, label, options = {}) ⇒ Response
Delete a label from a repository.
This deletes the label from the repository, and removes it from all issues.
69 70 71 |
# File 'lib/octokit/client/labels.rb', line 69 def delete_label!(repo, label, ={}) delete("repos/#{Repository.new(repo)}/labels/#{CGI.escape(label)}", , 3, true, true) end |
#label(repo, name, options = {}) ⇒ Label
Get single label for a repository
26 27 28 |
# File 'lib/octokit/client/labels.rb', line 26 def label(repo, name, ={}) get("repos/#{Repository.new(repo)}/labels/#{CGI.escape(name)}", , 3) end |
#labels(repo, options = {}) ⇒ Array
List available labels for a repository
14 15 16 |
# File 'lib/octokit/client/labels.rb', line 14 def labels(repo, ={}) get("repos/#{Repository.new(repo)}/labels", , 3) end |
#labels_for_issue(repo, number, options = {}) ⇒ Array
List labels for a given issue
111 112 113 |
# File 'lib/octokit/client/labels.rb', line 111 def labels_for_issue(repo, number, ={}) get("repos/#{Repository.new(repo)}/issues/#{number}/labels", , 3) end |
#labels_for_milestone(repo, number, options = {}) ⇒ Array
Get labels for every issue in a milestone
149 150 151 |
# File 'lib/octokit/client/labels.rb', line 149 def labels_for_milestone(repo, number, ={}) get("repos/#{Repository.new(repo)}/milestones/#{number}/labels", , 3) end |
#remove_all_labels(repo, number, options = {}) ⇒ Array
Remove all label from an Issue
This removes the label from the Issue
99 100 101 |
# File 'lib/octokit/client/labels.rb', line 99 def remove_all_labels(repo, number, ={}) delete("repos/#{Repository.new(repo)}/issues/#{number}/labels", , 3, true, true) end |
#remove_label(repo, number, label, options = {}) ⇒ Array
Remove a label from an Issue
This removes the label from the Issue
85 86 87 |
# File 'lib/octokit/client/labels.rb', line 85 def remove_label(repo, number, label, ={}) delete("repos/#{Repository.new(repo)}/issues/#{number}/labels/#{CGI.escape(label)}", , 3, true) end |
#replace_all_labels(repo, number, labels, options = {}) ⇒ Array
Replace all labels on an Issue
137 138 139 |
# File 'lib/octokit/client/labels.rb', line 137 def replace_all_labels(repo, number, labels, ={}) put("repos/#{Repository.new(repo)}/issues/#{number}/labels", labels, 3) end |
#update_label(repo, label, options = {}) ⇒ Label
Update a label
54 55 56 |
# File 'lib/octokit/client/labels.rb', line 54 def update_label(repo, label, ={}) post("repos/#{Repository.new(repo)}/labels/#{CGI.escape(label)}", , 3) end |