为什么快速簿在尝试创建/更新某些属性时失败?

问题描述 投票:1回答:1

我正在尝试使用quickbooks API创建新客户。如果我只传递名称和活动属性,则可以正常工作。但是,当我传递其他属性时,它将失败。

红宝石1.9.3p194-Rails 3.1.3

gem'strong_parameters','〜> 0.2.3'

gem'quickbooks-ruby'

gem'quickbooks-ruby-base'

gem'oauth-plugin'

base = Quickbooks::Base.new(@user, :customer)
customer = base.qr_model(:customer)
customer.given_name = patient.first_name
customer.family_name = patient.last_name
customer.active = true
customer.primary_phone = patient.home_phone
customer.primary_email_address = patient.email
customer.billing_address = patient.address1 + " " + patient.address2 + " " + patient.city + " " + patient.state + " " + patient.zip
base.service.create(customer)

错误:NoMethodError:““:String

的未定义方法“地址”

似乎我没有正确保存对象。有什么想法吗?

ANSWER(感谢Manas Mukherjee):

address  = Quickbooks::Model::PhysicalAddress.new
address.line1 = "103 Fake St.
address.city = "Simsbury"
... 
customer.billing_address = address
ruby-on-rails ruby quickbooks
1个回答
1
投票

我还没有使用ruby-gem库。看起来,错误不是来自服务器,而是来自客户端(ruby-gem)。

帐单/发货地址未定义为'String',它是一个复杂的类型,称为-'physicaladdress'。请检查您是否有正确的setter方法,该方法使用'physicaladdres'类型作为参数。

Java的等效项-customer.setBillAddr(PhysicalAddress val);

https://developer.intuit.com/docs/api/accounting [参考-复杂数据类型->物理地址]。

客户文档参考-https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/customer

© www.soinside.com 2019 - 2024. All rights reserved.