rally_rest_api 0.6.12 → 0.6.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rally_rest_api/query.rb +9 -3
- data/lib/rally_rest_api/version.rb +1 -1
- data/test/tc_rest_query.rb +7 -0
- metadata +2 -2
data/lib/rally_rest_api/query.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'uri'
|
2
2
|
|
3
3
|
class String # :nodoc: all
|
4
|
-
def to_camel
|
5
|
-
self.split(/\./).map { |word| word.split(/_/).map { |word| word.capitalize }.join}.join('.')
|
4
|
+
def to_camel(downcase_first_letter = false)
|
5
|
+
word = self.split(/\./).map { |word| word.split(/_/).map { |word| word.capitalize }.join}.join('.')
|
6
6
|
end
|
7
7
|
|
8
8
|
alias :to_q :to_s
|
@@ -102,7 +102,8 @@ class RestQuery
|
|
102
102
|
# this is a hack, we need a better way to express descending
|
103
103
|
v = [v].flatten.map { |e| e.to_s.to_camel }.join(", ").gsub(", Desc", " desc")
|
104
104
|
end
|
105
|
-
|
105
|
+
key = de_underscore(k)
|
106
|
+
query_string << "&#{key}=#{URI.escape(v.to_q)}"
|
106
107
|
end
|
107
108
|
query_string
|
108
109
|
end
|
@@ -119,6 +120,11 @@ class RestQuery
|
|
119
120
|
def self.query(&block)
|
120
121
|
QueryBuilder.new("and", &block).to_q
|
121
122
|
end
|
123
|
+
|
124
|
+
private
|
125
|
+
def de_underscore(s)
|
126
|
+
s.to_s.gsub("_", "")
|
127
|
+
end
|
122
128
|
end
|
123
129
|
|
124
130
|
# Internal support for generating query string for the Rally Webservice.
|
data/test/tc_rest_query.rb
CHANGED
@@ -188,6 +188,13 @@ class TestRestQuery < Test::Unit::TestCase
|
|
188
188
|
assert_equal("query=(Name = name)&fetch=false", URI.unescape(query_string) )
|
189
189
|
end
|
190
190
|
|
191
|
+
def test_new_with_options_with_underscores
|
192
|
+
query_string = RestQuery.new(:artifact,
|
193
|
+
:project_scope_up => false) { equal :name, "name"}.to_q
|
194
|
+
assert_equal("query=(Name = name)&projectscopeup=false", URI.unescape(query_string) )
|
195
|
+
end
|
196
|
+
|
197
|
+
|
191
198
|
def test_next_page
|
192
199
|
q = RestQuery.new(:artifact,
|
193
200
|
:pagesize => 10,
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rally_rest_api
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.6.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.6.13
|
7
|
+
date: 2007-03-08 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
|