Class: RallyAPI::RallyQueryResult

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rally_api/rally_query_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rally_rest, json_results, warnings = {}) ⇒ RallyQueryResult

Returns a new instance of RallyQueryResult.



13
14
15
16
17
18
# File 'lib/rally_api/rally_query_result.rb', line 13

def initialize(rally_rest, json_results, warnings={})
  @results            = json_results["QueryResult"]["Results"]
  @total_result_count = json_results["QueryResult"]["TotalResultCount"]
  @rally_rest         = rally_rest
  @warnings           = warnings[:warnings]
end

Instance Attribute Details

#resultsObject (readonly)

for compatiblity with code using rally_rest_api



42
43
44
# File 'lib/rally_api/rally_query_result.rb', line 42

def results
  @results
end

#total_result_countObject (readonly)

Returns the value of attribute total_result_count.



11
12
13
# File 'lib/rally_api/rally_query_result.rb', line 11

def total_result_count
  @total_result_count
end

#warningsObject (readonly)

Returns the value of attribute warnings.



11
12
13
# File 'lib/rally_api/rally_query_result.rb', line 11

def warnings
  @warnings
end

Instance Method Details

#[](index) ⇒ Object



26
27
28
# File 'lib/rally_api/rally_query_result.rb', line 26

def [](index)
  RallyObject.new(@rally_rest, @results[index])
end

#eachObject



20
21
22
23
24
# File 'lib/rally_api/rally_query_result.rb', line 20

def each
  @results.each do |result|
    yield RallyObject.new(@rally_rest, result)
  end
end

#empty?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/rally_api/rally_query_result.rb', line 38

def empty?
  length == 0
end

#lengthObject



34
35
36
# File 'lib/rally_api/rally_query_result.rb', line 34

def length
  @results.length
end

#total_resultsObject



30
31
32
# File 'lib/rally_api/rally_query_result.rb', line 30

def total_results
  @total_result_count
end