ruckus / quickeebooks

ABANDONED !!!! Quickbooks + Ruby using the Quickbooks Online v2 Data Services REST API
MIT License
79 stars 67 forks source link

Windows ServiceBase ignores filters? #31

Closed MattRogish closed 11 years ago

MattRogish commented 11 years ago

I was trying to debug an issue in production and I noticed that QBD seems to ignore filters in service_base.rb:88 in #fetch_collection?

https://github.com/ruckus/quickeebooks/blob/master/lib/quickeebooks/windows/service/service_base.rb#L88

Is there a reason for that? I don't know enough about the Desktop API, but it would seem like it shouldn't be too difficult (I'll give it a try if it's not impossible to do).

Thanks!

Matt

MattRogish commented 11 years ago

Huh. It also looks like it ignores basically everything - per page, chunk_size, etc. https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0500_QuickBooks_Windows/0100_Calling_Data_Services/0015_Retrieving_Objects#Paging

Shall I take a stab at it?

Matt

ruckus commented 11 years ago

Yes its totally not implemented in Windows API.

The existing filters approach is only for Online API, which are basically just key/value pairs then joined to make a standard url-encoded post body params.

The filtering for Windows API according to your link:

https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0500_QuickBooks_Windows/0100_Calling_Data_Services/0015_Retrieving_Objects#Paging

Are done in the XML building:

2010-10-24 2012-07-14

Which looking at it again are kind of "key/value" pair. It should be pretty straight-forward to take a similar approach to the Quickeebooks Filter object model which accepts a known type (string, number, date/time, etc) and a "name" and then just calls to_xml on it which formats the data type and returns the appropriate XML snippet, something like

filter = Filter.new("StartTransactionDate", Date.civil(2013, 1, 28) filter.to_xml => "2013-01-28"

If you want to take a stab at this it would be much appreciated!

On Feb 22, 2013, at 1:01 PM, Matt Rogish notifications@github.com wrote:

Huh. It also looks like it ignores basically everything - per page, chunk_size, etc. https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0500_QuickBooks_Windows/0100_Calling_Data_Services/0015_Retrieving_Objects#Paging

Shall I take a stab at it?

Matt

— Reply to this email directly or view it on GitHub.

MattRogish commented 11 years ago

Hi Cody,

I've been working on this, but I'm having some trouble parsing their developer documentation. For the "Equals" case, it seems pretty clear that you just specify the attribute plus a value in the query, e.g.

<Amount>40.00</Amount>

Would return Invoices that had $40.00 amounts. Not super useful, but, should work.

Where I'm getting confused is the greater than or less than cases.

The docs specify: Specified as an XML query element, for example:

<CustomerQuery xmlns="http://www.intuit.com/sb/cdm/v2"> <MinimumBalance>100.00</MinimumBalance> </CustomerQuery>

But then the XSD http://services.intuit.com/sb/dataservices/xsd/v2/common/RestDataFilter.xsd suggests it's not supported on arbitrary attributes, but a handful of attributes that they have setup matchers for (search for "Minimum" and you'll see what I mean).

Am I reading that right? For a customer, I can't do a query of Balance < $40.00, just "MinimumBalance 40" (e.g. Balance >= $40) ?

Thanks,

Matt

ruckus commented 11 years ago

So this is the first time I've looked into this as well, and of course the Intuit docs leave a lot to be desired.

Looking at the query attributes for an Invoice:

https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0500_QuickBooks_Windows/0600_Object_Reference/Invoice

I see the "MinimumBalance" you're referring to. Yeah it looks like there is no way to get a "MaximumBalance" - minimum only.

Looks like we're hosed on this one.

On Feb 25, 2013, at 1:56 PM, Matt Rogish notifications@github.com wrote:

Hi Cody,

I've been working on this, but I'm having some trouble parsing their developer documentation. For the "Equals" case, it seems pretty clear that you just specify the attribute plus a value in the query, e.g.

40.00

Would return Invoices that had $40.00 amounts. Not super useful, but, should work.

Where I'm getting confused is the greater than or less than cases.

The docs specify: Specified as an XML query element, for example:

100.00

But then the XSD http://services.intuit.com/sb/dataservices/xsd/v2/common/RestDataFilter.xsd suggests it's not supported on arbitrary attributes, but a handful of attributes that they have setup matchers for (search for "Minimum" and you'll see what I mean).

Am I reading that right? For a customer, I can't do a query of Balance < $40.00, just "MinimumBalance 40" (e.g. Balance >= $40) ?

Thanks,

Matt

— Reply to this email directly or view it on GitHub.

MattRogish commented 11 years ago

Agreed. Okay, so I'll leave the arbitrary "custom_field_query" functionality of fetch_collection in Windows alone so you can send the known query params, but if you want to use the API equals for text and boolean, will have a filter that supports that. Also will have a custom date/time case that supports the StartCreatedTMS, StartModifiedTMS, and then CDCAsOf params.

Ugh.

MattRogish commented 11 years ago

I see: https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0500_QuickBooks_Windows/0600_Object_Reference/Invoice#section_9