简体   繁体   中英

Ruby: Is there any way to move versions in JIRA via Ruby rest-client

Recently i tried to rewrite an old legacy Python program for our production Ruby environment. The main goal of this script is:

  • Get all version from JIRA for project TEST
  • Get parent version
  • Create new version after parent

jira-ruby gem is good for creating things, but there is no "move" method, so i tried to use REST library.

But i can't figure how to move newly created version after parent one.

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e137

How should i sent REST query to move version 22015 after 22010 via POST method?

require 'rubygems'
require 'json'
require 'restclient'

def jira_request
  project_key="TEST"
  jira_login = "bot"
  jira_pass = "password"
  jira_url = "http://#{jira_login}:#{jira_pass}@jira.local:16011/rest/api/2/version/22105/move"

  @move = RestClient.post "#{jira_url}",
  {
    'after' => "http://jira.local:16011/rest/api/2/version/22106"
  }.to_json, :content_type => :json, :accept => :json

  @jiradata = JSON.parse(@move)
end

jira_request

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM