Class: EcwidApi::Order
Overview
Public: This is an Ecwid Order
Constant Summary collapse
- VALID_FULFILLMENT_STATUSES =
%w( AWAITING_PROCESSING PROCESSING SHIPPED DELIVERED WILL_NOT_DELIVER RETURNED )
Instance Method Summary collapse
-
#billing_person ⇒ Object
Public: Returns the billing person.
- #fulfillment_status ⇒ Object
- #fulfillment_status=(status) ⇒ Object
-
#id ⇒ Object
Public: Gets the unique ID of the order.
-
#items ⇒ Object
Public: Returns a Array of ‘OrderItem` objects.
-
#shipping_person ⇒ Object
Public: Returns the shipping person.
Methods inherited from Entity
#[], #assign_attributes, #assign_raw_attributes, define_accessor, #destroy!, ecwid_accessor, ecwid_reader, ecwid_writer, #initialize, #save, #to_hash, #to_json, #update_attributes, #update_raw_attributes, #url
Methods included from Api
Constructor Details
This class inherits a constructor from EcwidApi::Entity
Instance Method Details
#billing_person ⇒ Object
Public: Returns the billing person
45 46 47 48 49 50 51 52 53 |
# File 'lib/ecwid_api/order.rb', line 45 def billing_person return unless data["billingPerson"] || data["shippingPerson"] @billing_person ||= if data["billingPerson"] Person.new(data["billingPerson"]) else shipping_person end end |
#fulfillment_status ⇒ Object
78 79 80 |
# File 'lib/ecwid_api/order.rb', line 78 def fulfillment_status super && super.downcase.to_sym end |
#fulfillment_status=(status) ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/ecwid_api/order.rb', line 70 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 |
#id ⇒ Object
Public: Gets the unique ID of the order
40 41 42 |
# File 'lib/ecwid_api/order.rb', line 40 def id order_number end |
#items ⇒ Object
Public: Returns a Array of ‘OrderItem` objects
66 67 68 |
# File 'lib/ecwid_api/order.rb', line 66 def items @items ||= data["items"].map { |item| OrderItem.new(item) } end |
#shipping_person ⇒ Object
Public: Returns the shipping person
56 57 58 59 60 61 62 63 |
# File 'lib/ecwid_api/order.rb', line 56 def shipping_person return unless data["shippingPerson"] || data["billingPerson"] @shipping_person ||= if data["shippingPerson"] Person.new(data["shippingPerson"]) else billing_person end end |