0

如何在 JIRA 问题中设置组件?在创建新问题时,我将组件数组设置为我的idname。正确的方法是什么?它也没有assignee价值。

username = 'admin'
password = 'admin'
project = 'Dev'

jira = Savon::Client.new(
  "https://something.com/rpc/soap/jirasoapservice-v2?wsdl"
)

login = jira.request(:login) do |soap|
  soap.body = {
    :in0 => username,
    :in1 => password
  }
end
login = login.to_hash
token = login[:login_response][:login_return]

def createissue jira, token, project, username
response = jira.request(:create_issue) do |soap|
  soap.body = {
    :in0 => token,
    :in1 => {
      :type => "3",
      :assignee => username,
      :project => project,
      :summary => "API Test",
      :description => "Jira's SOAP API test",
      :components => [ 'id' => '10786']
      #:components =>
        { 'components' =>
          { 'id' => '10786',
            'name' => 'General Troubleshooting'}} # tried these
      #:components =>
        { 'id' => '10786',
          'name' => 'General Troubleshooting'} # tried these
      # None of of the above component
      # options is setting component in my issue.
      # I have the correct 'id' and 'name'.
        }
  }
end
end

  createissue jira, token, project, username

在 SOAPUI 中,它显示了所需的数据类型,但是我要为此构造 xml 吗?

<components
  xsi:type="jir:ArrayOf_tns1_RemoteComponent"
  soapenc:arrayType="bean:RemoteComponent[]"
  xmlns:jir="https://server/rpc/soap/jirasoapservice-v2" />
4

1 回答 1

0

不是最优雅的方式,但如果我遇到此类问题,我的起点是在代码中构建 XML 字符串并将其分配给soap.body。

于 2012-06-18T01:40:38.380 回答