Class: AbideDevUtils::Jira::Helper

Inherits:
Object
  • Object
show all
Extended by:
DryRun
Defined in:
lib/abide_dev_utils/jira/helper.rb

Instance Method Summary collapse

Methods included from DryRun

dry_run, dry_run_return_false, dry_run_return_true, dry_run_simple

Constructor Details

#initialize(client, dry_run: false) ⇒ Helper

Returns a new instance of Helper.



13
14
15
16
# File 'lib/abide_dev_utils/jira/helper.rb', line 13

def initialize(client, dry_run: false)
  @client = client
  @dry_run = dry_run
end

Instance Method Details

#add_issue_label(issue, label) ⇒ Object

Parameters:

  • issue (JIRA::Resource::Issue, String)
  • label (String)


26
27
28
29
30
31
32
# File 'lib/abide_dev_utils/jira/helper.rb', line 26

def add_issue_label(issue, label)
  issue = @client.find(:issue, issue)
  return if issue.labels.include?(label)

  issue.labels << label
  issue.save
end

#all_project_issues_attrs(project) ⇒ Object

Parameters:

  • project (JIRA::Resource::Project, String)


19
20
21
22
# File 'lib/abide_dev_utils/jira/helper.rb', line 19

def all_project_issues_attrs(project)
  project = @client.find(:project, project)
  project.issues.collect(&:attrs)
end

#summary_exist?(summary, issue_attrs) ⇒ Boolean

Parameters:

  • summary (String)
  • issue_attrs (Array<Hash>)

Returns:

  • (Boolean)


36
37
38
# File 'lib/abide_dev_utils/jira/helper.rb', line 36

def summary_exist?(summary, issue_attrs)
  issue_attrs.any? { |attrs| attrs['fields'].key?('summary') && attrs['fields']['summary'] == summary }
end