d
Topic
lorne Member
Posts:
1
13 days ago

shopify_api gem and InventoryLevel action

Using the shopify_api gem in a rails app (Latest version, 5.2.0), and trying to access the InventoryLevel action..

Things I've tried:

ShopifyAPI::InventoryLevel({'location_id' => '7886569583','inventory_item_id' => variant.inventory_item_id})
*** NoMethodError Exception: undefined method `InventoryLevel' for ShopifyAPI:Module
ShopifyAPI::InventoryLevel.connect({'location_id' => '7886569583','inventory_item_id' => variant.inventory_item_id})
*** NoMethodError Exception: undefined method `connect' for ShopifyAPI::InventoryLevel:Class
ShopifyAPI::InventoryLevel.adjust({'location_id' => '7886569583','inventory_item_id' => variant.inventory_item_id,'available_adjustment' => '-1'})
*** NoMethodError Exception: undefined method `adjust' for ShopifyAPI::InventoryLevel:Class

but interestingly the following is returning:

ShopifyAPI::InventoryLevel.element_path({'location_id' => '7886569583','inventory_item_id' => variant.inventory_item_id})
"/admin/inventory_levels.json?inventory_item_id=16357485052015&location_id=7886569583"

Relevant code in the gem: https://github.com/Shopify/shopify_api/blob/master/lib/shopify_api/resources/inventory_level.rb

Where am I going wrong?

i
Replies
Alex Richter Developer Experience
Posts:
892