Class: Jira::Auto::Tool::Board
- Inherits:
-
Object
- Object
- Jira::Auto::Tool::Board
show all
- Includes:
- Comparable
- Defined in:
- lib/jira/auto/tool/board.rb,
lib/jira/auto/tool/board/cache.rb,
lib/jira/auto/tool/board/unavailable_board.rb
Defined Under Namespace
Classes: Cache, UnavailableBoard
Constant Summary
collapse
- PROJECT_INFORMATION_NOT_AVAILABLE =
"N/A"
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(tool, jira_board) ⇒ Board
Returns a new instance of Board.
32
33
34
35
|
# File 'lib/jira/auto/tool/board.rb', line 32
def initialize(tool, jira_board)
@tool = tool
@jira_board = jira_board
end
|
Instance Attribute Details
#jira_board ⇒ Object
Returns the value of attribute jira_board.
11
12
13
|
# File 'lib/jira/auto/tool/board.rb', line 11
def jira_board
@jira_board
end
|
Returns the value of attribute tool.
11
12
13
|
# File 'lib/jira/auto/tool/board.rb', line 11
def tool
@tool
end
|
Class Method Details
.cached_boards ⇒ Object
28
29
30
|
# File 'lib/jira/auto/tool/board.rb', line 28
def self.cached_boards
@cached_boards ||= {}
end
|
.find_by_id(tool, id) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/jira/auto/tool/board.rb', line 13
def self.find_by_id(tool, id)
cached_boards[id] ||=
begin
new(tool, JIRA::Resource::Board.find(tool.jira_client, id))
rescue JIRA::HTTPError => e
if e.code.to_i == 404
UnavailableBoard.new(tool, id)
else
raise e.class,
"#{e.class}: code = #{e.code.inspect}: #{self.class}.find_by_id(tool, #{id.inspect}): " \
"#{e.message}"
end
end
end
|
.to_table_row_field_names ⇒ Object
53
54
55
|
# File 'lib/jira/auto/tool/board.rb', line 53
def self.to_table_row_field_names
i[name ui_url project_key]
end
|
62
63
64
|
# File 'lib/jira/auto/tool/board.rb', line 62
def self.
to_table_row_field_names.collect { |field| field.to_s.titleize }
end
|
Instance Method Details
#<=>(other) ⇒ Object
45
46
47
|
# File 'lib/jira/auto/tool/board.rb', line 45
def <=>(other)
id <=> other.id
end
|
37
38
39
|
# File 'lib/jira/auto/tool/board.rb', line 37
def id
jira_board.id
end
|
49
50
51
|
# File 'lib/jira/auto/tool/board.rb', line 49
def name
jira_board.name
end
|
#project_key ⇒ Object
72
73
74
75
76
77
78
|
# File 'lib/jira/auto/tool/board.rb', line 72
def project_key
if with_project_information?
jira_board.location.fetch("projectKey")
else
PROJECT_INFORMATION_NOT_AVAILABLE
end
end
|
#sprint_compatible? ⇒ Boolean
84
85
86
|
# File 'lib/jira/auto/tool/board.rb', line 84
def sprint_compatible?
jira_board.type =~ /^(scrum)$/
end
|
#to_table_row ⇒ Object
66
67
68
|
# File 'lib/jira/auto/tool/board.rb', line 66
def to_table_row
self.class.to_table_row_field_names.collect { |field| send(field) }
end
|
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/jira/auto/tool/board.rb', line 92
def ui_url
request_path =
if with_project_information?
"/jira/software/c/projects/#{project_key}/boards/#{id}"
else
"/secure/RapidBoard.jspa?rapidView=#{id}"
end
tool.jira_url(request_path)
end
|
#unavailable? ⇒ Boolean
41
42
43
|
# File 'lib/jira/auto/tool/board.rb', line 41
def unavailable?
instance_of?(UnavailableBoard)
end
|
88
89
90
|
# File 'lib/jira/auto/tool/board.rb', line 88
def url
jira_board.url
end
|
80
81
82
|
# File 'lib/jira/auto/tool/board.rb', line 80
def with_project_information?
jira_board.respond_to?(:location)
end
|