Class: Fastlane::Helper::JiraIssuesReleaseNotesHelper::JiraHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::JiraIssuesReleaseNotesHelper::JiraHelper
- Defined in:
- lib/fastlane/plugin/jira_issues_release_notes/helper/jira_issues_release_notes_helper.rb
Instance Method Summary collapse
- #add_comment(comment:, issues:) ⇒ Object
- #get(keys:, extra_fields: []) ⇒ Object
-
#initialize(host:, api_version:, username:, password:, context_path:, disable_ssl_verification:, jira_client_helper: nil) ⇒ JiraHelper
constructor
A new instance of JiraHelper.
- #list_versions(project_id_or_key:, query: nil, order_by: nil, status: nil) ⇒ Object
- #url(issue:) ⇒ Object
Constructor Details
#initialize(host:, api_version:, username:, password:, context_path:, disable_ssl_verification:, jira_client_helper: nil) ⇒ JiraHelper
Returns a new instance of JiraHelper.
235 236 237 238 239 240 241 242 243 244 245 246 247 |
# 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 |
Instance Method Details
#add_comment(comment:, issues:) ⇒ Object
274 275 276 277 278 279 280 281 282 283 |
# 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.}") end end |
#get(keys:, extra_fields: []) ⇒ Object
249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# 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.}") [] end end |
#list_versions(project_id_or_key:, query: nil, order_by: nil, status: nil) ⇒ Object
264 265 266 267 268 269 270 271 |
# 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:) ⇒ Object
285 286 287 |
# 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 |