如何使用来自 JIRA Rails gem 的自定义 "Reporter" 创建问题

How to create a Issue with custom "Reporter" from a JIRA Rails gem

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

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

那么如何使用自定义用户名用户 Rails Jira gem 创建问题?

根据他们的测试套件:

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"}}

我猜 "username" 是这里合适的键 - 但如果他们在规范中调用它,那么你应该能够在你的代码中调用它。

现在 问题 可能是 "reporter" 不是 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 中获得 'reporter' 用户许可,然后您可以针对所有这些问题进行设置。