RubyZoho :: Crm :: Account.all返回202个帐户,而还有更多帐户。相同的RubyZoho :: Crm :: Contact.all和RubyZoho :: Crm :: Products.all。
我该怎么做才能接收所有物体?
提前致谢
根据我所做的一些研究,在Zoho Api中设置了200个条目的限制。我发现使用RubyZoho获取所有记录的方式:
def get_zoho_objects module_name
objects = []
first_index = 1
block_size = 200
to_index = block_size
loop do
puts "from index: #{first_index} to index: #{to_index}"
return_objects = RubyZoho.configuration.api.some(module_name, first_index, to_index)
break if return_objects == nil
objects += return_objects
first_index = to_index + 1
to_index += block_size
end
objects
end
用法:
all_accounts = get_zoho_objects "Accounts"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句