Sha256: e6cc10f80cb3796360b501928bf3dd908fc68873aca8427f9ade1d51537d5e24

Contents?: true

Size: 312 Bytes

Versions: 12

Compression:

Stored size: 312 Bytes

Contents

Spree::Order.class_eval do
  def self.build_from_api(user, params)
    order = create
    params[:line_items_attributes].each do |line_item|
      order.add_variant(Spree::Variant.find(line_item[:variant_id]), line_item[:quantity])
    end

    order.user = user
    order.email = user.email
    order
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spree_api-1.1.6 app/models/spree/order_decorator.rb
spree_api-1.1.5 app/models/spree/order_decorator.rb
spree_api-1.1.4 app/models/spree/order_decorator.rb
spree_api-1.2.0 app/models/spree/order_decorator.rb
spree_api-1.2.0.rc2 app/models/spree/order_decorator.rb
spree_api-1.2.0.rc1 app/models/spree/order_decorator.rb
spree_api-1.1.3 app/models/spree/order_decorator.rb
spree_api-1.1.2 app/models/spree/order_decorator.rb
spree_api-1.1.2.rc1 app/models/spree/order_decorator.rb
spree_api-1.1.1 app/models/spree/order_decorator.rb
spree_api-1.1.0 app/models/spree/order_decorator.rb
spree_api-1.1.0.rc2 app/models/spree/order_decorator.rb