Sha256: 8eb045e7842b2d64ed7fe7b529c248b1fb124e2481481531af745cceb90b44eb

Contents?: true

Size: 871 Bytes

Versions: 31

Compression:

Stored size: 871 Bytes

Contents

class FormLineItem
  include Forms::Models::Extension
  include Shop::Models::FormExtension
  
  # line_item:
  #   process: add|update|remove
  
  def create
    @result ||= {}
    find_or_create_current_order
    
    case process
    when 'add'
      @result[:add]    = @order.add(line_item_item_id,line_item_quantity,line_item_item_type)
    when 'modify'
      @result[:modify] = @order.modify(line_item_id,line_item_quantity)
    when 'remove'
      @result[:remove] = @order.remove(line_item_id)
    end
    
    @result
  end
  
  protected
  
  def process
    @config[:process]
  end
  
  def line_item
    @data[:line_item]
  end
  
  def line_item_id
    line_item[:id]
  end
  
  def line_item_item_id
    line_item[:item_id]
  end
  
  def line_item_item_type
    line_item[:item_type]
  end
  
  def line_item_quantity
    line_item[:quantity]
  end
  
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
radiant-shop-extension-0.94.8 app/models/form_line_item.rb
radiant-shop-extension-0.94.7 app/models/form_line_item.rb
radiant-shop-extension-0.94.6 app/models/form_line_item.rb
radiant-shop-extension-0.94.5 app/models/form_line_item.rb
radiant-shop-extension-0.94.4 app/models/form_line_item.rb
radiant-shop-extension-0.94.3 app/models/form_line_item.rb
radiant-shop-extension-0.94.2 app/models/form_line_item.rb
radiant-shop-extension-0.94.1 app/models/form_line_item.rb
radiant-shop-extension-0.94.0 app/models/form_line_item.rb
radiant-shop-extension-0.93.3 app/models/form_line_item.rb
radiant-shop-extension-0.93.2 app/models/form_line_item.rb
radiant-shop-extension-0.93.1 app/models/form_line_item.rb
radiant-shop-extension-0.93.0 app/models/form_line_item.rb
radiant-shop-extension-0.92.11 app/models/form_line_item.rb
radiant-shop-extension-0.92.10 app/models/form_line_item.rb
radiant-shop-extension-0.92.9 app/models/form_line_item.rb
radiant-shop-extension-0.92.8 app/models/form_line_item.rb
radiant-shop-extension-0.92.7 app/models/form_line_item.rb
radiant-shop-extension-0.92.6 app/models/form_line_item.rb
radiant-shop-extension-0.92.3 app/models/form_line_item.rb