ruckus / quickbooks-ruby

Quickbooks Online REST API V3 - Ruby
MIT License
374 stars 302 forks source link

Quickbooks::IntuitRequestException: Error parsing query #471

Closed Palpandi-Ramar closed 5 years ago

Palpandi-Ramar commented 5 years ago

Hi There,

Thanks for building the quickbooks-ruby. It was awesome.

I have a little parsing error while fetching the vendor from quickbooks. the company name and display name both are contains single quote. How do i handle this in quickbooks-ruby.

service.find_by(:display_name, "Aido's LLC")

Error message shows Quickbooks::IntuitRequestException: Error parsing query: QueryParserError: Encountered " "s "" at line 1, column 48. Was expecting one of:

... "iterator" ... "maxresults" ... ... "order" ... "orderby" ... "startposition" ..
ruckus commented 5 years ago

Have a look at the query building interface to properly escape input:

https://github.com/ruckus/quickbooks-ruby#query-building--filtering

Palpandi-Ramar commented 5 years ago

Thank you.

legacy370 commented 1 year ago

I'm glad your code is so readable. My query was bombing on something like O'Keefe. Since I already had @customer_service.find_by(:display_name, family.formal_name)

I used the code in your utility class to replace it with

escaped_name = family.formal_name.gsub("'", "\\\\'")
@customer_service.find_by(:display_name, escaped_name)