Class: Cp8Cli::Github::Issue
Class Method Summary collapse
Instance Method Summary collapse
- #accept ⇒ Object
- #add_label(label) ⇒ Object
- #assign(user) ⇒ Object
- #attach(url:) ⇒ Object
- #finish ⇒ Object
-
#initialize(number:, repo:, attributes:) ⇒ Issue
constructor
A new instance of Issue.
- #pr_title ⇒ Object
- #short_link ⇒ Object
- #short_url ⇒ Object
- #start ⇒ Object
- #summary ⇒ Object
- #title ⇒ Object
- #url ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(number:, repo:, attributes:) ⇒ Issue
Returns a new instance of Issue.
8 9 10 11 12 |
# File 'lib/cp8_cli/github/issue.rb', line 8 def initialize(number:, repo:, attributes:) @number = number @repo = repo @attributes = attributes end |
Class Method Details
.fields ⇒ Object
14 15 16 |
# File 'lib/cp8_cli/github/issue.rb', line 14 def self.fields [:title] end |
.find_by_short_link(short_link) ⇒ Object
24 25 26 27 28 |
# File 'lib/cp8_cli/github/issue.rb', line 24 def self.find_by_short_link(short_link) short_link = ParsedShortLink.new(short_link) issue = client.issue(short_link.repo, short_link.number) new number: short_link.number, repo: short_link.repo, attributes: issue end |
Instance Method Details
#accept ⇒ Object
54 55 56 |
# File 'lib/cp8_cli/github/issue.rb', line 54 def accept # noop for now end |
#add_label(label) ⇒ Object
63 64 65 |
# File 'lib/cp8_cli/github/issue.rb', line 63 def add_label(label) self.class.request(:post, "cards/#{id}/idLabels", value: label.id) end |
#assign(user) ⇒ Object
58 59 60 61 |
# File 'lib/cp8_cli/github/issue.rb', line 58 def assign(user) # add_assignes not released as gem yet https://github.com/octokit/octokit.rb/pull/894 client.post "#{Octokit::Repository.path repo}/issues/#{number}/assignees", assignees: [user.github_login] end |
#attach(url:) ⇒ Object
67 68 69 |
# File 'lib/cp8_cli/github/issue.rb', line 67 def attach(url:) self.class.request(:post, "cards/#{id}/attachments", url: url) end |
#finish ⇒ Object
50 51 52 |
# File 'lib/cp8_cli/github/issue.rb', line 50 def finish # noop for now end |
#pr_title ⇒ Object
34 35 36 |
# File 'lib/cp8_cli/github/issue.rb', line 34 def pr_title title end |
#short_link ⇒ Object
71 72 73 |
# File 'lib/cp8_cli/github/issue.rb', line 71 def short_link "#{repo}##{number}" end |
#short_url ⇒ Object
75 76 77 |
# File 'lib/cp8_cli/github/issue.rb', line 75 def short_url attributes[:shortUrl] end |
#start ⇒ Object
46 47 48 |
# File 'lib/cp8_cli/github/issue.rb', line 46 def start # noop for now end |
#summary ⇒ Object
42 43 44 |
# File 'lib/cp8_cli/github/issue.rb', line 42 def summary "Closes #{short_link}" end |
#title ⇒ Object
30 31 32 |
# File 'lib/cp8_cli/github/issue.rb', line 30 def title attributes[:title] end |
#url ⇒ Object
38 39 40 |
# File 'lib/cp8_cli/github/issue.rb', line 38 def url attributes[:html_url] end |