Class: Jirify::Models::Issue
- Inherits:
-
Base
- Object
- Base
- Jirify::Models::Issue
show all
- Defined in:
- lib/jirify/models/issue.rb
Defined Under Namespace
Classes: InvalidTransitionError
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
client, #initialize, #method_missing, #respond_to_missing?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Jirify::Models::Base
Class Method Details
.find_by_id(issue_id) ⇒ Object
80
81
82
83
84
|
# File 'lib/jirify/models/issue.rb', line 80
def find_by_id(issue_id)
Issue.new client.Issue.find(issue_id)
rescue StandardError
nil
end
|
.find_mine(all) ⇒ Object
76
77
78
|
# File 'lib/jirify/models/issue.rb', line 76
def find_mine(all)
client.Issue.jql(my_issues_jql(all)).map { |issue| Issue.new issue }
end
|
.list_mine(statuses = [], all = false) ⇒ Object
68
69
70
71
72
73
74
|
# File 'lib/jirify/models/issue.rb', line 68
def list_mine(statuses = [], all = false)
my_issues = find_mine(all).sort_by { |issue| issue.status.name }
my_issues.select do |issue|
statuses.empty? || statuses.any? { |status| issue.status? status }
end
end
|
Instance Method Details
#assign_to_me! ⇒ Object
10
11
12
|
# File 'lib/jirify/models/issue.rb', line 10
def assign_to_me!
@entity.assign_to!(Config.username.split('@')[0])
end
|
#mine? ⇒ Boolean
6
7
8
|
# File 'lib/jirify/models/issue.rb', line 6
def mine?
!assignee.nil? && assignee.emailAddress == Config.username
end
|
#status ⇒ Object
18
19
20
|
# File 'lib/jirify/models/issue.rb', line 18
def status
@status ||= Status.new @entity.status
end
|
#status?(status_name) ⇒ Boolean
22
23
24
25
|
# File 'lib/jirify/models/issue.rb', line 22
def status?(status_name)
status_name = status_name.to_s if status_name.is_a? Symbol
status.name == status_name
end
|
#to_s(verbose) ⇒ Object
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/jirify/models/issue.rb', line 56
def to_s(verbose)
url = ColorizedString["#{Config.issue_browse_url}#{key}"].blue.underline
bold_key = ColorizedString["#{key.ljust(7)}:"].bold
if verbose
"#{status.pretty_name} #{bold_key} #{summary} (#{url})"
else
"#{bold_key} #{url}"
end
end
|
#transitions(reload = false) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/jirify/models/issue.rb', line 33
def transitions(reload = false)
if reload
@transitions = TransitionList.all @entity
else
@transitions ||= TransitionList.all @entity
end
end
|
#unassign! ⇒ Object
14
15
16
|
# File 'lib/jirify/models/issue.rb', line 14
def unassign!
@entity.assign_to!(nil)
end
|