lib/insales_api/variant.rb in insales_api-0.0.13 vs lib/insales_api/variant.rb in insales_api-0.1.0

- old
+ new

@@ -1,11 +1,23 @@ module InsalesApi class Variant < Base - self.prefix = "/admin/products/:product_id/" - - # variants_attrs - массив c модицикациями в формате [{:id => 1, :price => 340, :quantity => 4}, {:id => 2, :price => 350, :quantity => 5}] - def self.group_update variants_attrs - connection.put("/admin/products/variants_group_update.xml", { :variants => variants_attrs }.to_xml, headers) + class << self + # Updates all given variants. +variants+ should be array: + # + # [ + # { + # id: 1, + # price: 340, + # quantity: 4, + # }, + # { + # id: 2, + # price: 350, + # quantity: 5, + # }, + # ] + def group_update(variants) + put(:group_update, {}, format.encode(variants, root: :variants)) + end end - end end