Class: SpreeCmCommissioner::IntercityTaxiOrder::Update
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::IntercityTaxiOrder::Update
- Defined in:
- app/services/spree_cm_commissioner/intercity_taxi_order/update.rb
Instance Attribute Summary collapse
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(order_number:, params:) ⇒ Update
constructor
A new instance of Update.
Constructor Details
#initialize(order_number:, params:) ⇒ Update
Returns a new instance of Update.
10 11 12 13 |
# File 'app/services/spree_cm_commissioner/intercity_taxi_order/update.rb', line 10 def initialize(order_number:, params:) @order_number = order_number @params = ensure_parameters(params) end |
Instance Attribute Details
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
4 5 6 |
# File 'app/services/spree_cm_commissioner/intercity_taxi_order/update.rb', line 4 def order_number @order_number end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'app/services/spree_cm_commissioner/intercity_taxi_order/update.rb', line 4 def params @params end |
Class Method Details
.call(order_number:, params:) ⇒ Object
6 7 8 |
# File 'app/services/spree_cm_commissioner/intercity_taxi_order/update.rb', line 6 def self.call(order_number:, params:) new(order_number: order_number, params: params).call end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/services/spree_cm_commissioner/intercity_taxi_order/update.rb', line 15 def call order = Spree::Order.find_by!(number: order_number) order.update!(order_params) create_billing_address_if_missing(order) order end |