Class: SolidusGraphqlApi::Mutations::Checkout::UpdateCartQuantity
- Inherits:
-
BaseMutation
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- SolidusGraphqlApi::Mutations::Checkout::UpdateCartQuantity
- Defined in:
- lib/solidus_graphql_api/mutations/checkout/update_cart_quantity.rb
Instance Method Summary collapse
Instance Method Details
#authorized?(line_item:) ⇒ Boolean
31 32 33 |
# File 'lib/solidus_graphql_api/mutations/checkout/update_cart_quantity.rb', line 31 def (line_item:, **) current_order.line_items.find(line_item.id) end |
#ready? ⇒ Boolean
35 36 37 |
# File 'lib/solidus_graphql_api/mutations/checkout/update_cart_quantity.rb', line 35 def ready?(*) current_ability.(:update, current_order, guest_token) end |
#resolve(line_item:, quantity:) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/solidus_graphql_api/mutations/checkout/update_cart_quantity.rb', line 15 def resolve(line_item:, quantity:) update_params = { line_items_attributes: { id: line_item.id, quantity: quantity } } current_order.contents.update_cart(update_params) { order: current_order, errors: user_errors("line_item", line_item.errors) } end |