Sha256: 540e65b0a069b169d0ae80cdb22c505dd915912c809978b98745bfcda9b1731d

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module MonoMerchant
  module Invoice
    class Item

      REQUIRED_ATTRS = %i[name qty sum code]

      attr_reader *REQUIRED_ATTRS, :icon, :unit, :header, :footer

      def initialize(i)
        # TODO: check required?
        @name = i[:name]
        @qty = i[:qty]
        @sum = i[:sum]
        @code = i[:code]
        # optional
        @icon = i[:icon]
        @unit = i[:unit]
        @header = i[:header]
        @footer = i[:footer]
      end

      def to_hash
        { name: name,
          qty: qty,
          sum: sum,
          code: code,
          icon: icon,
          unit: unit,
          header: header,
          footer: footer }.compact
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mono-merchant-0.2.0 lib/mono-merchant/invoice/item.rb
mono-merchant-0.1.0 lib/mono-merchant/invoice/item.rb