Class: XmlConv::I2::Header

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(recipient_id = 'EPIN_PL') ⇒ Header

Returns a new instance of Header.



10
11
12
13
14
15
16
17
# File 'lib/xmlconv/i2/header.rb', line 10

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("%Y%m%d%H%M")
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



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

def filename
  @filename
end

#prefixObject

Returns the value of attribute prefix.



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

def prefix
  @prefix
end

#recipient_idObject

Returns the value of attribute recipient_id.



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

def recipient_id
  @recipient_id
end

#suffixObject

Returns the value of attribute suffix.



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

def suffix
  @suffix
end

#transaction_idObject

Returns the value of attribute transaction_id.



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

def transaction_id
  @transaction_id
end

Instance Method Details

#to_sObject



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

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