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
37 38 39 |
# File 'lib/octokit/client/labels.rb', line 37 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
122 123 124 |
# File 'lib/octokit/client/labels.rb', line 122 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.
67 68 69 |
# File 'lib/octokit/client/labels.rb', line 67 def delete_label!(repo, label, ={}) delete("repos/#{Repository.new(repo)}/labels/#{URI.encode_www_form_component(label)}", , 3, true, true) end |
#label(repo, name, options = {}) ⇒ Label
Get single label for a repository
24 25 26 |
# File 'lib/octokit/client/labels.rb', line 24 def label(repo, name, ={}) get("repos/#{Repository.new(repo)}/labels/#{URI.encode_www_form_component(name)}", , 3) end |
#labels(repo, options = {}) ⇒ Array
List available labels for a repository
12 13 14 |
# File 'lib/octokit/client/labels.rb', line 12 def labels(repo, ={}) get("repos/#{Repository.new(repo)}/labels", , 3) end |
#labels_for_issue(repo, number, options = {}) ⇒ Array
List labels for a given issue
109 110 111 |
# File 'lib/octokit/client/labels.rb', line 109 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
147 148 149 |
# File 'lib/octokit/client/labels.rb', line 147 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
97 98 99 |
# File 'lib/octokit/client/labels.rb', line 97 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
83 84 85 |
# File 'lib/octokit/client/labels.rb', line 83 def remove_label(repo, number, label, ={}) delete("repos/#{Repository.new(repo)}/issues/#{number}/labels/#{URI.encode_www_form_component(label)}", , 3, true) end |
#replace_all_labels(repo, number, labels, options = {}) ⇒ Array
Replace all labels on an Issue
135 136 137 |
# File 'lib/octokit/client/labels.rb', line 135 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
52 53 54 |
# File 'lib/octokit/client/labels.rb', line 52 def update_label(repo, label, ={}) post("repos/#{Repository.new(repo)}/labels/#{URI.encode_www_form_component(label)}", , 3) end |