rally_api 0.9.25 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c97d9fae3df897057f75804abbf772c5112ad567
4
- data.tar.gz: 50f0ff82c855619e78e50dcd6868a3dc58df5b0f
3
+ metadata.gz: 3dc909010959f93625ac7ef070f8650456279deb
4
+ data.tar.gz: 7134c5cad3d07742da655cb4a3a2ab07f1da192a
5
5
  SHA512:
6
- metadata.gz: 7f8aa6bdb5942c83ea78249ababd1fd5bca6c28cfe6d7f811ee74c0b9b817b46a0ac6d3a000cb88c162061b3bfb962f340b19c454605ebdf99e09a2ba83f4eaf
7
- data.tar.gz: 287c379896d12f03c440c32afea34a42cad884e024151dd54f124ab70c7516e269963d70c3479fb341e25e3201085f4c1c807c3e5a01732f73ed9651dedd38f9
6
+ metadata.gz: fead7450a8b3b5dd2f7441c62031d6d1b03da1a030cd07711f7d9b8b5fcb33ac629f1b28fc0f6938e3fbee310346e7e30bb92f141058309c384160447b6bc2e7
7
+ data.tar.gz: 78b9a05acc5daaee15b5a0111afd85f66d4aea7a9d3199a7c2719df0fd3e37602e9237cea869e2f4b2822be15997b93d0de3d910c79f22da1484fb8205a540c6
@@ -42,9 +42,12 @@ module RallyAPI
42
42
  @find_threads = 4
43
43
  end
44
44
 
45
- def set_client_user(base_url, user, password)
46
- @rally_http_client.set_auth(base_url, user, password)
47
- @rally_http_client.www_auth.basic_auth.challenge(base_url) #force httpclient to put basic on first req to rally
45
+ def set_auth(auth_info)
46
+ if auth_info[:api_key].nil?
47
+ set_client_user(auth_info[:base_url], auth_info[:username], auth_info[:password])
48
+ else
49
+ set_api_key(auth_info)
50
+ end
48
51
  end
49
52
 
50
53
  def set_ssl_verify_mode(mode = OpenSSL::SSL::VERIFY_NONE)
@@ -124,7 +127,7 @@ module RallyAPI
124
127
  url_params[:key] = @security_token unless @security_token.nil?
125
128
  req_args[:query] = url_params if url_params.keys.length > 0
126
129
 
127
- req_headers = @rally_headers.headers
130
+ req_headers = setup_request_headers
128
131
  if (args[:method] == :post) || (args[:method] == :put)
129
132
  req_headers["Content-Type"] = "application/json"
130
133
  req_headers["Accept"] = "application/json"
@@ -173,6 +176,25 @@ module RallyAPI
173
176
 
174
177
  private
175
178
 
179
+ def setup_request_headers()
180
+ req_headers = @rally_headers.headers
181
+ zsession_c = @rally_http_client.cookies.find {|c| c.name == "ZSESSIONID" }
182
+ if !@api_key.nil? && zsession_c.nil?
183
+ req_headers[:zsessionid] = @api_key
184
+ end
185
+ req_headers
186
+ end
187
+
188
+ def set_client_user(base_url, user, password)
189
+ @rally_http_client.set_auth(base_url, user, password)
190
+ @rally_http_client.www_auth.basic_auth.challenge(base_url) #force httpclient to put basic on first req to rally
191
+ end
192
+
193
+ def set_api_key(auth_info)
194
+ @api_key_url = auth_info[:base_url]
195
+ @api_key = auth_info[:api_key]
196
+ end
197
+
176
198
  def run_threads(query_array)
177
199
  num_threads = @find_threads
178
200
  thr_queries = []
@@ -44,9 +44,9 @@ module RallyAPI
44
44
 
45
45
  #Main Class to instantiate when using the tool
46
46
  class RallyRestJson
47
- DEFAULT_WSAPI_VERSION = "1.42"
47
+ DEFAULT_WSAPI_VERSION = "1.43"
48
48
 
49
- attr_accessor :rally_url, :rally_user, :rally_password, :rally_workspace_name, :rally_project_name, :wsapi_version,
49
+ attr_accessor :rally_url, :rally_workspace_name, :rally_project_name, :wsapi_version,
50
50
  :rally_headers, :rally_default_workspace, :rally_default_project, :low_debug, :proxy_info,
51
51
  :rally_rest_api_compat, :logger, :rally_alias_types
52
52
  attr_reader :rally_connection, :custom_fields_for_type
@@ -54,9 +54,12 @@ module RallyAPI
54
54
  def initialize(args)
55
55
  pre_init()
56
56
 
57
- @rally_url = args[:base_url] || "https://rally1.rallydev.com/slm"
58
- @rally_user = args[:username]
59
- @rally_password = args[:password]
57
+ auth_info = {}
58
+
59
+ auth_info[:base_url] = @rally_url = args[:base_url] || "https://rally1.rallydev.com/slm"
60
+ auth_info[:username] = args[:username]
61
+ auth_info[:password] = args[:password]
62
+ auth_info[:api_key] = args[:api_key]
60
63
  @rally_workspace_name = args[:workspace]
61
64
  @rally_project_name = args[:project]
62
65
  @wsapi_version = args[:version] || DEFAULT_WSAPI_VERSION
@@ -71,10 +74,11 @@ module RallyAPI
71
74
  @logger = args[:logger] || nil #assumes this is an instance of Logger
72
75
 
73
76
  @rally_connection = RallyJsonConnection.new(@rally_headers, @low_debug, @proxy_info)
74
- @rally_connection.set_client_user(@rally_url, @rally_user, @rally_password)
77
+ #@rally_connection.set_client_user(@rally_url, @rally_user, @rally_password)
78
+ @rally_connection.set_auth(auth_info)
75
79
  @rally_connection.logger = @logger unless @logger.nil?
76
80
 
77
- if @wsapi_version.to_s.include?("v2.") && !@skip_sec_key
81
+ if @wsapi_version.to_s.include?("v2.") && !@skip_sec_key && auth_info[:api_key].nil?
78
82
  @rally_connection.setup_security_token(security_url)
79
83
  end
80
84
 
@@ -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.25"
7
+ VERSION = "1.0.0"
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rally_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.25
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-06 00:00:00.000000000 Z
11
+ date: 2014-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -28,70 +28,70 @@ dependencies:
28
28
  name: simplecov
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cucumber
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: aruba
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: API wrapper for Rally's JSON REST web services api
@@ -123,17 +123,17 @@ require_paths:
123
123
  - lib
124
124
  required_ruby_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - ! '>='
126
+ - - '>='
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - ! '>='
131
+ - - '>='
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project: rally_api
136
- rubygems_version: 2.1.9
136
+ rubygems_version: 2.0.3
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: A wrapper for the Rally Web Services API using json