Class: XmlConv::I2::Header
- Inherits:
-
Object
- Object
- XmlConv::I2::Header
- Defined in:
- lib/xmlconv/i2/header.rb
Constant Summary collapse
- TRANSACTION_TIME_FORMAT =
'%Y%m%d%H%M'
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#recipient_id ⇒ Object
Returns the value of attribute recipient_id.
-
#suffix ⇒ Object
Returns the value of attribute suffix.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
Instance Method Summary collapse
-
#initialize(recipient_id = 'EPIN_PL') ⇒ Header
constructor
A new instance of Header.
- #to_s ⇒ Object
Constructor Details
#initialize(recipient_id = 'EPIN_PL') ⇒ Header
Returns a new instance of Header.
11 12 13 14 15 16 17 18 |
# File 'lib/xmlconv/i2/header.rb', line 11 def initialize(recipient_id = 'EPIN_PL') @recipient_id = recipient_id @prefix = @recipient_id time = Time.now # msec = sprintf('%03i', (time.to_f * 1000).to_i % 100) #@transaction_id = time.strftime("%Y%m%d%H%M#{msec}") @transaction_id = time.strftime(TRANSACTION_TIME_FORMAT) end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
9 10 11 |
# File 'lib/xmlconv/i2/header.rb', line 9 def filename @filename end |
#prefix ⇒ Object
Returns the value of attribute prefix.
9 10 11 |
# File 'lib/xmlconv/i2/header.rb', line 9 def prefix @prefix end |
#recipient_id ⇒ Object
Returns the value of attribute recipient_id.
9 10 11 |
# File 'lib/xmlconv/i2/header.rb', line 9 def recipient_id @recipient_id end |
#suffix ⇒ Object
Returns the value of attribute suffix.
10 11 12 |
# File 'lib/xmlconv/i2/header.rb', line 10 def suffix @suffix end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
9 10 11 |
# File 'lib/xmlconv/i2/header.rb', line 9 def transaction_id @transaction_id end |
Instance Method Details
#to_s ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/xmlconv/i2/header.rb', line 25 def to_s "001:\#{@recipient_id}\n002:ORDERX\n003:220\n010:\#{filename}\n EOS\nend\n" |