Sha256: 1701d0e4f35a2ad85f9b367f4bb4fef38c62e0438cca66c83245cc8af07c9a60

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

module Einvoice
  module Model
    class InvoiceItem < Einvoice::Model::Base
      attr_accessor :description, :quantity, :unit, :unit_price, :amount,
                    :sequence_number, :remark

      validates :description, presence: true, length: { maximum: 256 }
      validates :quantity, presence: true, length: { maximum: 17 }
      validates :unit, length: { maximum: 6 }
      validates :unit_price, presence: true, length: { maximum: 17 }
      validates :amount, presence: true, length: { maximum: 17 }
      validates :sequence_number, presence: true, length: { maximum: 3 }
      validates :remark, length: { maximum: 40 }

      def initialize(attributes={})
        attributes.each do |attribute, value|
          instance_variable_set("@#{attribute}", value) if respond_to?(attribute.to_sym)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
einvoice-0.1.0 lib/einvoice/model/invoice_item.rb