Sha256: 249cdbbfc38b82ac448c2610ecf65d1475e285bee0669693c895401e48ed0211

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

module Einvoice
  module Neweb
    module Model
      class InvoiceItem < Base
        VALID_OPTIONS_KEYS = [
          :description,
          :quantity,
          :unit,
          :unit_price,
          :amount,
          :sequence_number,
          :remark
        ].freeze

        attr_accessor *VALID_OPTIONS_KEYS

        validates :description, presence: true, length: { maximum: 256 }
        validates :quantity, presence: true, length: { maximum: 17 }, quantity: true
        validates :unit, length: { maximum: 6 }
        validates :unit_price, presence: true, length: { maximum: 17 }, unit_price: true
        validates :amount, presence: true, length: { maximum: 17 }, amount: true
        validates :sequence_number, presence: true, length: { maximum: 3 }, format: { with: /\A[1-9]|[1-9][0-9]|[1-9][0-9][0-9]\Z/ }
        validates :remark, length: { maximum: 40 }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
einvoice-1.1.1 lib/einvoice/neweb/model/invoice_item.rb
einvoice-1.1.0 lib/einvoice/neweb/model/invoice_item.rb
einvoice-1.0.0 lib/einvoice/neweb/model/invoice_item.rb