ruckus / quickbooks-ruby

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

Strange response from email_address.address #585

Closed timmyd87 closed 1 year ago

timmyd87 commented 1 year ago

Hey team, i'm getting an array of [email, mobile and id] when getting all contacts. I'm saving them to my app with

c.email = (contact.email_address.address if contact.email_address.present?),

but what's being saved is:

Screen Shot 2022-10-09 at 6 58 40 pm

(see the values in the [] brackets).

I also reverted to using the raw "primary_email_address.address" but i get the same output.

What's strange to me is using the same method but with 'primary_phone.free_form_number' saves the phone number beautifully.

Am i calling the wrong model to save this? Or could something have changed on Intuit's end?

ruckus commented 1 year ago

That is odd. Do you know what the raw XML looks like?

You can Enable Logging or use an HTTP Proxy to view the data.

timmyd87 commented 1 year ago

Thanks @ruckus , Screenshot of XML from logs here:

Screen Shot 2022-10-10 at 2 11 06 pm

Which looks fine to me, removing '.address' and just saving what's coming back from the gem using contact.email_address - i get:

Screen Shot 2022-10-10 at 2 16 11 pm

ruckus commented 1 year ago

Try reading customer.primary_email_address not contact.email_address, like

c.email = (contact.primary_email_address.address if contact.primary_email_address.present?),

I copied and pasted that line above from your message and just noticed the trailing comma , .. ? Whats up with that? Could that be doing the multiple assignment?

timmyd87 commented 1 year ago

It....... it was the comma, i had no idea a simple comma could cause such a fuss, thank you for taking the time to respond @ruckus ... i think it was a hangover from a 'find_or_create_by' action i used previously.