class Magentwo::Order

Constants

Attributes

Public Class Methods

[](unique_identifier) click to toggle source

this is necessary as the return type of magento2 is not consistent

# File lib/model/order.rb, line 20
def [] unique_identifier
  self.filter(:entity_id => unique_identifier).first
end
unique_identifier() click to toggle source
# File lib/model/order.rb, line 24
def unique_identifier
  Magentwo::Logger.error "orders do not contain id on default requests, therefore they cannot be targeted on the API"
  nil
end

Public Instance Methods

customer() click to toggle source
# File lib/model/order.rb, line 13
def customer
  self.check_presence :customer_id
  Magentwo::Customer[self.customer_id]
end
products() click to toggle source
# File lib/model/order.rb, line 6
def products
  product_skus = self.items.map do |item|
    item[:sku]
  end
  Magentwo::Product.filter(:sku => product_skus).all
end