ruckus / quickeebooks

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

Email Address for Windows::Model::Employee #96

Open fabioelia opened 11 years ago

fabioelia commented 11 years ago

Using The following example of code does not work. Complains about null being entered on the Quickbooks Database for the email.

IntuitRequestException (cannot insert NULL into ("ESB"."EMAIL_API"."LABEL_NAME_MAP")):

Have has since ignored using email, and continued along

DexterTheDragon commented 11 years ago

The error implies that your email.tag isn't set to either "Home" or "Business".

ruckus commented 11 years ago

Weird, because your XML looks "OK" - from what you have below it generates this XML:

Person Bugs Bunny
123 Main St. San Francisco USA CA 94117 Billing
foo@bar.com
Business
Bugs Bunny

And your Email#Tag is correct with "Business".

On Aug 30, 2013, at 2:19 PM, Fabio Elia notifications@github.com wrote:

Using The following example of code does not work. Complains about null being entered on the Quickbooks Database for the email.

IntuitRequestException (cannot insert NULL into ("ESB"."EMAIL_API"."LABEL_NAME_MAP")):

Have has since ignored using email, and continued along

• employee.type_of = "Person" • employee.name = "Bugs Bunny" • employee.given_name = "Bugs" • employee.family_name = "Bunny" • email = Quickeebooks::Windows::Model::Email.new • email.address = "foo@bar.com" • email.tag = "Business" • employee.email = email • address = Quickeebooks::Windows::Model::Address.new • address.tag = "Billing" • address.line1 = "123 Main St." • address.city = "San Francisco" • address.country_sub_division_code = "CA" • address.postal_code = "94117" • address.country = "USA" • employee.address = address — Reply to this email directly or view it on GitHub.

ruckus commented 11 years ago

I realize the error text has "Email" in it, but according to the docs:

https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0600_object_reference/employee

A Phone element is required. What happens if you specify a Phone element - does the request succeed?

DexterTheDragon commented 11 years ago

Yeah the docs say that a phone, email, and address are required but I create mine without any of them and they work fine. The code lines @fabioelia posted are from the spec file. That's why I figured based on the error message that his code may have been specifying a different email.tag.

fabioelia commented 11 years ago

Thanks for the guidance! @DexterTheDragon @ruckus So adding phone worked but I had to modify the employee model.

windows employee pull request Still learning the repository and the quickbooks api guide. Im not sure why employee has to have one phone number? Would have assumed it could have multiple phone objects [Quickeebooks::Windows::Model::Phone] but that doesn't work. Maybe its somewhere in the quickbooks api?

Output of xml:

<Employee>
<TypeOf>Person</TypeOf>
<Name>Test</Name>
<Address>
<Line1>123 Test Ave</Line1>
<City>Test City</City>
<Country>United States</Country>
<CountrySubDivisionCode>Massachusetts</CountrySubDivisionCode>
<PostalCode>12345</PostalCode>
<Tag>Billing</Tag>
</Address>
<Phone>
<DeviceType>Mobile</DeviceType>
<FreeFormNumber>555-333-2222</FreeFormNumber>
<Tag>Mobile</Tag>
</Phone>
<Email>
<Address>test@test.com</Address>
<Tag>Business</Tag>
</Email>
<GivenName>test</GivenName>
<FamilyName>test</FamilyName>
</Employee>