tlconnor/xero_gateway — pull request #39 by lukes (2012-10-23 06:08:49+00:00)
Title: Changes to have Xero's response with their newer XML payload when bulk importing invoices

Changes to have Xero's response with their newer XML payload when bulk importing invoices.

As Xero say:

> If you are entering many invoices in a single API call then we recommend you utilise our new response format that shows validation errors for each invoice. The new response messages for validating bulk API calls would mean a breaking change so to utilise this functionality you’ll need to append ?SummarizeErrors=false to the end of your API calls e.g. POST /api.xro/2.0/Invoices?SummarizeErrors=false

http://blog.xero.com/developer/api/Invoices/

This patch includes this breaking change under the assumption that a breaking change will be acceptable. It could be re-written so the user can opt-in or opt-out through a configuration parameter.

Patch also includes handling having errors on Invoice objects, which is how the Xero API will handle any invoices that it couldn't import. I understand that this is kind of overloading the errors property on Invoices, as it already is populated when you call valid? on Invoices. However it kind of makes sense for the API response to also populate this property, and is intuitively the property name you'd expect if the gem's consistent with the Xero API.