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 READY_FOR_PICKUP OUT_FOR_DELIVERY ).freeze
- VALID_PAYMENT_STATUSES =
%w( AWAITING_PAYMENT PAID CANCELLED REFUNDED PARTIALLY_REFUNDED INCOMPLETE ).freeze
Instance Method Summary collapse
-
#billing_person ⇒ Object
Public: Returns the billing person.
- #fulfillment_status ⇒ Object
- #fulfillment_status=(status) ⇒ Object
-
#items ⇒ Object
Public: Returns a Array of ‘OrderItem` objects.
-
#order_number ⇒ Object
deprecated
Deprecated.
Please use #id instead
- #payment_status ⇒ Object
- #payment_status=(status) ⇒ Object
-
#shipping_person ⇒ Object
Public: Returns the shipping person.
-
#vendor_order_number ⇒ Object
deprecated
Deprecated.
Please use #id instead
Methods inherited from Entity
#==, #[], #assign_attributes, #assign_raw_attributes, define_accessor, #destroy!, ecwid_accessor, ecwid_reader, ecwid_writer, #initialize, #marshal_dump, #marshal_load, #save, #to_hash, #to_json, #update_attributes, #update_raw_attributes, #url
Constructor Details
This class inherits a constructor from EcwidApi::Entity
Instance Method Details
#billing_person ⇒ Object
Public: Returns the billing person
If there isn’t a billing_person, then it assumed to be the shipping_person
66 67 68 |
# File 'lib/ecwid_api/order.rb', line 66 def billing_person build_billing_person || build_shipping_person end |
#fulfillment_status ⇒ Object
92 93 94 |
# File 'lib/ecwid_api/order.rb', line 92 def fulfillment_status super && super.downcase.to_sym end |
#fulfillment_status=(status) ⇒ Object
84 85 86 87 88 89 90 |
# 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 ⇒ Object
Public: Returns a Array of ‘OrderItem` objects
80 81 82 |
# File 'lib/ecwid_api/order.rb', line 80 def items @items ||= data["items"].map { |item| OrderItem.new(item) } end |
#order_number ⇒ Object
Please use #id instead
57 58 59 60 |
# 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 ⇒ Object
104 105 106 |
# File 'lib/ecwid_api/order.rb', line 104 def payment_status super && super.downcase.to_sym end |
#payment_status=(status) ⇒ Object
96 97 98 99 100 101 102 |
# 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 ⇒ Object
Public: Returns the shipping person
If there isn’t a shipping_person, then it is assumed to be the billing_person
75 76 77 |
# File 'lib/ecwid_api/order.rb', line 75 def shipping_person build_shipping_person || build_billing_person end |
#vendor_order_number ⇒ Object
Please use #id instead
51 52 53 54 |
# 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 |