Class: ServiceNow::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/servicenow/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#resultsObject (readonly)

Returns the value of attribute results.



3
4
5
# File 'lib/servicenow/collection.rb', line 3

def results
  @results
end

#totalObject (readonly)

Returns the value of attribute total.



3
4
5
# File 'lib/servicenow/collection.rb', line 3

def total
  @total
end