rally_api 0.9.15 → 0.9.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,8 @@ module RallyAPI
27
27
  end
28
28
 
29
29
  def each(&block)
30
- if (block.parameters.length == 2)
30
+ # check for parameters method so we don't blow up on Ruby 1.8.7
31
+ if (block.respond_to?('parameters') && block.parameters.length == 2)
31
32
  @results.each do |record|
32
33
  block.call(record.to_s, record)
33
34
  end
@@ -32,7 +32,8 @@ module RallyAPI
32
32
  #@rally_http_client.debug_dev = STDOUT
33
33
 
34
34
  #passed in proxy setup overrides env level proxy
35
- env_proxy = ENV["http_proxy"]
35
+ env_proxy = ENV["http_proxy"] #todo - this will go in the future
36
+ env_proxy = ENV["rally_proxy"] if env_proxy.nil?
36
37
  if (!env_proxy.nil?) && (proxy_info.nil?)
37
38
  @rally_http_client.proxy = env_proxy
38
39
  end
@@ -36,6 +36,7 @@ module RallyAPI
36
36
  @limit = 99999 if @limit.nil?
37
37
  @project_scope_up = false if @project_scope_up.nil?
38
38
  @project_scope_down = false if @project_scope_down.nil?
39
+ @page_size = @limit if @page_size > @limit
39
40
  self
40
41
  end
41
42
 
@@ -126,9 +127,9 @@ module RallyAPI
126
127
  @project_scope_up = query_hash[:project_scope_up]
127
128
  @order = query_hash[:order]
128
129
  @page_size = query_hash[:page_size]
129
- @limit = query_hash[:limit]
130
- @workspace = query_hash[:workspace]
131
- @project = query_hash[:project]
130
+ @limit = query_hash[:limit]
131
+ @workspace = query_hash[:workspace]
132
+ @project = query_hash[:project]
132
133
  end
133
134
 
134
135
  end
@@ -73,7 +73,10 @@ module RallyAPI
73
73
  @rally_connection = RallyJsonConnection.new(@rally_headers, @low_debug, @proxy_info)
74
74
  @rally_connection.set_client_user(@rally_url, @rally_user, @rally_password)
75
75
  @rally_connection.logger = @logger unless @logger.nil?
76
- @rally_connection.setup_security_token(security_url) unless @skip_sec_key
76
+
77
+ if @wsapi_version.to_s.include?("v2.") && !@skip_sec_key
78
+ @rally_connection.setup_security_token(security_url)
79
+ end
77
80
 
78
81
  if !@rally_workspace_name.nil?
79
82
  @rally_default_workspace = find_workspace(@rally_workspace_name)
@@ -128,9 +131,9 @@ module RallyAPI
128
131
  nil
129
132
  end
130
133
 
131
- def user
134
+ def user(params = {})
132
135
  args = { :method => :get }
133
- json_response = @rally_connection.send_request(make_get_url("user"), args)
136
+ json_response = @rally_connection.send_request(make_get_url("user"), args, params)
134
137
  rally_type = json_response.keys[0]
135
138
  RallyObject.new(self, json_response[rally_type], warnings(json_response))
136
139
  end
@@ -280,19 +283,20 @@ module RallyAPI
280
283
  RallyObject.new(self, json_response["OperationResult"]["Object"], warnings(json_response))
281
284
  end
282
285
 
283
- def get_typedef_for(type)
286
+ def get_typedef_for(type, workspace = @rally_default_workspace)
284
287
  type = type.to_s if type.class == Symbol
285
288
  type = check_type(type)
286
289
  type_def_query = RallyQuery.new()
287
290
  type_def_query.type = "typedefinition"
291
+ type_def_query.workspace = workspace
288
292
  type_def_query.fetch = true
289
293
  type_def_query.query_string= "(TypePath = \"#{type}\")"
290
294
  type_def = find(type_def_query)
291
295
  type_def.first
292
296
  end
293
297
 
294
- def get_fields_for(type)
295
- type_def = get_typedef_for(type)
298
+ def get_fields_for(type, workspace = @rally_default_workspace)
299
+ type_def = get_typedef_for(type, workspace)
296
300
  return nil if type_def.nil?
297
301
  fields = {}
298
302
  type_def["Attributes"].each do |attr|
@@ -434,7 +438,7 @@ module RallyAPI
434
438
  def self.camel_case_word(sym)
435
439
  word = sym.to_s
436
440
 
437
- if word.start_with? ("c_")
441
+ if word.start_with?("c_")
438
442
  custom_field_without_c = word.sub("c_", "")
439
443
  camelized = camelize(custom_field_without_c)
440
444
  camelized[0] = custom_field_without_c[0]
@@ -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.9.15"
7
+ VERSION = "0.9.16"
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.9.15
4
+ version: 0.9.16
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: 2013-06-04 00:00:00.000000000Z
12
+ date: 2013-06-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient
16
- requirement: &70260179508480 !ruby/object:Gem::Requirement
16
+ requirement: &70253691004580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70260179508480
24
+ version_requirements: *70253691004580
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: simplecov
27
- requirement: &70260179508040 !ruby/object:Gem::Requirement
27
+ requirement: &70253691004160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70260179508040
35
+ version_requirements: *70253691004160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70260179507540 !ruby/object:Gem::Requirement
38
+ requirement: &70253691003700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70260179507540
46
+ version_requirements: *70253691003700
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70260179507120 !ruby/object:Gem::Requirement
49
+ requirement: &70253691003280 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70260179507120
57
+ version_requirements: *70253691003280
58
58
  description: API wrapper for Rally's JSON REST web services api
59
59
  email:
60
60
  - dsmith@rallydev.com