Class: GojiraAPI
- Inherits:
-
Object
show all
- Defined in:
- lib/gojira_api.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(url) ⇒ GojiraAPI
Returns a new instance of GojiraAPI.
4
5
6
7
|
# File 'lib/gojira_api.rb', line 4
def initialize(url)
@jira = Jira4R::JiraTool.new 2, url
@jira.logger=Logger.new("/dev/null")
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
87
88
89
|
# File 'lib/gojira_api.rb', line 87
def method_missing(sym, *args, &block)
@jira.send sym, *args, &block
end
|
Instance Attribute Details
#user ⇒ Object
Returns the value of attribute user.
3
4
5
|
# File 'lib/gojira_api.rb', line 3
def user
@user
end
|
Instance Method Details
73
74
75
76
77
78
|
# File 'lib/gojira_api.rb', line 73
def (key, body)
= Jira4R::V2::RemoteComment.new
.body = body
@jira. key, rescue return
end
|
#issue(key) ⇒ Object
22
23
24
|
# File 'lib/gojira_api.rb', line 22
def issue(key)
@jira.getIssue(key)
end
|
#issue_priority(key) ⇒ Object
59
60
61
62
|
# File 'lib/gojira_api.rb', line 59
def issue_priority(key)
issue = issue(key)
priority(issue.priority)
end
|
#issue_status(key) ⇒ Object
54
55
56
57
|
# File 'lib/gojira_api.rb', line 54
def issue_status(key)
issue = issue(key)
status(issue.status)
end
|
#login(user, pass) ⇒ Object
9
10
11
12
|
# File 'lib/gojira_api.rb', line 9
def login(user,pass)
@user = user
@jira.login user, pass
end
|
#priorities ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/gojira_api.rb', line 26
def priorities
@priorities ||= @jira.getPriorities.map do |p|
{
:id => p.id,
:name => p.name,
:desc => p.description
}
end
end
|
#priority(id) ⇒ Object
36
37
38
|
# File 'lib/gojira_api.rb', line 36
def priority(id)
priorities.find { |p| p[:id] == id }
end
|
#projects ⇒ Object
14
15
16
|
# File 'lib/gojira_api.rb', line 14
def projects
@jira.getProjectsNoSchemes
end
|
#set_action(issue_key, action_key) ⇒ Object
80
81
82
83
84
85
|
# File 'lib/gojira_api.rb', line 80
def set_action(issue_key, action_key)
action = valid_actions(issue_key).find {|action| action[:id] == action_key}
return if not action
@jira.progressWorkflowAction(issue_key, action_key, []) rescue return
action
end
|
#status(id) ⇒ Object
50
51
52
|
# File 'lib/gojira_api.rb', line 50
def status(id)
statuses.find{|s| s[:id] == id}
end
|
#statuses ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'lib/gojira_api.rb', line 40
def statuses
@statuses ||= @jira.getStatuses.map do |s|
{
:id => s.id,
:name => s.name,
:desc => s.description,
}
end
end
|
#user_issues(limit = 100) ⇒ Object
18
19
20
|
# File 'lib/gojira_api.rb', line 18
def user_issues(limit = 100)
@jira.getIssuesFromJqlSearch "assignee = currentUser()", limit
end
|
#valid_actions(key) ⇒ Object
64
65
66
67
68
69
70
71
|
# File 'lib/gojira_api.rb', line 64
def valid_actions(key)
@jira.getAvailableActions(key).map do |action|
{
:id => action.id,
:name => action.name
}
end
end
|