Sha256: 6eb26a03e5a36cba7aff8a2ae324a06e88cdb519579f798050691907a1d80668

Contents?: true

Size: 397 Bytes

Versions: 62

Compression:

Stored size: 397 Bytes

Contents

module Workarea
  class AddMultipleCartItems
    def initialize(order, items_params = [])
      @order = order
      @items_params = items_params
    end

    def perform
      items.all?(&:save)
    end

    def perform!
      return false unless items.all?(&:valid?)
      perform
    end

    def items
      @items ||= @items_params.map { |params| Item.new(@order, params) }
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.26 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.45 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.25 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.23 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.44 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.22 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.43 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.21 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.42 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.20 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.41 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.19 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.40 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.18 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.39 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.17 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.38 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.16 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.37 app/services/workarea/add_multiple_cart_items.rb