Class: XmlConv::I2::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/xmlconv/i2/header.rb

Constant Summary collapse

TRANSACTION_TIME_FORMAT =
'%Y%m%d%H%M'

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#filenameObject

Returns the value of attribute filename.



9
10
11
# File 'lib/xmlconv/i2/header.rb', line 9

def filename
  @filename
end

#prefixObject

Returns the value of attribute prefix.



9
10
11
# File 'lib/xmlconv/i2/header.rb', line 9

def prefix
  @prefix
end

#recipient_idObject

Returns the value of attribute recipient_id.



9
10
11
# File 'lib/xmlconv/i2/header.rb', line 9

def recipient_id
  @recipient_id
end

#suffixObject

Returns the value of attribute suffix.



10
11
12
# File 'lib/xmlconv/i2/header.rb', line 10

def suffix
  @suffix
end

#transaction_idObject

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_sObject



25
26
27
28
29
30
31
32
# File 'lib/xmlconv/i2/header.rb', line 25

def to_s
	<<-EOS
001:#{@recipient_id}
002:ORDERX
003:220
010:#{filename}
	EOS
end