Class: XmlConv::I2::Position
- Inherits:
-
Object
- Object
- XmlConv::I2::Position
- Defined in:
- lib/xmlconv/i2/position.rb
Instance Attribute Summary collapse
-
#article_ean ⇒ Object
Returns the value of attribute article_ean.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#delivery_date ⇒ Object
Returns the value of attribute delivery_date.
-
#free_text ⇒ Object
Returns the value of attribute free_text.
-
#number ⇒ Object
Returns the value of attribute number.
-
#pharmacode ⇒ Object
Returns the value of attribute pharmacode.
-
#price ⇒ Object
Returns the value of attribute price.
-
#qty ⇒ Object
Returns the value of attribute qty.
-
#unit ⇒ Object
Returns the value of attribute unit.
Instance Method Summary collapse
Instance Attribute Details
#article_ean ⇒ Object
Returns the value of attribute article_ean.
9 10 11 |
# File 'lib/xmlconv/i2/position.rb', line 9 def article_ean @article_ean end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
9 10 11 |
# File 'lib/xmlconv/i2/position.rb', line 9 def customer_id @customer_id end |
#delivery_date ⇒ Object
Returns the value of attribute delivery_date.
11 12 13 |
# File 'lib/xmlconv/i2/position.rb', line 11 def delivery_date @delivery_date end |
#free_text ⇒ Object
Returns the value of attribute free_text.
9 10 11 |
# File 'lib/xmlconv/i2/position.rb', line 9 def free_text @free_text end |
#number ⇒ Object
Returns the value of attribute number.
9 10 11 |
# File 'lib/xmlconv/i2/position.rb', line 9 def number @number end |
#pharmacode ⇒ Object
Returns the value of attribute pharmacode.
9 10 11 |
# File 'lib/xmlconv/i2/position.rb', line 9 def pharmacode @pharmacode end |
#price ⇒ Object
Returns the value of attribute price.
9 10 11 |
# File 'lib/xmlconv/i2/position.rb', line 9 def price @price end |
#qty ⇒ Object
Returns the value of attribute qty.
9 10 11 |
# File 'lib/xmlconv/i2/position.rb', line 9 def qty @qty end |
#unit ⇒ Object
Returns the value of attribute unit.
9 10 11 |
# File 'lib/xmlconv/i2/position.rb', line 9 def unit @unit end |
Instance Method Details
#to_s ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/xmlconv/i2/position.rb', line 16 def to_s output = <<-EOS 500:#{@number} EOS # output << "501:#{@article_ean}\n" [@customer_id, @pharmacode].compact.each { |id| #output << sprintf("502:%s\n", id) output << sprintf("501:%s\n", id) } output << sprintf("520:%s\n", @qty) if(@unit) output << sprintf("521:%s\n", @unit) end if(@delivery_date.is_a?(I2::Date)) output << @delivery_date.to_s end if(@price) output << sprintf("604:%s\n", @price) end if(@free_text) output << "605:RS\n" txt = @free_text[0,280] ## upper limit: 40 lines of 70 chars while(!txt.empty?) output << sprintf("606:%s\n", txt.slice!(0,70)) end end output end |