Class: AbideDevUtils::Jira::Finder
- Inherits:
-
Object
- Object
- AbideDevUtils::Jira::Finder
- Defined in:
- lib/abide_dev_utils/jira/finder.rb
Instance Method Summary collapse
-
#initialize(client) ⇒ Finder
constructor
A new instance of Finder.
- #issue(id) ⇒ Object
- #issues_by_jql(jql) ⇒ Array<JIRA::Resource::Issue>
- #issuetype(id) ⇒ Object
- #myself ⇒ Object
- #priority(id) ⇒ Object
- #project(id) ⇒ Object
Constructor Details
#initialize(client) ⇒ Finder
Returns a new instance of Finder.
8 9 10 |
# File 'lib/abide_dev_utils/jira/finder.rb', line 8 def initialize(client) @client = client end |
Instance Method Details
#issue(id) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/abide_dev_utils/jira/finder.rb', line 24 def issue(id) return id if id.is_a?(client.Issue.target_class) client.Issue.find(id) rescue URI::InvalidURIError iss = client.Issue.all.find { |i| i.summary == id } raise AbideDevUtils::Errors::Jira::FindIssueError, id if iss.nil? iss end |
#issues_by_jql(jql) ⇒ Array<JIRA::Resource::Issue>
37 38 39 |
# File 'lib/abide_dev_utils/jira/finder.rb', line 37 def issues_by_jql(jql) client.Issue.jql(jql, max_results: 1000) end |
#issuetype(id) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/abide_dev_utils/jira/finder.rb', line 42 def issuetype(id) return id if id.is_a?(client.Issuetype.target_class) if id.match?(%r{^\d+$}) client.Issuetype.find(id) else client.Issuetype.all.find { |i| i.name == id } end end |
#myself ⇒ Object
12 13 14 |
# File 'lib/abide_dev_utils/jira/finder.rb', line 12 def myself client.User.myself end |
#priority(id) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/abide_dev_utils/jira/finder.rb', line 53 def priority(id) return id if id.is_a?(client.Priority.target_class) if id.match?(%r{^\d+$}) client.Priority.find(id) else client.Priority.all.find { |i| i.name == id } end end |
#project(id) ⇒ Object
17 18 19 20 21 |
# File 'lib/abide_dev_utils/jira/finder.rb', line 17 def project(id) return id if id.is_a?(client.Project.target_class) client.Project.find(id) end |