Skip to content

Instantly share code, notes, and snippets.

@rrotter
Last active February 7, 2019 16:50
Show Gist options
  • Save rrotter/8ed9e40a73ec42332c67d7169e511d83 to your computer and use it in GitHub Desktop.
Save rrotter/8ed9e40a73ec42332c67d7169e511d83 to your computer and use it in GitHub Desktop.
Use jira-ruby Jira API Gem to make a new issue
#!/usr/bin/env ruby
require 'jira-ruby'
options = {
:username => 'service-account-user',
:password => 'service-account-pass',
:site => 'https://jira.server.domain',
:context_path => '/jira',
:auth_type => :basic
}
client = JIRA::Client.new(options)
issue = client.Issue.build
issue.save({
"fields" => {
"summary" => "This is a summary",
"project" => {"key" => "PROJECT"},
"issuetype" => {"name" => "Story"},
"description" => "This is a description",
}
})
print "Issue GUI URL: "
puts "#{client.options[:site]}#{client.options[:context_path]}/browse/#{issue.key}"
print "Issue API URL: "
puts issue.self
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment