class CreateTicket::CLI
Public Instance Methods
assignee()
click to toggle source
# File lib/create_ticket/cli.rb, line 32 def assignee ENV.fetch('JIRA_ASSIGNEE') end
custom_fields()
click to toggle source
# File lib/create_ticket/cli.rb, line 40 def custom_fields ENV.select { |k, _| k.start_with? 'JIRA_CUSTOMFIELD' }.to_a .map { |k, v| [k.downcase.sub(/^jira_/, ''), v] }.to_h end
duedate()
click to toggle source
# File lib/create_ticket/cli.rb, line 45 def duedate ENV['JIRA_DUEDATE'] end
issue_type()
click to toggle source
# File lib/create_ticket/cli.rb, line 36 def issue_type ENV.fetch('JIRA_ISSUE_TYPE') end
jira_token()
click to toggle source
# File lib/create_ticket/cli.rb, line 24 def jira_token ENV.fetch('JIRA_TOKEN') { prompt_for_jira_token } end
jira_url()
click to toggle source
# File lib/create_ticket/cli.rb, line 9 def jira_url ENV.fetch('JIRA_URL') end
project()
click to toggle source
# File lib/create_ticket/cli.rb, line 13 def project ENV.fetch('JIRA_PROJECT') end
prompt_for_jira_token()
click to toggle source
# File lib/create_ticket/cli.rb, line 17 def prompt_for_jira_token cli = HighLine.new username = cli.ask('Username: ') password = cli.ask('Password: ') { |q| q.echo = '*' } Base64.encode64 "#{username}:#{password}" end
run!()
click to toggle source
# File lib/create_ticket/cli.rb, line 49 def run! ticket_url = CreateTicket.new(self).create_ticket! puts ticket_url rescue CouldNotCreateTicketError, KeyError, JSON::ParserError => e puts e.message exit 1 end
template_filename()
click to toggle source
# File lib/create_ticket/cli.rb, line 28 def template_filename ENV.fetch('TEMPLATE_FILENAME') end