Class: Cp8Cli::Github::Issue

Inherits:
Base
  • Object
show all
Includes:
Storyable
Defined in:
lib/cp8_cli/github/issue.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Storyable

#branch

Methods inherited from Base

configure

Constructor Details

#initialize(number:, repo:, attributes:) ⇒ Issue

Returns a new instance of Issue.



11
12
13
14
15
# File 'lib/cp8_cli/github/issue.rb', line 11

def initialize(number:, repo:, attributes:)
  @number = number
  @repo = repo
  @attributes = attributes
end

Class Method Details

.fieldsObject



17
18
19
# File 'lib/cp8_cli/github/issue.rb', line 17

def self.fields
  [:title]
end


27
28
29
30
31
# File 'lib/cp8_cli/github/issue.rb', line 27

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

.find_by_url(url) ⇒ Object



21
22
23
24
25
# File 'lib/cp8_cli/github/issue.rb', line 21

def self.find_by_url(url)
  url = ParsedUrl.new(url)
  issue = client.issue(url.repo, url.number)
  new number: url.number, repo: url.repo, attributes: issue
end

Instance Method Details

#pr_titleObject



37
38
39
# File 'lib/cp8_cli/github/issue.rb', line 37

def pr_title
  title
end


53
54
55
# File 'lib/cp8_cli/github/issue.rb', line 53

def short_link
  "#{repo}##{number}"
end

#startObject



49
50
51
# File 'lib/cp8_cli/github/issue.rb', line 49

def start
  assign CurrentUser.new
end

#summaryObject



45
46
47
# File 'lib/cp8_cli/github/issue.rb', line 45

def summary
  "Closes #{short_link}"
end

#titleObject



33
34
35
# File 'lib/cp8_cli/github/issue.rb', line 33

def title
  attributes[:title]
end

#urlObject



41
42
43
# File 'lib/cp8_cli/github/issue.rb', line 41

def url
  attributes[:html_url]
end