lib/zendesk2/paged_collection.rb in zendesk2-0.0.5 vs lib/zendesk2/paged_collection.rb in zendesk2-0.0.6
- old
+ new
@@ -1,10 +1,11 @@
module Zendesk2::PagedCollection
def self.included(klass)
klass.send(:attribute, :count)
klass.send(:attribute, :next_page_link, {:aliases => "next_page"})
klass.send(:attribute, :previous_page_link, {:aliases => "previous_page"})
+ klass.send(:include, Zendesk2::Errors)
klass.send(:extend, Zendesk2::PagedCollection::Attributes)
end
def collection_method; self.class.collection_method; end
def collection_root; self.class.collection_root; end
@@ -21,9 +22,11 @@
def get(id)
if data = self.connection.send(model_method, {"id" => id}).body[self.model_root]
new(data)
end
+ rescue Zendesk2::Error
+ nil
end
def next_page
all("url" => next_page_link) if next_page_link
end