Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add: Settings

  • Loading branch information...
commit 1bb3b6ed87d6ffb3416fc952e28ef7a8362c7b6c 1 parent a9b8d1f
Sven Krzyzak authored
View
18 app/controllers/mylyn_connector/settings_controller.rb
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../../../lib/mylyn_connector'
+
+class MylynConnector::SettingsController < ApplicationController
+ unloadable
+ include MylynConnector::Rescue::ClassMethods
+
+ skip_before_filter :verify_authenticity_token
+
+ helper MylynConnector::MylynHelper
+
+ def all
+ @settings = Setting
+
+ respond_to do |format|
+ format.xml {render :layout => false}
+ end
+ end
+end
View
4 app/views/mylyn_connector/settings/all.xml.builder
@@ -0,0 +1,4 @@
+xml.instruct! :xml, :encoding => "UTF-8"
+xml.settings :xmlns => 'http://redmin-mylyncon.sf.net/api', :api=>api_version do
+ xml.useIssueDoneRatio Setting.issue_done_ratio != 'issue_status'
+end
View
1  config/routes.rb
@@ -1,4 +1,5 @@
ActionController::Routing::Routes.draw do |map|
+ map.connect "mylyn/settings", :controller => "MylynConnector::Settings", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/issue/:id", :controller => "MylynConnector::Issues", :action => "show", :conditions => {:method => :get}
map.connect "mylyn/projects", :controller => "MylynConnector::Projects", :action => "all", :conditions => {:method => :get}
map.connect "mylyn/priorities", :controller => "MylynConnector::Priorities", :action => "all", :conditions => {:method => :get}
View
25 test/functional/settings_controller_test.rb
@@ -0,0 +1,25 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class MylynConnector::SettingsControllerTest < MylynConnector::ControllerTest
+ fixtures :settings
+
+ def setup
+ super
+ @controller = MylynConnector::SettingsController.new
+ end
+
+ def test_all
+ get :all
+ assert_response :success
+ assert_template 'all.xml.builder'
+
+ xmldoc = XML::Document.string @response.body
+ schema = read_schema 'settings'
+ valid = xmldoc.validate_schema schema
+ assert valid , 'Ergebnis passt nicht zum Schema ' + 'settings'
+
+ assert_tag :tag => 'useissuedoneratio', :content => 'true', :parent => {:tag => 'settings', :attributes => {:api => /^2.7.0/}}
+
+ end
+
+end
View
19 test/schema/settings.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://redmin-mylyncon.sf.net/api"
+ targetNamespace="http://redmin-mylyncon.sf.net/api"
+ elementFormDefault="qualified" >
+
+ <xsd:include schemaLocation="types/query.xsd" />
+ <xsd:include schemaLocation="types/versionstring.xsd" />
+
+ <xsd:element name="settings" xmlns="http://redmin-mylyncon.sf.net/api" >
+ <xsd:complexType>
+ <xsd:sequence >
+ <xsd:element name="useIssueDoneRatio" type="xsd:boolean" />
+ </xsd:sequence>
+ <xsd:attribute name="api" type="tns:versionstring" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
Please sign in to comment.
Something went wrong with that request. Please try again.