rally_api 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -18,6 +18,9 @@ RallyAPI is a wrapper of Rally's Web Service API Json endpoints using rest-clien
18
18
  headers.vendor = "MyCompany"
19
19
  headers.version = "1.0"
20
20
 
21
+ #or one line custom header
22
+ headers = RallyAPI::CustomHttpHeader.new({:vendor => "Vendor", :name => "Custom Name", :version => "1.0"})
23
+
21
24
  config = {:base_url => "https://rally1.rallydev.com/slm"}
22
25
  config[:username] = "user@company.com"
23
26
  config[:password] = "password"
@@ -105,6 +108,8 @@ RallyAPI is a wrapper of Rally's Web Service API Json endpoints using rest-clien
105
108
  #re-ranking: rank_above and rank_below
106
109
  story1.rank_above(story2) #in a drag and drop workspace move story1 relative to story2
107
110
  story1.rank_below(story2)
111
+ story1.rank_to_bottom
112
+ story1.rank_to_top
108
113
 
109
114
  == License/Meta
110
115
  Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
@@ -5,6 +5,10 @@
5
5
 
6
6
  require_relative "version"
7
7
 
8
+ #custom headers help Rally identify the integration you have written
9
+ # You can make custom headers by:
10
+ # ch = RallyAPI::CustomHttpHeader.new({:name => "CustomRoobyTool", :vendor => "acme inc", :version => "1.0"})
11
+ # or by calling with no hash in the arguments and setting ch.name, ch.vendor, and ch.version
8
12
  module RallyAPI
9
13
 
10
14
  class CustomHttpHeader
@@ -14,11 +18,17 @@ module RallyAPI
14
18
  HTTP_HEADER_FIELDS = [:name, :vendor, :version, :library, :platform, :os]
15
19
  HTTP_HEADER_PREFIX = 'X-RallyIntegration'
16
20
 
17
- def initialize
21
+ def initialize(custom_vals = {})
18
22
  @os = RUBY_PLATFORM
19
23
  @platform = "Ruby #{RUBY_VERSION}"
20
- @library = "RallyRestJson version #{VERSION}"
24
+ @library = "RallyRestJson version #{RallyAPI::VERSION}"
21
25
  @name = "RallyRestJson"
26
+
27
+ if custom_vals.keys.length > 0
28
+ @name = custom_vals[:name]
29
+ @version = custom_vals[:version]
30
+ @vendor = custom_vals[:vendor]
31
+ end
22
32
  end
23
33
 
24
34
  def headers
@@ -16,6 +16,7 @@ module RallyAPI
16
16
  DEFAULT_PAGE_SIZE = 200
17
17
 
18
18
  attr_accessor :rally_headers, :low_debug, :logger
19
+ attr_reader :find_threads, :rally_http_client
19
20
 
20
21
  def initialize(headers, low_debug, proxy_info)
21
22
  @rally_headers = headers
@@ -25,6 +26,7 @@ module RallyAPI
25
26
  @rally_http_client = HTTPClient.new
26
27
  @rally_http_client.receive_timeout = 300
27
28
  @rally_http_client.send_timeout = 300
29
+ @rally_http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
28
30
  @rally_http_client.transparent_gzip_decompression = true
29
31
 
30
32
  #passed in proxy setup overrides env level proxy
@@ -33,12 +35,26 @@ module RallyAPI
33
35
  @rally_http_client.proxy = env_proxy
34
36
  end
35
37
  @rally_http_client.proxy = proxy_info unless !proxy_info.nil?
38
+
39
+ @find_threads = 4
36
40
  end
37
41
 
38
42
  def set_client_user(base_url, user, password)
39
43
  @rally_http_client.set_basic_auth(base_url, user, password)
40
44
  end
41
45
 
46
+ def set_ssl_verify_mode(mode = OpenSSL::SSL::VERIFY_NONE)
47
+ @rally_http_client.ssl_config.verify_mode = mode
48
+ end
49
+
50
+ #you can have any number you want as long as it is between 1 and 4
51
+ def set_find_threads(num_threads = 2)
52
+ return if num_threads.class != Fixnum
53
+ num_threads = 4 if num_threads > 4
54
+ num_threads = 1 if num_threads < 1
55
+ @find_threads = num_threads
56
+ end
57
+
42
58
  def get_all_json_results(url, args, query_params, limit = 99999)
43
59
  all_results = []
44
60
  args[:method] = :get
@@ -104,7 +120,7 @@ module RallyAPI
104
120
  private
105
121
 
106
122
  def run_threads(query_array)
107
- num_threads = 4
123
+ num_threads = @find_threads
108
124
  thr_queries = []
109
125
  (0...num_threads).each { |ind| thr_queries[ind] = [] }
110
126
  query_array.each { |query| thr_queries[query[:page_num] % num_threads].push(query) }
@@ -54,11 +54,23 @@ module RallyAPI
54
54
  end
55
55
 
56
56
  def rank_above(relative_rally_object)
57
- @rally_rest.rank_above(@rally_object["_ref"],relative_rally_object["_ref"])
57
+ @rally_object = @rally_rest.rank_above(@rally_object["_ref"],relative_rally_object["_ref"]).rally_object
58
+ self
58
59
  end
