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 |
# File 'lib/haveapi/client/resource_instance_list.rb', line 4 def initialize(client, api, resource, action, response) @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.
13 14 15 |
# File 'lib/haveapi/client/resource_instance_list.rb', line 13 def api_response @response end |
#meta ⇒ Object
17 18 19 |
# File 'lib/haveapi/client/resource_instance_list.rb', line 17 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.
25 26 27 |
# File 'lib/haveapi/client/resource_instance_list.rb', line 25 def total_count [:total_count] end |