Sha256: c2c1e965e9dce0898bc50a3758130f7fe8719f91082a9696d09af48aa4730db6

Contents?: true

Size: 686 Bytes

Versions: 2

Compression:

Stored size: 686 Bytes

Contents

module Xsys
  module Model
    class TransactionItem
      attr_accessor :product_id, :transaction_status_id,
        :quantity, :remaining_quantity, :qa_flag, :qa_date,
        :amount_total, :cost,  :packages, :miles

      def initialize(attributes={})
        attributes.each do |k,v|
          if k.to_s == 'transaction_date'
            self.transaction_date = Date.parse(v) unless v.nil?
          elsif k.to_s == 'user'
            self.user = User.new(v)
          elsif k.to_s == 'items'
            self.items = v.map { |x| TransactionItem.new(x) }
          else
            self.send("#{k}=", v) if self.respond_to?(k)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xsys-0.0.25 lib/xsys/model/transaction_item.rb
xsys-0.0.24 lib/xsys/model/transaction_item.rb