Class: RallyAPI::RallyQueryResult
- Inherits:
-
Object
- Object
- RallyAPI::RallyQueryResult
- Includes:
- Enumerable
- Defined in:
- lib/rally_api/rally_query_result.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
for compatiblity with code using rally_rest_api.
-
#total_result_count ⇒ Object
readonly
Returns the value of attribute total_result_count.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(rally_rest, json_results, warnings = {}) ⇒ RallyQueryResult
constructor
A new instance of RallyQueryResult.
- #length ⇒ Object
- #total_results ⇒ Object
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
#results ⇒ Object (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_count ⇒ Object (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 |
#warnings ⇒ Object (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 |
#each ⇒ Object
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
38 39 40 |
# File 'lib/rally_api/rally_query_result.rb', line 38 def empty? length == 0 end |
#length ⇒ Object
34 35 36 |
# File 'lib/rally_api/rally_query_result.rb', line 34 def length @results.length end |
#total_results ⇒ Object
30 31 32 |
# File 'lib/rally_api/rally_query_result.rb', line 30 def total_results @total_result_count end |