ruby-on-rails-3 – 使用Savon gem(SOAP)在Ruby on Rails中使用A
发布时间:2020-12-17 01:27:48 所属栏目:百科 来源:网络整理
导读:我正在使用 this code作为我的rails应用程序与Magento的API.一切都很好,除了一件事,我需要通过Magento API的参数过滤产品,但我不知道如何:( 显然我已经测试了更多的解决方案(数组,哈希等),但是 不成功. 钯:对不起,我的英语非常有限 链接 相关案例(失败):Ad
我正在使用
this code作为我的rails应用程序与Magento的API.一切都很好,除了一件事,我需要通过Magento API的参数过滤产品,但我不知道如何:(
显然我已经测试了更多的解决方案(数组,哈希等),但是 钯:对不起,我的英语非常有限 链接 >相关案例(失败):Adding a product using Savon to connect to Magento API 解决方法
我知道这已经很晚了,但如果有其他人找到这个帖子,我已经创建了一个magento_api_wrapper gem,它实现了Magento SOAP API v2的过滤器.你可以在这里找到代码:
https://github.com/harrisjb/magento_api_wrapper
总而言之,如果要使用其中一个Magento SOAP API简单过滤器,则可以传递带有键和值的哈希: api = MagentoApiWrapper::Catalog.new(magento_url: "yourmagentostore.com/index.php",magento_username: "soap_api_username",magento_api_key: "userkey123") api.product_list(simple_filters: [{key: "status",value: "processing"},{key: created_at,value: "12/10/2013 12:00" }]) 要使用复杂的过滤器,请使用键,运算符和值传递散列: api.product_list(complex_filters: [{key: "status",operator: "eq",value: ["processing","completed"]},operator: "from",value: "12/10/2013" }]) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |