Ruby を使用して、Redmine の問題間に新しい関係を挿入するための構文を見つけようとしています。
私が試してきたコード:
require 'rubygems'
require 'active_resource'
class Issue < ActiveResource::Base
self.site = '[the site]'
self.user = '[the user]'
self.password = '[the password]' #not hard coded
self.format = :json #I've had issues with Issue.find(i) without explicitly stating the format
end
class IssueRelation < ActiveResource::Base
self.site = '[the site]'
self.user = '[the user]'
self.password = '[the password]' #not hard coded
self.format = :json #I've had issues with Issue.find(i) without explicitly stating the format
end
issue1 = Issue.find(1)
issue2 = Issue.find(2)
puts issue1.id
puts issue2.id
relation = IssueRelation.new(
:issue => issue1,
:issue_to => issue2,
:relation_type => 'relates'
)
if relation.save
puts relation.id
else
puts relation.errors.full_message
end
私が返す出力:
1
2
...'handle_response': Failed. Response code = 404. Response Message = not found.
出力は、Issue 1 と 2 が正常に見つかったことを示していますが、関係に使用している名前が無効であるため、404 が見つかりませんでした。
リンクする 2 つの問題が見つかった場合、Redmine の API でリレーションを作成するための正しい構文は何ですか?