rally_rest_api 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +6 -0
- data/README.txt +2 -2
- data/Rakefile +1 -1
- data/lib/rally_rest_api/query_result.rb +6 -4
- data/lib/rally_rest_api/rally_rest.rb +1 -2
- data/lib/rally_rest_api/rest_builder.rb +5 -5
- data/lib/rally_rest_api/version.rb +2 -2
- data/test/tc_query_result.rb +4 -4
- metadata +2 -2
data/CHANGELOG.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
2006-11-28 Bob Cotton <bcotton@england.f4tech.com>
|
2
|
+
|
3
|
+
* Rakefile: Changed version package
|
4
|
+
|
5
|
+
* lib/rally_rest_api/query_result.rb: Fixed paging with each operator
|
6
|
+
|
1
7
|
2006-11-27 Bob Cotton <bcotton@england.f4tech.com>
|
2
8
|
|
3
9
|
* lib/rally_rest_api/query.rb: Added docs.
|
data/README.txt
CHANGED
@@ -3,12 +3,12 @@ rally-rest-api -- A Ruby-ized interface to Rally's REST webservice API
|
|
3
3
|
==Introduction:
|
4
4
|
Rally Software Development's on-demand agile software life-cycle management services offers webservices API's for its customers. The API comes in both SOAP and REST style interfaces. This library is for accessing the REST API using Ruby. For more information about Rally's webservice APIs see https://rally1.rallydev.com/slm/doc/webservice/index.jsp.
|
5
5
|
|
6
|
-
This API provides full access to all CRUD operations and
|
6
|
+
This API provides full access to all CRUD operations and a rich interface to the query facility. An Enumerable interface is provided for the paginated query results.
|
7
7
|
|
8
8
|
== Rationale (i.e. Why not SOAP?):
|
9
9
|
Your subscription in Rally can be partitioned into several isolated "Workspaces", where the only thing shared between workspaces are your users. Any custom attributes you create will be specific to each workspace. When using the SOAP interface, the WSDL generated is specific to the workspace you are working in. Therefore the name-space (e.g. package in Java) will be different for each workspace you are working with.
|
10
10
|
|
11
|
-
Because REST webservices do not have WSDL (the XML schema is available for each workspace), there is no per-workspace interface. Combined with the dynamic nature of this API, you don't need to code to different Ruby namespaces when you are working with multiple workspaces. You will however, need to be aware of the workspaces your objects are in when working with multiple workspaces.
|
11
|
+
Because REST webservices do not have WSDL (the XML schema is available for each workspace), there is no per-workspace interface. Combined with the dynamic nature of this API, you don't need to code to different Ruby namespaces when you are working with multiple workspaces. You will, however, need to be aware of the workspaces your objects are in when working with multiple workspaces.
|
12
12
|
|
13
13
|
== Getting Started:
|
14
14
|
RallyRestAPI is the entry point to the api. Each instance corresponds to one user logged into Rally. There are several options that may be passed to the constructor:
|
data/Rakefile
CHANGED
@@ -22,7 +22,7 @@ RELEASE_TYPES = %w( gem ) # can use: gem, tar, zip
|
|
22
22
|
|
23
23
|
NAME = "rally_rest_api"
|
24
24
|
REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
25
|
-
VERS = ENV['VERSION'] || (
|
25
|
+
VERS = ENV['VERSION'] || (RallyRestVersion::VERSION::STRING + (REV ? ".#{REV}" : ""))
|
26
26
|
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
27
27
|
RDOC_OPTS = ['--quiet', '--title', "rally_rest_api documentation",
|
28
28
|
"--opname", "index.html",
|
@@ -36,6 +36,7 @@ class QueryResult < RestObject
|
|
36
36
|
@start_index = elements[:start_index].to_i
|
37
37
|
end
|
38
38
|
|
39
|
+
require 'active_support/breakpoint'
|
39
40
|
# fetch the next page of results. Uses the original query to generate the query string.
|
40
41
|
def next_page
|
41
42
|
@rally_rest.query(@query.next_page(:start => self.start_index + self.page_size,
|
@@ -45,14 +46,15 @@ class QueryResult < RestObject
|
|
45
46
|
# Iteration all pages of the result
|
46
47
|
def each
|
47
48
|
current_result = self
|
48
|
-
|
49
|
+
begin
|
50
|
+
last_result = current_result
|
49
51
|
current_result.elements[:results].each do |result|
|
50
52
|
# The collection of refs we are holding onto could grow without bounds, so dup
|
51
53
|
# the ref
|
52
54
|
yield result.dup
|
53
55
|
end
|
54
|
-
current_result = current_result.next_page
|
55
|
-
end
|
56
|
+
current_result = current_result.next_page if current_result.more_pages?
|
57
|
+
end while last_result != current_result
|
56
58
|
end
|
57
59
|
|
58
60
|
# return the first element. Useful for queries that return only one result
|
@@ -68,6 +70,6 @@ class QueryResult < RestObject
|
|
68
70
|
|
69
71
|
# Are there more pages?
|
70
72
|
def more_pages?
|
71
|
-
(self.start_index + self.page_length) < self.total_result_count
|
73
|
+
(self.start_index + self.page_length) -1 < self.total_result_count
|
72
74
|
end
|
73
75
|
end
|
@@ -88,8 +88,7 @@ class RallyRestAPI
|
|
88
88
|
rest_object.delete
|
89
89
|
end
|
90
90
|
|
91
|
-
|
92
|
-
def query(query)
|
91
|
+
def query(query) # :nodoc:
|
93
92
|
query_url = "#{@base_url}/webservice/1.0/#{query.type.to_s.to_camel}?" << query.to_q
|
94
93
|
xml = read_rest(query_url, @username, @password)
|
95
94
|
QueryResult.new(query, self, xml)
|
@@ -1,10 +1,10 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'uri'
|
3
|
+
require 'rexml/document'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'builder'
|
1
6
|
|
2
7
|
module RestBuilder # :nodoc:
|
3
|
-
require 'net/https'
|
4
|
-
require 'uri'
|
5
|
-
require 'rexml/document'
|
6
|
-
require 'rubygems'
|
7
|
-
require_gem 'builder'
|
8
8
|
|
9
9
|
DEBUG = false
|
10
10
|
|
data/test/tc_query_result.rb
CHANGED
@@ -18,22 +18,22 @@ class QueryResultTestCase < Test::Unit::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_basic_numbers
|
21
|
-
result_xml = make_result(20, 20,
|
21
|
+
result_xml = make_result(20, 20, 1)
|
22
22
|
result = QueryResult.new(nil, @api, result_xml)
|
23
23
|
assert_equal(20, result.total_result_count)
|
24
24
|
assert_equal(20, result.page_size)
|
25
|
-
assert_equal(
|
25
|
+
assert_equal(1, result.start_index)
|
26
26
|
assert_equal(20, result.page_length)
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_more_pages_when_no_pages
|
30
|
-
query_result_xml = make_result(20, 20,
|
30
|
+
query_result_xml = make_result(20, 20, 1)
|
31
31
|
result = QueryResult.new(nil, @api, query_result_xml)
|
32
32
|
assert(! result.more_pages?, "No more pages when total == page size")
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_more_pages_when_more_pages
|
36
|
-
query_result_xml = make_result(21, 20,
|
36
|
+
query_result_xml = make_result(21, 20, 1)
|
37
37
|
result = QueryResult.new(nil, @api, query_result_xml)
|
38
38
|
assert(result.more_pages?, "Should have more pages when total != page size")
|
39
39
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rally_rest_api
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.5.
|
7
|
-
date: 2006-11-
|
6
|
+
version: 0.5.6
|
7
|
+
date: 2006-11-28 00:00:00 -07:00
|
8
8
|
summary: A ruby-ized interface to Rally's REST webservices API
|
9
9
|
require_paths:
|
10
10
|
- lib
|