rally_api 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -32,8 +32,14 @@ RallyAPI is a wrapper of Rally's Web Service API Json endpoints using rest-clien
32
32
 
33
33
 
34
34
  === Querying Rally
35
+
36
+ #type names are stored in rally.rally_objects hash, you can inspect there for a list
37
+ #Look at the TypePath for all typedefs and this is the key to each hash.
38
+ #If you pass in a symbol (for code using versions prior to 0.7.3), it will be downcased and turned into a string
39
+ # examples are: "defect", "hierarchicalrequirement", "portfolioitem/feature"
40
+
35
41
  test_query = RallyAPI::RallyQuery.new()
36
- test_query.type = :defect
42
+ test_query.type = "defect"
37
43
  test_query.fetch = "Name"
38
44
  test_query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/1.25/workspace/12345.js" } #optional
39
45
  test_query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/1.25/project/12345.js" } #optional
@@ -56,16 +62,16 @@ RallyAPI is a wrapper of Rally's Web Service API Json endpoints using rest-clien
56
62
 
57
63
  #for people comfortable passing around blocks:
58
64
  results = @rally.find do |q|
59
- q.type = :defect
65
+ q.type = "defect"
60
66
  q.fetch = "Name,FormattedID"
61
67
  q.query_string = "(Priority = \"Low\")"
62
68
  end
63
69
 
64
70
 
65
71
  === Reading an Artifact
66
- defect = @rally.read(:defect, 12345) #by ObjectID
72
+ defect = @rally.read("defect", 12345) #by ObjectID
67
73
  #or
68
- defect = @rally.read(:defect, "FormattedID|DE42") #by FormattedID
74
+ defect = @rally.read("defect", "FormattedID|DE42") #by FormattedID
69
75
  #or if you already have an object like from a query
70
76
  results = @rally.find(RallyAPI::RallyQuery.new({:type => :defect, :query_string => "(FormattedID = DE42)"}))
71
77
  defect = results.first
@@ -85,25 +91,25 @@ RallyAPI is a wrapper of Rally's Web Service API Json endpoints using rest-clien
85
91
  === Creating an Artifact
86
92
  obj = {}
87
93
  obj["Name"] = "Test Defect created #{DateTime.now()}"
88
- new_de = @rally.create(:defect, obj)
94
+ new_de = @rally.create("defect", obj)
89
95
  puts new_de["FormattedID"]
90
96
 
91
97
  === Updating an Artifact
92
98
  fields = {}
93
99
  fields["Severity"] = "Critical"
94
100
  fields["Description"] = "Description for the issue"
95
- updated_defect = @rally.update(:defect, 12345, fields) #by ObjectID
101
+ updated_defect = @rally.update("defect", 12345, fields) #by ObjectID
96
102
  #or
97
- updated_defect = @rally.update(:defect, "FormattedID|DE42", fields) #by FormattedID
103
+ updated_defect = @rally.update("defect", "FormattedID|DE42", fields) #by FormattedID
98
104
  # or
99
- defect = @rally.read(:defect, 12345) #by lookup then udpating via the object
105
+ defect = @rally.read("defect", 12345) #by lookup then udpating via the object
100
106
  field_updates = {"Description" => "Changed Description"}
101
107
  defect.update(field_updates)
102
108
 
103
109
  === Utils
104
110
  #allowed values: pass the Artifact type string or downcased symbol and the Display Name of the field
105
111
  @rally.allowed_values("Defect", "Severity")
106
- @rally.allowed_values(:story, "ScheduleState")
112
+ @rally.allowed_values("story", "ScheduleState")
107
113
 
108
114
  #re-ranking: rank_above and rank_below
109
115
  story1.rank_above(story2) #in a drag and drop workspace move story1 relative to story2
@@ -22,7 +22,7 @@ module RallyAPI
22
22
  @os = RUBY_PLATFORM
23
23
  @platform = "Ruby #{RUBY_VERSION}"
24
24
  @library = "RallyRestJson version #{RallyAPI::VERSION}"
25
- @name = "RallyRestJson"
25
+ @name = "RallyRestJsonRuby"
26
26
 
27
27
  if custom_vals.keys.length > 0
28
28
  @name = custom_vals[:name]
@@ -40,6 +40,11 @@ module RallyAPI
40
40
  get_val(field_name)
41
41
  end
42
42
 
43
+ def []=(field_name, value)
44
+ return if field_name.nil?
45
+ @rally_object[field_name] = value
46
+ end
47
+
43
48
  def read(params = nil)
44
49
  @rally_object = @rally_rest.reread(@rally_object, params)
45
50
  self
@@ -74,7 +74,7 @@ module RallyAPI
74
74
  errors.push("Project - #{@project} - must have a ref") if @project["_ref"].nil?
75
75
  end
76
76
 
77
- if (allowed_objects[@type].nil?)
77
+ if (allowed_objects[@type.to_s].nil?)
78
78
  errors.push( "Object Type #{@type} is not query-able: inspect RallyRestJson.rally_objects for allowed types" )
79
79
  end
80
80
 
@@ -84,7 +84,7 @@ module RallyAPI
84
84
  private
85
85
 
86
86
  def parse_query_hash(query_hash)
87
- @type = query_hash[:type]
87
+ @type = query_hash[:type].to_s
88
88
  @query_string = query_hash[:query_string]
89
89
  @fetch = query_hash[:fetch]
90
90
  @project_scope_down = query_hash[:project_scope_down]
@@ -71,8 +71,8 @@ module RallyAPI
71
71
  @rally_connection.set_client_user(@rally_url, @rally_user, @rally_password)
