Class: HaveAPI::Client::ResourceInstanceList
- Inherits:
-
Array
- Object
- Array
- HaveAPI::Client::ResourceInstanceList
- Defined in:
- lib/haveapi/client/resource_instance_list.rb
Overview
A list of ResourceInstance objects.
Instance Method Summary collapse
-
#api_response ⇒ Object
Return the API response that created this object.
-
#initialize(client, api, resource, action, response) ⇒ ResourceInstanceList
constructor
A new instance of ResourceInstanceList.
- #meta ⇒ Object
-
#total_count ⇒ Object
Return the total count of items.
Constructor Details
#initialize(client, api, resource, action, response) ⇒ ResourceInstanceList
Returns a new instance of ResourceInstanceList.
4 5 6 7 8 9 10 11 |
# File 'lib/haveapi/client/resource_instance_list.rb', line 4 def initialize(client, api, resource, action, response) super() @response = response response.response.each do |hash| self << ResourceInstance.new(client, api, resource, action: action, response: hash) end end |
Instance Method Details
#api_response ⇒ Object
Return the API response that created this object.
14 15 16 |
# File 'lib/haveapi/client/resource_instance_list.rb', line 14 def api_response @response end |
#meta ⇒ Object
18 19 20 |
# File 'lib/haveapi/client/resource_instance_list.rb', line 18 def @response. end |
#total_count ⇒ Object
Return the total count of items. Note that for this method to work, the action that returns this object list must be invoked with meta: {count: true}, otherwise the object count is not sent.
26 27 28 |
# File 'lib/haveapi/client/resource_instance_list.rb', line 26 def total_count [:total_count] end |