Sha256: a9cbaacd56f36603dad8e89ec8e1404920fcd52b71c7d4e655e2390609047142
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'gecko/record/base' module Gecko module Record class OrderLineItem < Base belongs_to :order, writeable_on: :create belongs_to :variant, writeable_on: :create belongs_to :tax_type has_many :fulfillment_line_items has_many :invoice_line_items attribute :label, String attribute :line_type, String attribute :freeform, Boolean attribute :shippable, Boolean, readonly: true attribute :discount, BigDecimal attribute :discount_amount, BigDecimal attribute :quantity, BigDecimal attribute :price, BigDecimal attribute :tax_rate_override, BigDecimal attribute :position, Integer attribute :image_url, String, readonly: true def discounted_price if discount_amount&.nonzero? price - discount_amount else price * discount_multiplier end end private def discount_multiplier return 1 unless discount 1 - discount / 100 end end class OrderLineItemAdapter < BaseAdapter end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gecko-ruby-0.9.1 | lib/gecko/record/order_line_item.rb |
gecko-ruby-0.9.0 | lib/gecko/record/order_line_item.rb |
gecko-ruby-0.8.0 | lib/gecko/record/order_line_item.rb |