72
72
  @rally_connection.logger = @logger unless @logger.nil?
73
73
 
74
- @rally_objects = { :typedefinition => "TypeDefinition", :user => "User", :subscription => "Subscription",
75
- :workspace => "Workspace", :project => "Project" }
74
+ @rally_objects = { "typedefinition" => "TypeDefinition", "user" => "User", "subscription" => "Subscription",
75
+ "workspace" => "Workspace", "project" => "Project" }
76
76
 
77
77
  if !@rally_workspace_name.nil?
78
78
  @rally_default_workspace = find_workspace(@rally_workspace_name)
@@ -131,7 +131,7 @@ module RallyAPI
131
131
 
132
132
  def user
133
133
  args = { :method => :get }
134
- json_response = @rally_connection.send_request(make_get_url(@rally_objects[:user]), args)
134
+ json_response = @rally_connection.send_request(make_get_url(@rally_objects["user"]), args)
135
135
  rally_type = json_response.keys[0]
136
136
  RallyObject.new(self, json_response[rally_type])
137
137
  end
@@ -278,12 +278,12 @@ module RallyAPI
278
278
  #todo - check support for portfolio item fields
279
279
  def allowed_values(type, field)
280
280
  if type.class == Symbol
281
- query_type = @rally_objects[type]
281
+ query_type = @rally_objects[type.to_s]
282
282
  else
283
283
  query_type = type
284
284
  end
285
285
  type_defs_query = RallyQuery.new()
286
- type_defs_query.type = :typedefinition
286
+ type_defs_query.type = "typedefinition"
287
287
  type_defs_query.fetch = true
288
288
  type_defs_query.query_string= "(ElementName = \"#{query_type}\")"
289
289
  type_defs = find(type_defs_query)
@@ -324,10 +324,11 @@ module RallyAPI
324
324
  end
325
325
 
326
326
  def check_type(type_name)
327
- if @rally_objects[type_name].nil?
327
+ type = @rally_objects[type_name.to_s]
328
+ if type.nil?
328
329
  raise StandardError, "The object type #{type_name} is not valid for the wsapi"
329
330
  end
330
- @rally_objects[type_name].gsub(" ", "") #for wsapi no space is expected
331
+ type.gsub(" ", "") #for wsapi no space is expected
331
332
  end
332
333
 
333
334
  #ref should be like https://rally1.rallydev.com/slm/webservice/1.25/defect/12345.js
@@ -353,7 +354,7 @@ module RallyAPI
353
354
 
354
355
  def ref_by_formatted_id(type, fid)
355
356
  query = RallyQuery.new()
356
- query.type = type.downcase.to_sym
357
+ query.type = type.downcase
357
358
  query.query_string = "(FormattedID = #{fid})"
358
359
  query.limit = 20
359
360
  query.fetch = "FormattedID"
@@ -378,32 +379,29 @@ module RallyAPI
378
379
  fields
379
380
  end
380
381
 
381
-
382
382
  def cache_rally_objects()
383
383
  type_defs_query = RallyQuery.new()
384
- type_defs_query.type = :typedefinition
384
+ type_defs_query.type = "typedefinition"
385
385
  type_defs_query.fetch = "Name,Parent,TypePath"
386
386
  type_defs_query.workspace = @rally_default_workspace unless @rally_default_workspace.nil?
387
387
 
388
388
  type_defs = find(type_defs_query)
389
389
  type_defs.each do |td|
390
- type_sym = td.Name.downcase.gsub(" ", "").to_sym
391
- url_path = td.TypePath.nil? ? td.Name : td.TypePath
392
- @rally_objects[type_sym] = url_path
390
+ url_path = td.TypePath.nil? ? td.ElementName : td.TypePath
391
+ @rally_objects[url_path.downcase] = url_path
393
392
 
394
393
  parent_type = td.Parent
395
- if !parent_type.nil? && (@rally_objects[parent_type.Name].nil?)
396
- url_path = parent_type.TypePath.nil? ? parent_type.Name : parent_type.TypePath
397
- @rally_objects[parent_type.Name.downcase.gsub(" ", "").to_sym] = url_path
394
+ if !parent_type.nil? && (@rally_objects[parent_type.TypePath].nil?)
395
+ url_path = parent_type.TypePath.nil? ? parent_type.ElementName : parent_type.TypePath
396
+ @rally_objects[url_path.downcase] = url_path
398
397
  end
399
398
  end
400
399
 
401
400
  #some convenience keys to help people - someday we'll fix the api and make HR called story
402
- @rally_objects[:useriterationcapacity] = "User Iteration Capacity"
403
- @rally_objects[:userpermission] = "User Permission"
404
- @rally_objects[:story] = "Hierarchical Requirement"
405
- @rally_objects[:userstory] = "Hierarchical Requirement"
406
-
401
+ @rally_objects["useriterationcapacity"] = "User Iteration Capacity"
402
+ @rally_objects["userpermission"] = "User Permission"
403
+ @rally_objects["story"] = "Hierarchical Requirement"
404
+ @rally_objects["userstory"] = "Hierarchical Requirement"
407
405
  end
408
406
 
409
407
  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.2"
7
+ VERSION = "0.7.3"
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.2
4
+ version: 0.7.3
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-16 00:00:00.000000000Z
12
+ date: 2012-10-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient
16
- requirement: &70183353654620 !ruby/object:Gem::Requirement
16
+ requirement: &70253413466180 !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: *70183353654620
24
+ version_requirements: *70253413466180
25
25
  description: API wrapper for Rally's JSON REST web services api
26
26
  email:
27
27
  - dsmith@rallydev.com