如何使用JIRA Rails的自定义“ Reporter”创建问题

问题描述 投票:0回答:1

根据https://github.com/sumoheavy/jira-ruby rails gem,我必须设置一个有效的jira用户和api密码才能允许我访问Jira api。

我可以根据以下代码创建问题,但是当我看到记录日志或什至在Jira页面中时,Reporter标题与我的用户名一起显示。我需要从我的html输入表单中创建问题用户名“ reporter”,我不知道我的用户将键入什么...

所以,如何使用自定义用户名用户Rails Jira gem创建问题?

enter image description here

ruby-on-rails ruby rubygems jira jira-rest-api
1个回答
1
投票

根据他们的测试套件:

JIRA::Resource::Issue.new(client, attrs: {
                                  'id' => '123',
                                  'fields' => {
                                    'reporter' => { 'foo' => 'bar' },
                                    'assignee'    => { 'foo' => 'bar' },
                                    'project'     => { 'foo' => 'bar' },
                                    'priority'    => { 'foo' => 'bar' },
                                    'issuetype'   => { 'foo' => 'bar' },
                                    'status'      => { 'foo' => 'bar' },
                                    'components'  => [{ 'foo' => 'bar' }, { 'baz' => 'flum' }],
                                    'versions'    => [{ 'foo' => 'bar' }, { 'baz' => 'flum' }],
                                    'comment'     => { 'comments' => [{ 'foo' => 'bar' }, { 'baz' => 'flum' }] },
                                    'attachment'  => [{ 'foo' => 'bar' }, { 'baz' => 'flum' }],
                                    'worklog'     => { 'worklogs' => [{ 'foo' => 'bar' }, { 'baz' => 'flum' }] }
                                  }
                                })
    end

这意味着您应该能够写:

issue = client.Issue.build
issue.save({"fields"=>{"reporter"=> {"username" => "reporter"},"summary" => {"Crazy froggy"}}

我想这里的“用户名”是适当的密钥-但是,如果他们在规范中调用它,那么您应该可以在您的代码中调用它。

现在问题可能是“报告者”不是Jira中的有效用户-因为他们的规格测试:

    it 'has the correct relationships' do
      expect(subject).to have_one(:reporter, JIRA::Resource::User)
      expect(subject.reporter.foo).to eq('bar')

expect(subject).to have_one(:reporter, JIRA::Resource::User)行建议'reporter'值必须是JIRA :: Resource :: User的有效实例,这告诉我您不能将此字段设置为所需的任何值。我认为JIRA会根据您的JIRA实例拥有多少个帐户来收费?因此,每个用户将是一个单独的许可证。

我在这里做了很多猜测,但是我认为这意味着您需要付费以在JIRA中许可“报告者”用户,然后可以为所有这些问题设置它。

© www.soinside.com 2019 - 2024. All rights reserved.