Class: Cp8Cli::Github::Issue

Inherits:
Story
  • Object
show all
Includes:
Api::Client
Defined in:
lib/cp8_cli/github/issue.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Api::Client

#client

Methods inherited from Story

#start

Constructor Details

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

Returns a new instance of Issue.



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

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

Class Method Details

.find_by_url(url) ⇒ Object



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

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

Instance Method Details

#summaryObject



26
27
28
# File 'lib/cp8_cli/github/issue.rb', line 26

def summary
  "Closes #{short_link}"
end

#titleObject



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

def title
  attributes[:title]
end