lib/zendesk2/paged_collection.rb in zendesk2-1.8.1 vs lib/zendesk2/paged_collection.rb in zendesk2-1.9.0
- old
+ new
@@ -19,11 +19,11 @@
def collection_root; self.class.collection_root; end
def model_method; self.class.model_method; end
def model_root; self.class.model_root; end
def new_page
- page = self.class.new(service: self.service)
+ page = self.class.new(cistern: self.cistern)
page.merge_attributes(self.class.scopes.inject({}){|r,k| r.merge(k.to_s => send(k))})
page
end
def each_page
@@ -127,11 +127,11 @@
scoped_attributes.merge!("id" => identity_or_hash)
end
scoped_attributes = { model_root => scoped_attributes }
- if data = self.service.send(model_method, scoped_attributes).body[self.model_root]
+ if data = self.cistern.send(model_method, scoped_attributes).body[self.model_root]
new(data)
end
end
# Quiet version of {#get!}
@@ -157,10 +157,10 @@
search(query.delete("query"), query)
end
def collection_page(params)
scoped_attributes = self.class.scopes.inject({}) { |r, k| r.merge(k.to_s => send(k)) }.merge(params)
- body = service.send(collection_method, scoped_attributes).body
+ body = cistern.send(collection_method, scoped_attributes).body
self.load(body[collection_root]) # 'results' is the key for paged seraches
self.merge_attributes(Cistern::Hash.slice(body, "count", "next_page", "previous_page"))
end
end