Class: Datanorm::Lines::V5::Product
- Inherits:
-
Base
- Object
- Base
- Datanorm::Lines::V5::Product
show all
- Defined in:
- lib/datanorm/lines/v5/product.rb
Overview
Ruby wrapper for one A line of a Datanorm file.
Instance Attribute Summary
Attributes inherited from Base
#columns, #source_line_number
Instance Method Summary
collapse
Methods inherited from Base
#encode, inherited, #initialize, #record_kind, #to_json
Instance Method Details
#as_json ⇒ Object
36
37
38
|
# File 'lib/datanorm/lines/v5/product.rb', line 36
def as_json
{ id:, text_id:, cents:, title:, quantity_unit:, quantity: }
end
|
#cents ⇒ Object
20
21
22
|
# File 'lib/datanorm/lines/v5/product.rb', line 20
def cents
columns[8].to_i
end
|
#id ⇒ Object
12
13
14
|
# File 'lib/datanorm/lines/v5/product.rb', line 12
def id
columns[2]
end
|
#quantity ⇒ Object
32
33
34
|
# File 'lib/datanorm/lines/v5/product.rb', line 32
def quantity
columns[6].to_i.nonzero?
end
|
#quantity_unit ⇒ Object
28
29
30
|
# File 'lib/datanorm/lines/v5/product.rb', line 28
def quantity_unit
columns[5]
end
|
#text_id ⇒ Object
16
17
18
|
# File 'lib/datanorm/lines/v5/product.rb', line 16
def text_id
columns[23]
end
|
#title ⇒ Object
24
25
26
|
# File 'lib/datanorm/lines/v5/product.rb', line 24
def title
columns[3..4].join(' ').strip
end
|
#to_s ⇒ Object
8
9
10
|
# File 'lib/datanorm/lines/v5/product.rb', line 8
def to_s
"[#{id}] Product-5 #{item_title} - EUR #{price}"
end
|