Actions
Defect #23112
closedAdding new version to project using Ruby API
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Invalid
Affected version:
Description
Hey,
How can I add new version object to Redmine project using Ruby API? I'd like to automate some processes in Ruby script.
I've add new class
require_relative 'redmine_connection'
class RedmineVersion < RedmineConnection
self.element_name = 'version'
end
RedmineConnection.rb stores credentials and inherits from ActiveResource::Base - that works good, I can connect to Redmine API and read, e.g., Issues.
class RedmineConnection < ActiveResource::Base
self.site = 'http://redmine-test/'
self.user = 'tmpuser'
self.password = 'secret'
self.format = :xml
Wiki says that Version needs only project_id and name, these are required.
This doesn't work:
version = RedmineVersion.new(
:project_id => 12,
:name => "Another version",
)
I've also tried to connect to Redmine from rails script/console option and create new Version - no problem with that, I've only passed project_id and name, save after that and new Version was added.
Can someone give me an example how to add Version object to Redmine project?
Thanks for help.
Gary
Updated by Toshi MARUYAMA over 8 years ago
- Status changed from New to Closed
- Resolution set to Invalid
Please use forum for question.
Actions