Skip to content

Comments

MWS.orders.next don`t clear last request next_token#6

Open
wppurking wants to merge 1 commit intoelyngved:masterfrom
wppurking:master
Open

MWS.orders.next don`t clear last request next_token#6
wppurking wants to merge 1 commit intoelyngved:masterfrom
wppurking:master

Conversation

@wppurking
Copy link

In api/base.rb:50.

If i need 2 request to get all orders, after success run one times mws.orders.next even the last request do not return a 'next_token' the @next[:token] will persist the last request`s token, code like below will loop forever.

save_or_update_orders(response.orders)
while mws.orders.has_next?
  puts 'into next page...'
  save_or_update_orders(mws.orders.next.orders)
end

Because if next reponse do not have next_token then

if @response.respond_to?(:next_token) and @next[:token] = @response.next_token

will not execute @next[:token] = ...

pierrel referenced this pull request in blurb/ruby-mws Mar 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant