Class: Magento::ProductStock

Inherits:
Base
  • Object
show all
Defined in:
lib/magento/product_stock.rb

Overview

www.magentocommerce.com/wiki/doc/webservices-api/api/cataloginventory_stock_item 101 Product not exists. 102 Product inventory not updated. Details in error message.

Instance Attribute Summary

Attributes inherited from Base

#attributes

Class Method Summary collapse

Methods included from Base::ClassMethods

#api_path, #commit

Methods included from Base::InstanceMethods

#id, #id=, #initialize, #method_missing, #object_attributes=

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Magento::Base::InstanceMethods

Class Method Details

.list(*args) ⇒ Object

cataloginventory_stock_item.list Retrieve stock data by product ids

Return: array

Arguments:

array products - list of products IDs or Skus



15
16
17
18
19
20
# File 'lib/magento/product_stock.rb', line 15

def list(*args)
  results = commit("list", *args)
  results.collect do |result|
    new(result)
  end
end

.update(*args) ⇒ Object

cataloginventory_stock_item.update Update product stock data

Return: boolean

Arguments:

mixed product - product ID or Sku array data - data to change (qty, is_in_stock)



31
32
33
# File 'lib/magento/product_stock.rb', line 31

def update(*args)
  commit('update', *args)
end