lib/zendesk2/paged_collection.rb in zendesk2-0.0.4 vs lib/zendesk2/paged_collection.rb in zendesk2-0.0.5

- old
+ new

@@ -12,15 +12,16 @@ def model_root; self.class.model_root; end def all(params={}) body = connection.send(collection_method, params).body - load(body[collection_root]) - merge_attributes(Cistern::Hash.slice(body, "count", "next_page", "previous_page")) + collection = self.clone.load(body[collection_root]) + collection.merge_attributes(Cistern::Hash.slice(body, "count", "next_page", "previous_page")) + collection end def get(id) - if data = connection.send(model_method, {"id" => id}).body[self.model_root] + if data = self.connection.send(model_method, {"id" => id}).body[self.model_root] new(data) end end def next_page