class Speedflow::Plugin::Jira::Prompt

Plugin prompt

Attributes

prompt[W]

@return [<::Speedflow::Plugin::Prompt>] Plugin prompt.

Public Instance Methods

errors(exception) click to toggle source

Public: Errors from JIRA exception.

exception - JIRA::HTTPError.

Returns nothing.

# File lib/speedflow/plugin/jira/prompt.rb, line 82
def errors(exception)
  if exception.response.respond_to?('body')
    response = ::JSON.parse(exception.response.body)
    response['errors'].each { |k, v| prompt.warn "- #{k}: #{v}" }
    response['errorMessages'].each { |v| prompt.warn "- #{v}" }
  end
end
issue() { |title| ... } click to toggle source

Public: Prompt issue.

issues - Hash of issues from block.

Returns String key of issue.

# File lib/speedflow/plugin/jira/prompt.rb, line 64
def issue(&issues)
  sel_issue = prompt.select('Choose the issue:') do |menu|
    menu.choice 'Retry search!', :retry
    yield(title).each do |v|
      menu.choice "#{v.summary} (#{v.key})", v.key
    end
  end

  sel_issue = issue(&issues) if sel_issue == :retry

  sel_issue
end
issue_type(issue_types) click to toggle source

Public: Prompt issue type.

issue_types - List of issue types.

Returns ID of issue type.

# File lib/speedflow/plugin/jira/prompt.rb, line 37
def issue_type(issue_types)
  prompt.select('Choose the issue type:') do |menu|
    issue_types.each do |issue_type|
      menu.choice "#{issue_type.name} (#{issue_type.id})", issue_type.id
    end
  end
end
method_missing(method, *args, &block) click to toggle source

Delegate

method - Method. args - Arguments. block - Block.

Returns wathever.

# File lib/speedflow/plugin/jira/prompt.rb, line 97
def method_missing(method, *args, &block)
  prompt.send(method, *args, &block)
end
project(projects) click to toggle source

Public: Prompt project.

projects - List of projects.

Returns String of project key.

# File lib/speedflow/plugin/jira/prompt.rb, line 24
def project(projects)
  prompt.select('Choose the project:') do |menu|
    projects.each do |project|
      menu.choice "#{project.name} (#{project.key})", project.key
    end
  end
end
prompt() click to toggle source

Public: Prompt.

Returns <::Speedflow::Plugin::Prompt> instance.

# File lib/speedflow/plugin/jira/prompt.rb, line 104
def prompt
  @prompt ||= ::Speedflow::Plugin::Prompt.new
end
title() click to toggle source

Public: Prompt title.

Returns String of title.

# File lib/speedflow/plugin/jira/prompt.rb, line 15
def title
  ask('What is the title of issue?', required: true)
end
transition(transitions) click to toggle source

Public: Prompt transition.

projects - List of transitions.

Returns String of status key.

# File lib/speedflow/plugin/jira/prompt.rb, line 50
def transition(transitions)
  prompt.select('Choose the transition:') do |menu|
    transitions.each do |transition|
      menu.choice(
        "#{transition.name} (#{transition.id})", transition.id)
    end
  end
end