class Fastlane::Helper::JiraIssuesReleaseNotesHelper::JiraHelper

Public Class Methods

new(host:, api_version:, username:, password:, context_path:, disable_ssl_verification:, jira_client_helper: nil) click to toggle source
# File lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb, line 235
def initialize(host:, api_version:, username:, password:, context_path:, disable_ssl_verification:, jira_client_helper: nil)
  @host = host
  @context_path = context_path

  @client ||= JiraClientHelper.client(
    host: host,
    api_version: api_version,
    username: username,
    password: password,
    context_path: context_path,
    disable_ssl_verification: disable_ssl_verification
  )
end

Public Instance Methods

add_comment(comment:, issues:) click to toggle source
# File lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb, line 274
def add_comment(comment:, issues:)
  return if issues.to_a.empty?

  issues.each do |issue|
    issue.comments.build.save({ 'body' => comment })
  rescue StandardError => e
    UI.important("Jira Client: Failed to comment on issues - #{issue.key}")
    UI.important("Jira Client: Reason - #{e.message}")
  end
end
get(keys:, extra_fields: []) click to toggle source
# File lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb, line 249
def get(keys:, extra_fields: [])
  return [] if keys.to_a.empty?

  fields = [:key, :summary, :status, :issuetype, :description]
  fields.concat extra_fields

  begin
    @client.Issue.jql("KEY IN (#{keys.join(',')})", fields: fields, validate_query: false)
  rescue StandardError => e
    UI.important('Jira Client: Failed to get issue.')
    UI.important("Jira Client: Reason - #{e.message}")
    []
  end
end
list_versions(project_id_or_key:, query: nil, order_by: nil, status: nil) click to toggle source
# File lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb, line 264
def list_versions(project_id_or_key:, query: nil, order_by: nil, status: nil)
  @client.Version.find(
    project_id_or_key: project_id_or_key,
    query: query, 
    orderBy: order_by, 
    status: status
  )
end
url(issue:) click to toggle source
# File lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb, line 285
def url(issue:)
  [@host, @context_path, 'browse', issue.key].reject(&:empty?).join('/')
end