Skip to content

Commit

Permalink
PR ruckus#592 patch to our local fork
Browse files Browse the repository at this point in the history
  • Loading branch information
vanboom committed Jan 19, 2023
1 parent c908c87 commit b42db9f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/quickbooks/service/base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ def url_for_query(query = nil, start_position = 1, max_results = 20, options = {
query ||= default_model_query
query = "#{query} STARTPOSITION #{start_position} MAXRESULTS #{max_results}"

"#{url_for_base}/query?query=#{CGI.escape(query)}"
URI("#{url_for_base}/query").tap do |uri|
params = Faraday::Utils::ParamsHash.new
params.update(options.merge(query: query))
uri.query = params.to_query
end.to_s
end

private
Expand Down Expand Up @@ -116,7 +120,7 @@ def fetch_collection(query, model, options = {})
start_position = ((page - 1) * per_page) + 1 # page=2, per_page=10 then we want to start at 11
max_results = per_page

response = do_http_get(url_for_query(query, start_position, max_results))
response = do_http_get(url_for_query(query, start_position, max_results, options.except(:page, :per_page)))

parse_collection(response, model)
end
Expand Down

0 comments on commit b42db9f

Please sign in to comment.