Browse Source

Fix Variant to support accessing both nested variants with a product prefix as well as top level variants directly by variant_id.

Dennis Theisen 14 years ago
parent
commit
a729c91b2b
1 changed files with 4 additions and 0 deletions
  1. 4 0
      lib/shopify_api.rb

+ 4 - 0
lib/shopify_api.rb

@@ -302,6 +302,10 @@ module ShopifyAPI
   
   class Variant < Base
     self.prefix = "/admin/products/:product_id/"
+    
+    def self.prefix(options={})
+      options[:product_id].nil? ? "/admin/" : "/admin/products/#{options[:product_id]}/"
+    end
   end
   
   class Image < Base