Class: Magento::Order
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.add_comment(*args) ⇒ Object
sales_order.addComment Add comment to order.
-
.cancel(*args) ⇒ Object
sales_order.cancel Cancel order.
- .find(find_type, options = {}) ⇒ Object
- .find_by_id(id) ⇒ Object
- .find_by_increment_id(id) ⇒ Object
-
.hold(*args) ⇒ Object
sales_order.hold Hold order.
-
.info(*args) ⇒ Object
sales_order.info Retrieve order information.
-
.list(*args) ⇒ Object
sales_order.list Retrieve list of orders by filters.
-
.unhold(*args) ⇒ Object
sales_order.unhold Unhold order.
Instance Method Summary collapse
Methods included from Base::ClassMethods
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 107 108 109 |
# File 'lib/magento/order.rb', line 95 def find(find_type, = {}) filters = {} .each_pair { |k, v| filters[k] = {:eq => v} } results = list(filters) raise Magento::ApiError, "100 -> Requested order not exists." if results.blank? 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
#billing_address ⇒ Object
122 123 124 |
# File 'lib/magento/order.rb', line 122 def billing_address Magento::CustomerAddress.new(@attributes["billing_address"]) end |
#order_items ⇒ Object
112 113 114 115 116 |
# File 'lib/magento/order.rb', line 112 def order_items self.items.collect do |item| Magento::OrderItem.new(item) end end |
#shipping_address ⇒ Object
118 119 120 |
# File 'lib/magento/order.rb', line 118 def shipping_address Magento::CustomerAddress.new(@attributes["shipping_address"]) end |