Skip to content

Instantly share code, notes, and snippets.

@kannan4k
Last active August 29, 2015 14:25
Show Gist options
  • Save kannan4k/62c0e455f83ba6016eaf to your computer and use it in GitHub Desktop.
Save kannan4k/62c0e455f83ba6016eaf to your computer and use it in GitHub Desktop.
def load_next_batch
response = self.bridge.next_batch(self.url, self.name, self.options, self.is_singleton)
puts "Self.model"
puts self.model
batch = response[:items]
self.has_more = !self.is_singleton && response[:has_more]
if self.is_singleton
self.loaded = [ self.model.from_raw(batch, self.cache, response[:supplemental] || {}) ]
else
self.loaded += batch.map { |o| self.model.from_raw(o, self.cache, response[:supplemental] || {}) }
end
batch != [] && batch != {}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment