Comments (8)
Just to clarify the issue, that XML sample:
<Invoice>
<Invoice>
<ContactID>ac565f9c-9829-4f51-8a5b-0400de972bbb</ContactID>;
<Name>PowerDirect</Name>
</Invoice>
[...]
</Invoice>
should have Contact
as its first child instead of Invoice
repeated:
<Invoice>
<Contact>
<ContactID>ac565f9c-9829-4f51-8a5b-0400de972bbb</ContactID>;
<Name>PowerDirect</Name>
</Contact>
[...]
</Invoice>
from xeroizer.
Could you please show me the code that you're using to generate this? I've not encountered this issue before with code like:
invoice = gw.Invoice.build(type: "ACCREC", contact: {name: "Contact Name"})
invoice.save
from xeroizer.
I'm getting this from client.Invoice.first.to_xml
. Where the client
is the appropriate application. In this case a PartnerApplication
from xeroizer.
That is… interesting. I will have a look and get back to you. You're right, loading the invoice initialises this as Invoice
instead of Contact
.
from xeroizer.
I'm running into this now, too... when I do something like this:
invoice = xeroizer.Invoice.first
contact = invoice.contact
puts xeroizer.CreditNote.build(contact: contact).to_xml
...it serializes as <CreditNote><Invoice>(contact data...)</Invoice></CreditNote>
. But if I change it to this:
contact = xeroizer.Contact.first
...it works fine. Something about the fact that it's being pulled from the invoice makes it serialize improperly.
from xeroizer.
Xeroizer was never really intended to have it's sub-elements re-used in other record types and this is obviously showing through here.
In the meantime, the easiest way to refer to a contact elsewhere is to actually use its unique ID. E.g.
invoice = xeroizer.Invoice.first
contact = invoice.contact
puts xeroizer.CreditNote.build(contact: {id: contact.id}).to_xml
from xeroizer.
Doesn't work in any case where the model does a validates_associated
on the contact association (i.e., credit notes). Just saying {id: contact_id}
isn't enough to satisfy validates_associated
.
from xeroizer.
from xeroizer.
Related Issues (20)
- Question: Does Xeroizer support OAuth 2? HOT 2
- `.sent_to_contact` on Invoices is undefined HOT 3
- Update the readme/documentation to include Oauth2Application HOT 2
- Xero Deprecation Notice - OAuth 1.0a HOT 1
- Timeout option not set correctly on OAuth 2 client HOT 3
- invoice.save returns false but invoice.errors is empty HOT 15
- New gem release? HOT 6
- How to get all the Items from Xero account HOT 1
- NameError: uninitialized constant Xeroizer::OAuth2Application HOT 4
- Double raise for expired tokens? HOT 2
- GET ERROR WHE do any object.save HOT 2
- trying to run tests as a developer... HOT 5
- syntax error, unexpected ',' in branding_theme.rb HOT 1
- Line Amount can not explicity be set to 0.00 if there is a discount
- Missing require somewhere: "uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState" when used outside of Rails HOT 3
- AuthorizationUnsuccessful error HOT 2
- ApiExceptions result in parse error
- Saving Quotes
- BankAccount Model Not Available?
- How to revoke token / delete current_connection HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xeroizer.