Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

wasn't paginating correctly

  • Loading branch information...
commit ee67e4d378b7c6a95627af60c87afcc2ffaddcdd 1 parent 131112d
@michaelglass michaelglass authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/shopify-api-limits/shopify_api/base.rb
View
7 lib/shopify-api-limits/shopify_api/base.rb
@@ -1,10 +1,11 @@
+require 'active_resource'
##
# Redefines #find_every to automatically compose resultsets from multiple ShopifyAPI queries due to API limit of 250 records / request.
# Seemlessly stitches all requests to #all, #find(:all), etc, as if there were no LIMIT.
# @see http://wiki.shopify.com/Retrieving_more_than_250_Products%2C_Orders_etc.
#
module ShopifyAPI
- class Base
+ class Base < ActiveResource::Base
SHOPIFY_API_MAX_LIMIT = 250
class << self
@@ -28,9 +29,11 @@ class << self
raise ShopifyAPI::Limits::Error.new if ShopifyAPI.credit_maxed?
# Iterate from 1 -> max-pages and call the original #find_every, capturing the responses into one list
+
rs = []
1.upto(pages) {|page|
- rs.concat find_every.bind(self).call(options[:params].update(:page => page))
+ options[:params].update(page: page)
+ rs.concat find_every.bind(self).call(options)
}
rs
end
Please sign in to comment.
Something went wrong with that request. Please try again.