Class: ServiceNow::Collection
- Inherits:
-
Object
- Object
- ServiceNow::Collection
- Defined in:
- lib/servicenow/collection.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(response) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(response) ⇒ Collection
Returns a new instance of Collection.
7 8 9 10 |
# File 'lib/servicenow/collection.rb', line 7 def initialize(response) @results = (response.body["result"] || []).map { |r| Result.new r } @total = response.headers["x-total-count"] || @results.size end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
3 4 5 |
# File 'lib/servicenow/collection.rb', line 3 def results @results end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
3 4 5 |
# File 'lib/servicenow/collection.rb', line 3 def total @total end |