Class: MonoMerchant::Invoice::Item
- Inherits:
-
Object
- Object
- MonoMerchant::Invoice::Item
- Defined in:
- lib/mono-merchant/invoice/item.rb
Constant Summary collapse
- REQUIRED_ATTRS =
%i[name qty sum code]
Instance Method Summary collapse
-
#initialize(i) ⇒ Item
constructor
A new instance of Item.
- #to_hash ⇒ Object
Constructor Details
#initialize(i) ⇒ Item
Returns a new instance of Item.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mono-merchant/invoice/item.rb', line 11 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 |
Instance Method Details
#to_hash ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mono-merchant/invoice/item.rb', line 24 def to_hash { name: name, qty: qty, sum: sum, code: code, icon: icon, unit: unit, header: header, footer: }.compact end |