class EcwidApi::Order

Public: This is an Ecwid Order

Constants

VALID_FULFILLMENT_STATUSES
VALID_PAYMENT_STATUSES

Public Instance Methods

billing_person() click to toggle source

Public: Returns the billing person

If there isn't a billing_person, then it assumed to be the shipping_person

# File lib/ecwid_api/order.rb, line 66
def billing_person
  build_billing_person || build_shipping_person
end
fulfillment_status() click to toggle source
Calls superclass method
# File lib/ecwid_api/order.rb, line 92
def fulfillment_status
  super && super.downcase.to_sym
end
fulfillment_status=(status) click to toggle source
Calls superclass method
# File lib/ecwid_api/order.rb, line 84
def fulfillment_status=(status)
  status = status.to_s.upcase
  unless VALID_FULFILLMENT_STATUSES.include?(status)
    raise Error("#{status} is an invalid fullfillment status")
  end
  super(status)
end
items() click to toggle source

Public: Returns a Array of `OrderItem` objects

# File lib/ecwid_api/order.rb, line 80
def items
  @items ||= data["items"].map { |item| OrderItem.new(item) }
end
order_number() click to toggle source

@deprecated Please use {#id} instead

# File lib/ecwid_api/order.rb, line 57
def order_number
  warn "[DEPRECATION] `order_number` is deprecated.  Please use `id` instead."
  id
end
payment_status() click to toggle source
Calls superclass method
# File lib/ecwid_api/order.rb, line 104
def payment_status
  super && super.downcase.to_sym
end
payment_status=(status) click to toggle source
Calls superclass method
# File lib/ecwid_api/order.rb, line 96
def payment_status=(status)
  status = status.to_s.upcase
  unless VALID_PAYMENT_STATUSES.include?(status)
    raise Error("#{status} is an invalid payment status")
  end
  super(status)
end
shipping_person() click to toggle source

Public: Returns the shipping person

If there isn't a shipping_person, then it is assumed to be the billing_person

# File lib/ecwid_api/order.rb, line 75
def shipping_person
  build_shipping_person || build_billing_person
end
vendor_order_number() click to toggle source

@deprecated Please use {#id} instead

# File lib/ecwid_api/order.rb, line 51
def vendor_order_number
  warn "[DEPRECATION] `vendor_order_number` is deprecated.  Please use `id` instead."
  id
end

Private Instance Methods

build_billing_person() click to toggle source
# File lib/ecwid_api/order.rb, line 110
def build_billing_person
  @billing_person ||= data["billingPerson"] && Person.new(data["billingPerson"])
end
build_shipping_person() click to toggle source
# File lib/ecwid_api/order.rb, line 114
def build_shipping_person
  @shipping_person ||= data["shippingPerson"] && Person.new(data["shippingPerson"])
end