Class: Xpost::Models::Order
- Inherits:
-
Object
- Object
- Xpost::Models::Order
- Includes:
- ActiveModel::Model
- Defined in:
- lib/xpost/models/order.rb
Constant Summary collapse
- CONFIRMABLE_PARAMETERS =
Set[:status, :email, :buyer_name, :contact_number, :delivery_address, :items, :shipment, :total, :currency, :payment_method, :payment_provider]
- FOR_PICKUP_PARAMETERS =
Set[:pickup_address, :pickup_at]
Instance Attribute Summary collapse
-
#buyer_name ⇒ Object
Returns the value of attribute buyer_name.
-
#contact_number ⇒ Object
Returns the value of attribute contact_number.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#delivery_address ⇒ Object
Returns the value of attribute delivery_address.
-
#email ⇒ Object
Returns the value of attribute email.
-
#items ⇒ Object
Returns the value of attribute items.
-
#payment_method ⇒ Object
Returns the value of attribute payment_method.
-
#payment_provider ⇒ Object
Returns the value of attribute payment_provider.
-
#pickup_address ⇒ Object
Returns the value of attribute pickup_address.
-
#shipment ⇒ Object
Returns the value of attribute shipment.
-
#status ⇒ Object
Returns the value of attribute status.
-
#total ⇒ Object
Returns the value of attribute total.
Instance Method Summary collapse
-
#cancellable? ⇒ Boolean
docs.quadx.xyz/#5f38afd0-66bb-468f-ab4e-993d4745a257 Sets the order status to canceled.
- #confirmable? ⇒ Boolean
-
#initialize(options = {}) ⇒ Order
constructor
A new instance of Order.
-
#updatable? ⇒ Boolean
docs.quadx.xyz/#c831dc25-2de4-36c5-c321-8e9db0fc2105 The following fields can be updated provided they have not passed the cutoff date and time as specified in the contract.
Constructor Details
#initialize(options = {}) ⇒ Order
Returns a new instance of Order.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/xpost/models/order.rb', line 21 def initialize( = {}) @status = [:status] @email = [:email] @buyer_name = [:buyer_name] @contact_number = [:contact_number] @delivery_address = [:delivery_address] @items = [:items] @shipment = [:shipment] @total = [:total] @currency = [:currency] @payment_method = [:payment_method] @payment_provider = [:payment_provider] @pickup_address = [:pickup_address] @pickup_at = [:pickup_at] end |
Instance Attribute Details
#buyer_name ⇒ Object
Returns the value of attribute buyer_name.
13 14 15 |
# File 'lib/xpost/models/order.rb', line 13 def buyer_name @buyer_name end |
#contact_number ⇒ Object
Returns the value of attribute contact_number.
13 14 15 |
# File 'lib/xpost/models/order.rb', line 13 def contact_number @contact_number end |
#currency ⇒ Object
Returns the value of attribute currency.
14 15 16 |
# File 'lib/xpost/models/order.rb', line 14 def currency @currency end |
#delivery_address ⇒ Object
Returns the value of attribute delivery_address.
15 16 17 |
# File 'lib/xpost/models/order.rb', line 15 def delivery_address @delivery_address end |
#email ⇒ Object
Returns the value of attribute email.
13 14 15 |
# File 'lib/xpost/models/order.rb', line 13 def email @email end |
#items ⇒ Object
Returns the value of attribute items.
16 17 18 |
# File 'lib/xpost/models/order.rb', line 16 def items @items end |
#payment_method ⇒ Object
Returns the value of attribute payment_method.
14 15 16 |
# File 'lib/xpost/models/order.rb', line 14 def payment_method @payment_method end |
#payment_provider ⇒ Object
Returns the value of attribute payment_provider.
14 15 16 |
# File 'lib/xpost/models/order.rb', line 14 def payment_provider @payment_provider end |
#pickup_address ⇒ Object
Returns the value of attribute pickup_address.
15 16 17 |
# File 'lib/xpost/models/order.rb', line 15 def pickup_address @pickup_address end |
#shipment ⇒ Object
Returns the value of attribute shipment.
16 17 18 |
# File 'lib/xpost/models/order.rb', line 16 def shipment @shipment end |
#status ⇒ Object
Returns the value of attribute status.
16 17 18 |
# File 'lib/xpost/models/order.rb', line 16 def status @status end |
#total ⇒ Object
Returns the value of attribute total.
14 15 16 |
# File 'lib/xpost/models/order.rb', line 14 def total @total end |
Instance Method Details
#cancellable? ⇒ Boolean
docs.quadx.xyz/#5f38afd0-66bb-468f-ab4e-993d4745a257 Sets the order status to canceled. An order can be canceled provided they have not passed the cutoff date and time as specified in the contract.
43 44 45 |
# File 'lib/xpost/models/order.rb', line 43 def cancellable? true end |
#confirmable? ⇒ Boolean
37 38 39 |
# File 'lib/xpost/models/order.rb', line 37 def confirmable? self.valid? && self.delivery_address.present? end |
#updatable? ⇒ Boolean
docs.quadx.xyz/#c831dc25-2de4-36c5-c321-8e9db0fc2105 The following fields can be updated provided they have not passed the cutoff date and time as specified in the contract.
49 50 51 |
# File 'lib/xpost/models/order.rb', line 49 def updatable? true end |