Project

General

Profile

Actions

Defect #23112

closed

Adding new version to project using Ruby API

Added by Marcin Garski over 8 years ago. Updated over 8 years ago.

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

Actions

Also available in: Atom PDF