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.
@@ -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
- query_string << "&#{k}=#{URI.escape(v.to_q)}"
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.
@@ -2,7 +2,7 @@ module RallyRestVersion #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 6
5
- TINY = 12
5
+ TINY = 13
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -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.12
7
- date: 2007-02-23 00:00:00 -07:00
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