Here is the documentation for the SugarCRM 5.5 API:
以下是SugarCRM 5.5 API的文档:
set_relationship
This is the gem which is creating methods for me to access it (line 110):
这是为我创建方法的宝石(第110行):
http://github.com/dennijo/Ruby-Sugar/blob/master/lib/ruby_sugar/client.rb
QUESTION: What is the actual format with an example for me to make a relationship between an Account and a Contact? I am confused in terms of what to pass. It looks like the API requires 5 parameters, but the gem only passes two. The documentation for the gem says to pass a hash as follows:
问题:我在一个帐户和联系人之间建立关系的实例格式是什么?我对通过什么感到困惑。看起来API需要5个参数,但gem只传递2个参数。 gem的文档说如下传递哈希:
Assumes:
@client = RubySugar::Client.new(user,pass,url,true)
def set_relationship(mod,id,related,related_id)
data = [
{:module1=>mod,:moudule1_id=>id.to_s,:module2=>related,:module2_id=>related_id.to_s}
]
@client.set_relationship(data)
end
1 个解决方案
#1
1
I think you're getting confused between the actual sugar-api (which says to use five parameters) and the "api" of the gem (which uses just the hash of values).
我认为你在实际的糖-api(用五个参数表示)和gem的“api”(仅使用值的哈希值)之间感到困惑。
Line 110 of the gem (as you described) only uses two parameters - but again, that is a call to a ruby method... which is no doubt defined elsewhere in the code.
gem的第110行(如你所描述的)只使用两个参数 - 但同样,这是对ruby方法的调用......这无疑在代码的其他地方定义。
No doubt, somewhere inside the sugar gem - it will turn that hash into the real parameters to pass to Sugar... but all you need to worry about is populating the hash correctly, which should be covered in the docs.
毫无疑问,在糖宝石中的某个地方 - 它会将该哈希值转换为传递给Sugar的真实参数......但是您需要担心的是正确填充哈希值,这应该在文档中介绍。
#1
1
I think you're getting confused between the actual sugar-api (which says to use five parameters) and the "api" of the gem (which uses just the hash of values).
我认为你在实际的糖-api(用五个参数表示)和gem的“api”(仅使用值的哈希值)之间感到困惑。
Line 110 of the gem (as you described) only uses two parameters - but again, that is a call to a ruby method... which is no doubt defined elsewhere in the code.
gem的第110行(如你所描述的)只使用两个参数 - 但同样,这是对ruby方法的调用......这无疑在代码的其他地方定义。
No doubt, somewhere inside the sugar gem - it will turn that hash into the real parameters to pass to Sugar... but all you need to worry about is populating the hash correctly, which should be covered in the docs.
毫无疑问,在糖宝石中的某个地方 - 它会将该哈希值转换为传递给Sugar的真实参数......但是您需要担心的是正确填充哈希值,这应该在文档中介绍。