Closed hdrsh closed 8 years ago
You need to pass the order ids as a splat, with no brackets:
order.get_order("XXX-9942539-XXXXXXX", "XXX-8276410-XXXXXXX")
Admittedly, the documentation is not clear, and I'm not quite sure how to express a splat in Yardoc. I'll revisit this later.
Thanks! Just one more thing - the splat works, but while 'response' has info for all 50 orders, once it's parsed, only the first order seems to show.
I can't reproduce this. See above commit, which has a test case that confirms the method works with multiple order IDs. Perhaps the code helps you locate something wrong on your side.
I don't know if it's related to what hdrsh is reporting, but when I use parse to parse the orders returned by list_orders, all orders are parsed as 1 order.
When I use orders.count the value is always 2 no matter how many orders were returned. ["CreatedBefore", "2016-01-22T17:33:26Z"] appears to be what is being counted as the second order.
Which XML backend (if any) are you using? If not sure, could you post here your Gemfile.lock?
Although the test script I'm playing with lives in a rails directory, I'm currently only running it from the command prompt on a windows pc.
The gemfile.lock contains the following data:
GIT remote: git://github.com/bernat/best_in_place.git revision: 57b525e487cd6ba10467b47d8bf8907c645f6917 specs: best_in_place (3.1.0) actionpack (>= 3.2) railties (>= 3.2)
GEM remote: https://rubygems.org/ specs: actionmailer (4.2.2) actionpack (= 4.2.2) actionview (= 4.2.2) activejob (= 4.2.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) actionpack (4.2.2) actionview (= 4.2.2) activesupport (= 4.2.2) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.1) actionview (4.2.2) activesupport (= 4.2.2) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.1) activejob (4.2.2) activesupport (= 4.2.2) globalid (>= 0.3.0) activemodel (4.2.2) activesupport (= 4.2.2) builder (~> 3.1) activerecord (4.2.2) activemodel (= 4.2.2) activesupport (= 4.2.2) arel (~> 6.0) activesupport (4.2.2) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) bcrypt (3.1.10-x86-mingw32) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.2.2) coffee-rails (4.1.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.1.x) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.10.0) concurrent-ruby (1.0.0) debug_inspector (0.0.2) devise (3.5.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) responders thread_safe (~> 0.1) warden (~> 1.2.3) erubis (2.7.0) excon (0.45.4) execjs (2.6.0) globalid (0.3.6) activesupport (>= 4.1.0) i18n (0.7.0) jbuilder (2.4.0) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) jeff (1.5.1) excon (>= 0.22.1) jquery-rails (4.1.0) rails-dom-testing (~> 1.0) railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.3) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.3) mime-types (>= 1.16, < 3) mime-types (2.99) mini_portile2 (2.0.0) minitest (5.8.3) multi_json (1.11.2) multi_xml (0.5.5) nokogiri (1.6.7.1-x86-mingw32) mini_portile2 (~> 2.0.0.rc2) orm_adapter (0.5.0) peddler (1.3.0) jeff (~> 1.3) multi_xml (~> 0.5.0) pg (0.18.4-x86-mingw32) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) rails (4.2.2) actionmailer (= 4.2.2) actionpack (= 4.2.2) actionview (= 4.2.2) activejob (= 4.2.2) activemodel (= 4.2.2) activerecord (= 4.2.2) activesupport (= 4.2.2) bundler (>= 1.3.0, < 2.0) railties (= 4.2.2) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) rails-dom-testing (1.0.7) activesupport (>= 4.2.0.beta, < 5.0) nokogiri (~> 1.6.0) rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.2) loofah (~> 2.0) railties (4.2.2) actionpack (= 4.2.2) activesupport (= 4.2.2) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.5.0) rdoc (4.2.1) json (~> 1.4) responders (2.1.0) railties (>= 4.2.0, < 5) sass (3.4.21) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) sprockets (3.5.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.0.0) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) thor (0.19.1) thread_safe (0.3.5) tilt (2.0.2) turbolinks (2.5.3) coffee-rails tzinfo (1.2.2) thread_safe (~> 0.1) tzinfo-data (1.2015.7) tzinfo (>= 1.0.0) uglifier (2.7.2) execjs (>= 0.3.0) json (>= 1.8.0) warden (1.2.4) rack (>= 1.0) web-console (2.2.1) activemodel (>= 4.0) binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0)
PLATFORMS x86-mingw32
DEPENDENCIES best_in_place! coffee-rails (~> 4.1.0) devise jbuilder (~> 2.0) jquery-rails nokogiri peddler pg rails (= 4.2.2) sass-rails (~> 5.0) sdoc (~> 0.4.0) turbolinks tzinfo-data uglifier (>= 1.3.0) web-console (~> 2.0)
BUNDLED WITH 1.10.6
No luck. My hunch that it may have to do with the parsing backend (Nokogiri, in your case) is unfounded. If you run this test, you'll see that it parses multiple orders correctly.
I'm out of ideas for now.
Thank you for trying. I meant to mention that I didn't install Nokogiri until after the peddler parser had failed. I started using Nokogiri to parse the data once the orders had been downloaded.
I apologize if this is the wrong place to ask this question, but how should list_orders_by_next_token be called, particularly when there are multiple pages? Unless I create a new client I receive a 400 error.
I'm not sure why, but after re-running 'bundle install' everything started to work.
I apologize if this is the wrong place to ask this question, but how should list_orders_by_next_token be called, particularly when there are multiple pages? Unless I create a new client I receive a 400 error.
You shouldn't need to create a new client. You just pass the next token from the previous response to the query.
# parser = client.list_orders(...)
client.list_orders_by_next_token(parser.next_token)
response = order.get_order(["XXX-9942539-XXXXXXX", "XXX-8276410-XXXXXXX"]) order_info = response.parse puts order_info
=> Returns nil (where it works for single orders)
The documentation says it can take upto 50 orders as input