Class: Magento::Order

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

Instance Attribute Summary

Attributes inherited from Base

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::ClassMethods

#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

.add_comment(*args) ⇒ Object

sales_order.addComment Add comment to order

Return: boolean

Arguments:

string orderIncrementId - order increment id string status - order status string comment - order comment (optional) boolean notify - notification flag (optional)



47
48
49
# File 'lib/magento/order.rb', line 47

def add_comment(*args)
  commit('addComment', *args)
end

.cancel(*args) ⇒ Object

sales_order.cancel Cancel order

Return: boolean

Arguments:

mixed orderIncrementId - order increment id



83
84
85
# File 'lib/magento/order.rb', line 83

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

.find(find_type, options = {}) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/magento/order.rb', line 95

def find(find_type, options = {})
  filters = {}
  options.each_pair { |k, v| filters[k] = {:eq => v} }
  results = list(filters)
  if find_type == :first
    info(results.first.increment_id)
  else
    results.collect do |o|
      info(o.increment_id)
    end
  end
end

.find_by_id(id) ⇒ Object



87
88
89
# File 'lib/magento/order.rb', line 87

def find_by_id(id)
  find(:first, {:order_id => id})
end

.find_by_increment_id(id) ⇒ Object



91
92
93
# File 'lib/magento/order.rb', line 91

def find_by_increment_id(id)
  info(id)
end

.hold(*args) ⇒ Object

sales_order.hold Hold order

Return: boolean

Arguments:

string orderIncrementId - order increment id



59
60
61
# File 'lib/magento/order.rb', line 59

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

.info(*args) ⇒ Object

sales_order.info Retrieve order information

Return: array

Arguments:

string orderIncrementId - order increment id



32
33
34
# File 'lib/magento/order.rb', line 32

def info(*args)
  new(commit("info", *args))
end

.list(*args) ⇒ Object

sales_order.list Retrieve list of orders by filters

Return: array

Arguments:

array filters - filters for order list (optional)



17
18
19
20
21
22
# File 'lib/magento/order.rb', line 17

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

.unhold(*args) ⇒ Object

sales_order.unhold Unhold order

Return: boolean

Arguments:

mixed orderIncrementId - order increment id



71
72
73
# File 'lib/magento/order.rb', line 71

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

Instance Method Details

#order_itemsObject



109
110
111
112
113
# File 'lib/magento/order.rb', line 109

def order_items
  self.items.collect do |item|
    OrderItem.new(item)
  end
end