Class: Sendregning::Line
- Inherits:
-
Object
- Object
- Sendregning::Line
- Defined in:
- lib/sendregning/line.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
Description.
-
#discount ⇒ Object
Discount in percentage as decimal.
-
#itemNo ⇒ Object
Returns the value of attribute itemNo.
-
#lineTaxAmount ⇒ Object
Returns the value of attribute lineTaxAmount.
-
#lineTotal ⇒ Object
Returns the value of attribute lineTotal.
-
#prodCode ⇒ Object
Product code.
-
#qty ⇒ Object
Quantity, as decimal.
-
#tax ⇒ Object
Tax rate.
-
#unitPrice ⇒ Object
Price per unit in decimal.
Instance Method Summary collapse
-
#initialize(new_attributes = {}) ⇒ Line
constructor
A new instance of Line.
-
#to_xml(options = {}) ⇒ Object
Renders line to XML.
Constructor Details
#initialize(new_attributes = {}) ⇒ Line
Returns a new instance of Line.
25 26 27 |
# File 'lib/sendregning/line.rb', line 25 def initialize(new_attributes={}) self.attributes = new_attributes end |
Instance Attribute Details
#desc ⇒ Object
Description. String, max length: 75
12 13 14 |
# File 'lib/sendregning/line.rb', line 12 def desc @desc end |
#discount ⇒ Object
Discount in percentage as decimal. Optional, defaults to 0
18 19 20 |
# File 'lib/sendregning/line.rb', line 18 def discount @discount end |
#itemNo ⇒ Object
Returns the value of attribute itemNo.
23 24 25 |
# File 'lib/sendregning/line.rb', line 23 def itemNo @itemNo end |
#lineTaxAmount ⇒ Object
Returns the value of attribute lineTaxAmount.
23 24 25 |
# File 'lib/sendregning/line.rb', line 23 def lineTaxAmount @lineTaxAmount end |
#lineTotal ⇒ Object
Returns the value of attribute lineTotal.
23 24 25 |
# File 'lib/sendregning/line.rb', line 23 def lineTotal @lineTotal end |
#prodCode ⇒ Object
Product code. String, max length: 9
9 10 11 |
# File 'lib/sendregning/line.rb', line 9 def prodCode @prodCode end |
#qty ⇒ Object
Quantity, as decimal. Example: ‘7,5’
6 7 8 |
# File 'lib/sendregning/line.rb', line 6 def qty @qty end |
#tax ⇒ Object
Tax rate. Valid rates are: ‘0’, ‘8’, ‘13’ and ‘25’. Default: ‘25’
21 22 23 |
# File 'lib/sendregning/line.rb', line 21 def tax @tax end |
#unitPrice ⇒ Object
Price per unit in decimal. Example: ‘250,00’
15 16 17 |
# File 'lib/sendregning/line.rb', line 15 def unitPrice @unitPrice end |
Instance Method Details
#to_xml(options = {}) ⇒ Object
Renders line to XML
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/sendregning/line.rb', line 30 def to_xml(={}) if [:builder] xml = [:builder] else xml = Builder::XmlMarkup.new(:indent=>2) xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8" end xml.line do |line| line.qty self.qty if @qty line.prodCode self.prodCode if @prodCode line.desc self.desc if @desc line.unitPrice self.unitPrice if @unitPrice line.discount self.discount if @discount line.tax self.tax if @tax end end |