59
60
 
60
61
  def rank_below(relative_rally_object)
61
- @rally_rest.rank_below(@rally_object["_ref"],relative_rally_object["_ref"])
62
+ @rally_object = @rally_rest.rank_below(@rally_object["_ref"],relative_rally_object["_ref"]).rally_object
63
+ self
64
+ end
65
+
66
+ def rank_to_bottom
67
+ @rally_object = @rally_rest.rank_to(@rally_object["_ref"], "BOTTOM").rally_object
68
+ self
69
+ end
70
+
71
+ def rank_to_top
72
+ @rally_object = @rally_rest.rank_to(@rally_object["_ref"], "TOP").rally_object
73
+ self
62
74
  end
63
75
 
64
76
  def delete()
@@ -47,10 +47,10 @@ module RallyAPI
47
47
  DEFAULT_WSAPI_VERSION = "1.37"
48
48
 
49
49
  attr_accessor :rally_url, :rally_user, :rally_password, :rally_workspace_name, :rally_project_name, :wsapi_version
50
- attr_accessor :rally_headers, :rally_default_workspace, :rally_default_project, :low_debug, :proxy_info, :retries
50
+ attr_accessor :rally_headers, :rally_default_workspace, :rally_default_project, :low_debug, :proxy_info
51
51
  attr_accessor :rally_rest_api_compat, :logger
52
52
 
53
- attr_reader :rally_objects
53
+ attr_reader :rally_connection, :rally_objects
54
54
 
55
55
  def initialize(args)
56
56
  @rally_url = args[:base_url] || "https://rally1.rallydev.com/slm"
@@ -61,7 +61,7 @@ module RallyAPI
61
61
  @wsapi_version = args[:version] || DEFAULT_WSAPI_VERSION
62
62
  @rally_headers = args[:headers] || CustomHttpHeader.new
63
63
  @proxy_info = args[:proxy]
64
- @retries = args[:retries] || 0
64
+
65
65
  @rally_rest_api_compat = args[:rally_rest_api_compat] || false
66
66
 
67
67
  @low_debug = args[:debug] || false
@@ -70,7 +70,6 @@ module RallyAPI
70
70
  @rally_connection = RallyJsonConnection.new(@rally_headers, @low_debug, @proxy_info)
71
71
  @rally_connection.set_client_user(@rally_url, @rally_user, @rally_password)
72
72
  @rally_connection.logger = @logger unless @logger.nil?
73
- @rally_connection.retries = @retries if @retries > 0
74
73
 
75
74
  @rally_objects = { :typedefinition => "TypeDefinition" }
76
75
  cache_rally_objects()
@@ -233,6 +232,10 @@ module RallyAPI
233
232
  RallyQueryResult.new(self, json_response)
234
233
  end
235
234
 
235
+ def adjust_find_threads(num_threads)
236
+ @rally_connection.set_find_threads(num_threads)
237
+ end
238
+
236
239
  #rankAbove=%2Fhierarchicalrequirement%2F4624552599
237
240
  #{"hierarchicalrequirement":{"_ref":"https://rally1.rallydev.com/slm/webservice/1.27/hierarchicalrequirement/4616818613.js"}}
238
241
  def rank_above(ref_to_rank, relative_ref)
@@ -255,7 +258,17 @@ module RallyAPI
255
258
  params[:fetch] = "true"
256
259
  json_update = { get_type_from_ref(ref_to_rank) => {"_ref" => ref_to_rank} }
257
260
  args = { :method => :put, :payload => json_update }
258
- #update = @rally_connection.put_object(ref, args, params, json_update)
261
+ update = @rally_connection.send_request(ref, args, params)
262
+ RallyObject.new(self, update["OperationResult"]["Object"])
263
+ end
264
+
265
+ def rank_to(ref_to_rank, location = "TOP")
266
+ ref = ref_to_rank
267
+ params = {}
268
+ params[:rankTo] = location
269
+ params[:fetch] = "true"
270
+ json_update = { get_type_from_ref(ref_to_rank) => {"_ref" => ref_to_rank} }
271
+ args = { :method => :put, :payload => json_update }
259
272
  update = @rally_connection.send_request(ref, args, params)
260
273
  RallyObject.new(self, update["OperationResult"]["Object"])
261
274
  end
@@ -4,5 +4,5 @@
4
4
  #of the applicable Subscription Agreement between your company and
5
5
  #Rally Software Development Corp.
6
6
  module RallyAPI
7
- VERSION = "0.7.0"
7
+ VERSION = "0.7.1"
8
8
  end
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.7.0
4
+ version: 0.7.1
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-10-12 00:00:00.000000000Z
12
+ date: 2012-10-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient
16
- requirement: &70172871514240 !ruby/object:Gem::Requirement
16
+ requirement: &70242928975180 !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: *70172871514240
24
+ version_requirements: *70242928975180
25
25
  description: API wrapper for Rally's JSON REST web services api
26
26
  email:
27
27
  - dsmith@rallydev.com