rally_api 0.7.6 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/rally_api.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
-
require "rally_api/version"
|
2
|
-
require "rally_api/rally_rest_json"
|
3
|
-
|
4
1
|
#Copyright (c) 2002-2012 Rally Software Development Corp. All Rights Reserved.
|
5
2
|
#Your use of this Software is governed by the terms and conditions
|
6
3
|
#of the applicable Subscription Agreement between your company and
|
7
4
|
#Rally Software Development Corp.
|
8
5
|
|
6
|
+
require "rally_api/custom_http_header"
|
7
|
+
require "rally_api/rally_json_connection"
|
8
|
+
require "rally_api/rally_object"
|
9
|
+
require "rally_api/rally_query"
|
10
|
+
require "rally_api/rally_query_result"
|
11
|
+
require "rally_api/rally_rest_json"
|
12
|
+
require "rally_api/version"
|
13
|
+
|
9
14
|
module RallyAPI
|
10
|
-
# Your code goes here...
|
11
15
|
end
|
@@ -3,8 +3,6 @@
|
|
3
3
|
#of the applicable Subscription Agreement between your company and
|
4
4
|
#Rally Software Development Corp.
|
5
5
|
|
6
|
-
require_relative "version"
|
7
|
-
|
8
6
|
#custom headers help Rally identify the integration you have written
|
9
7
|
# You can make custom headers by:
|
10
8
|
# ch = RallyAPI::CustomHttpHeader.new({:name => "CustomRoobyTool", :vendor => "acme inc", :version => "1.0"})
|
@@ -24,6 +24,7 @@ module RallyAPI
|
|
24
24
|
@logger = nil
|
25
25
|
|
26
26
|
@rally_http_client = HTTPClient.new
|
27
|
+
@rally_http_client.cookie_manager = nil #leaving this off unitl JSESSION/ZESSSIONID settles down
|
27
28
|
@rally_http_client.receive_timeout = 300
|
28
29
|
@rally_http_client.send_timeout = 300
|
29
30
|
@rally_http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
@@ -88,9 +89,10 @@ module RallyAPI
|
|
88
89
|
end
|
89
90
|
|
90
91
|
#args should have :method
|
91
|
-
def send_request(url, args, url_params =
|
92
|
+
def send_request(url, args, url_params = nil)
|
92
93
|
method = args[:method]
|
93
|
-
req_args = {
|
94
|
+
req_args = {}
|
95
|
+
req_args[:query] = url_params unless url_params.nil?
|
94
96
|
|
95
97
|
req_headers = @rally_headers.headers
|
96
98
|
if (args[:method] == :post) || (args[:method] == :put)
|
@@ -81,6 +81,43 @@ module RallyAPI
|
|
81
81
|
errors
|
82
82
|
end
|
83
83
|
|
84
|
+
#support the crazy query string structure for the api
|
85
|
+
#each condition with an and or an or needs to be wrapped rpn style in ()
|
86
|
+
def build_query_segment(condition_array, op)
|
87
|
+
return nil if condition_array.length == 0
|
88
|
+
return condition_array.first if condition_array.length == 1
|
89
|
+
|
90
|
+
op = op.downcase #should be or or and
|
91
|
+
|
92
|
+
query_segment = ""
|
93
|
+
condition_array.each do |condition|
|
94
|
+
q_part = "(#{condition})" if condition[0] != "("
|
95
|
+
case op
|
96
|
+
when 'or'
|
97
|
+
query_segment = add_or(query_segment, q_part)
|
98
|
+
when 'and'
|
99
|
+
query_segment = add_and(query_segment, q_part)
|
100
|
+
else
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
return query_segment
|
105
|
+
end
|
106
|
+
|
107
|
+
def add_or(current_q, new_conditions)
|
108
|
+
return current_q if (new_conditions.nil? || new_conditions.empty?)
|
109
|
+
return new_conditions if (current_q.nil? || current_q.empty?)
|
110
|
+
new_conditions = "(#{new_conditions})" if new_conditions[0] != "("
|
111
|
+
"(#{current_q} OR #{new_conditions})"
|
112
|
+
end
|
113
|
+
|
114
|
+
def add_and(current_q, new_conditions)
|
115
|
+
return current_q if new_conditions.nil? || new_conditions.empty?
|
116
|
+
return new_conditions if current_q.nil? || current_q.empty?
|
117
|
+
new_conditions = "(#{new_conditions})" if new_conditions[0] != "("
|
118
|
+
"(#{current_q} AND #{new_conditions})"
|
119
|
+
end
|
120
|
+
|
84
121
|
private
|
85
122
|
|
86
123
|
def parse_query_hash(query_hash)
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
#require "custom_http_header"
|
2
|
+
#require "rally_json_connection"
|
3
|
+
#require "rally_object"
|
4
|
+
#require "rally_query"
|
5
|
+
#require "rally_query_result"
|
6
6
|
|
7
7
|
# --
|
8
8
|
#Copyright (c) 2002-2012 Rally Software Development Corp. All Rights Reserved.
|
data/lib/rally_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rally_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-13 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httpclient
|
16
|
-
requirement: &
|
16
|
+
requirement: &70263207772720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 2.2.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70263207772720
|
25
25
|
description: API wrapper for Rally's JSON REST web services api
|
26
26
|
email:
|
27
27
|
- dsmith@rallydev.com
|