如何使用shopify_api gem删除收藏?

时间:2014-03-08 18:59:12

标签: ruby shopify

我在删除shopify收集时遇到问题:

collect =ShopifyAPI::Collect.find(:first,:params=>{:collection_id=>coll,:product_id=>id})
puts collect.json
collect.destroy

给了我以下错误:

  在:

的ActiveResource-3.2.12 / LIB / active_resource / connection.rb:134   `handle_response':失败了。响应代码= 403.响应消息=   故宫。 (的ActiveResource :: ForbiddenAccess)

我看到收集数据,但我不能删除它 这是一个私人应用 - 任何提示?

1 个答案:

答案 0 :(得分:0)

如果Shopify Collect的产品和集合存在,您只能销毁它。

ShopifyAPI::Collect.find(1)
=> #<ShopifyAPI::Collect:0x007f243b896d8 @attributes={"id"=>7324445889, "collection_id"=>348881937, "product_id"=>2333862593, "featured"=>false, "created_at"=>"2015-09-19T16:28:50+01:00", "updated_at"=>"2015-09-19T16:28:50+01:00", "position"=>32, "sort_value"=>"0000000032"}, @prefix_options={}, @persisted=true>

ShopifyAPI::CustomCollection.find(348881937)
=> ActiveResource::ResourceNotFound 404

ShopifyAPI::Collect.find(1).destroy
=> ActiveResource::ForbiddenAccess Exception: Failed.  Response code = 403.