Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 2014_1 wsdl, make search results work when there is only a single result on a page #82

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions lib/netsuite/support/search_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ def initialize(response, result_class)
if response.body.has_key?(:record_list)
# basic search results
record_list = response.body[:record_list][:record]
record_list = [record_list] if @total_records == 1
record_list = [record_list] unless record_list.is_a?(Array)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious... why was this needed? What situation broke the existing implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you have more than one page of items and the last page has only a single item.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, got it. Nice catch! Merged this into master.


record_list.each do |record|
results << result_class.new(record)
end
elsif response.body.has_key? :search_row_list
# advanced search results
record_list = response.body[:search_row_list][:search_row]
record_list = [record_list] if @total_records == 1
record_list = [record_list] unless record_list.is_a?(Array)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what case this did this occur?

record_list.each do |record|
# TODO because of customFieldList we need to either make this recursive
Expand Down
Loading