Class: Gemgento::API::SOAP::Sales::Order
- Inherits:
-
Object
- Object
- Gemgento::API::SOAP::Sales::Order
- Defined in:
- lib/gemgento/api/soap/sales/order.rb
Class Method Summary collapse
- .add_comment(increment_id, status, comment = '', notify = nil) ⇒ Object
- .cancel ⇒ Object
-
.fetch(increment_id) ⇒ Gemgento::Order
Fetch a Magento Order.
- .fetch_all(last_updated = nil) ⇒ Object
- .hold ⇒ Object
-
.info(increment_id) ⇒ Gemgento::MagentoResponse
Get Order info from Magento.
-
.list(last_updated = nil) ⇒ Gemgento::MagentoResponse
Get a list of orders from Magento.
- .unhold ⇒ Object
Class Method Details
.add_comment(increment_id, status, comment = '', notify = nil) ⇒ Object
84 85 86 87 88 89 90 91 92 |
# File 'lib/gemgento/api/soap/sales/order.rb', line 84 def self.add_comment(increment_id, status, comment = '', notify = nil) = { order_increment_id: increment_id, status: status, comment: comment, notify: notify } MagentoApi.create_call(:sales_order_add_comment, ) end |
.cancel ⇒ Object
80 81 82 |
# File 'lib/gemgento/api/soap/sales/order.rb', line 80 def self.cancel # TODO: Create cancel API call end |
.fetch(increment_id) ⇒ Gemgento::Order
Fetch a Magento Order.
24 25 26 27 28 29 30 31 32 |
# File 'lib/gemgento/api/soap/sales/order.rb', line 24 def self.fetch(increment_id) response = info(increment_id) if response.success? sync_magento_to_local(response.body[:result]) else return nil end end |
.fetch_all(last_updated = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gemgento/api/soap/sales/order.rb', line 7 def self.fetch_all(last_updated = nil) response = list(last_updated) if response.success? response.body_overflow[:result][:item].each do |order| unless order.nil? fetch(order[:increment_id]) end end end end |
.hold ⇒ Object
72 73 74 |
# File 'lib/gemgento/api/soap/sales/order.rb', line 72 def self.hold # TODO: Create hold API call end |
.info(increment_id) ⇒ Gemgento::MagentoResponse
Get Order info from Magento.
68 69 70 |
# File 'lib/gemgento/api/soap/sales/order.rb', line 68 def self.info(increment_id) ::Gemgento::MagentoApi.create_call(:sales_order_info, { order_increment_id: increment_id }) end |
.list(last_updated = nil) ⇒ Gemgento::MagentoResponse
Get a list of orders from Magento.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gemgento/api/soap/sales/order.rb', line 38 def self.list(last_updated = nil) if last_updated.nil? = {} else = { 'filters' => { 'complex_filter' => {item: [ key: 'updated_at', value: { key: 'gt', value: last_updated } ]} } } end response = ::Gemgento::MagentoApi.create_call(:sales_order_list, ) if response.success? && !response.body_overflow[:result][:item].is_a?(Array) response.body_overflow[:result][:item] = [response.body_overflow[:result][:item]] end return response end |
.unhold ⇒ Object
76 77 78 |
# File 'lib/gemgento/api/soap/sales/order.rb', line 76 def self.unhold # TODO: Create unhold API call end |