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.4.27 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.4 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.26 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.3 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.25 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.2 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.24 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.1 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.23 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.22 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.0 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.21 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.5.0.beta.1 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.20 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.19 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.18 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.17 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.16 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.15 app/services/workarea/add_multiple_cart_items.rb
workarea-core-3.4.14 app/services/workarea/add_multiple_cart_items.rb