Sha256: 772d8967b6de868a088aca18074a898937de9416b5efb0814cfff237fdba7e9a

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

require "flex_commerce_api/api_base"
module FlexCommerce
  #
  # A flex commerce LineItem model
  #
  # This model provides access to the flex commerce cart's line_items.
  # This model allows you to create a line_item, update its contents, delete a line_item or list the line items for a specific cart.
  #
  # It is used much like an active record model.
  #
  # Examples:
  #
  #
  #
  #   # Creating a line item for a specific cart
  #
  #   FlexCommerce::LineItem.create container: cart, item: variant, unit_quantity: 3 #creates and returns a new line item ready for use
  #
  class LineItem < FlexCommerceApi::ApiBase

    # @method item
    # The item (either a variant or a bundle)
    # @return [FlexCommerce::Variant|FlexCommerce::Bundle]

    # @TODO Document other popular methods that we will support

    has_one :item
    belongs_to :cart, class_name: "::FlexCommerce::Cart"


    # note: only embedded in order responses, not carts
    has_many :line_item_discounts, class_name: "::FlexCommerce::LineItemDiscount"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flex_commerce_api-0.8.3 app/models/line_item.rb
flex_commerce_api-0.8.2 app/models/line_item.rb
flex_commerce_api-0.8.1 app/models/line_item.rb
flex_commerce_api-0.7 app/models/line_item.rb
flex_commerce_api-0.6.57 app/models/line_item.rb