Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
Add flag to exit with only a single batch of search results
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesChristie committed Dec 23, 2013
1 parent 8403751 commit 9c8e2d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/netsuite-rest-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def search_records(record_type, search_filters, return_columns, options={})
results_segment, payload['start_id'] = *parse_json_result_from_rest(:post, params, :payload=>payload)
results += results_segment unless results_segment.empty?
puts "Fetched #{results.count} records so far, querying from #{payload['start_id']}..." if options[:verbose]
end while (results_segment.length == payload['batch_size'].to_i)
end while (results_segment.length == payload['batch_size'].to_i) && !options[:exit_after_first_batch]

results
end
Expand Down Expand Up @@ -177,7 +177,7 @@ def get_saved_search(record_type, search_id, options={})
results_segment, params['start_id'] = *parse_json_result_from_rest(:get, params)
results_segment.class == Array ? results += results_segment : raise("Search error: #{results_segment}")
puts "Fetched #{results.count} records so far, querying from #{params['start_id']}..." if options[:verbose]
end while (results_segment.length == params['batch_size'].to_i)
end while (results_segment.length == params['batch_size'].to_i) && !options[:exit_after_first_batch]

results
end
Expand Down

0 comments on commit 9c8e2d4

Please sign in to comment.