Class: Empp::MsgSubmit
Instance Attribute Summary collapse
-
#msg_id ⇒ Object
Returns the value of attribute msg_id.
-
#pk_number ⇒ Object
Returns the value of attribute pk_number.
-
#pk_total ⇒ Object
Returns the value of attribute pk_total.
-
#sequence_ids ⇒ Object
Returns the value of attribute sequence_ids.
-
#terminal_id ⇒ Object
Returns the value of attribute terminal_id.
Attributes inherited from EmppBase
#command_id, #sequence_id, #total_length
Instance Method Summary collapse
-
#initialize(terminal_id, message, account_id, service_id) ⇒ MsgSubmit
constructor
A new instance of MsgSubmit.
- #package ⇒ Object
Constructor Details
#initialize(terminal_id, message, account_id, service_id) ⇒ MsgSubmit
Returns a new instance of MsgSubmit.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/empp/msg_submit.rb', line 14 def initialize(terminal_id, , account_id, service_id) @command_id = Constants::EMPP_SUBMIT @terminal_id = terminal_id @account_id = account_id @service_id = service_id @message = Utils::Utils.convert_utf8_to_gbk() @splitted_messages = Utils::Utils.get_splitted_msgs(@message) @sequence_ids = [] # assign sequence_id for each slice @splitted_messages.each do |msg| setSequenceId @sequence_ids << @sequence_id end @msg_id = Time.now.to_i.to_s[0...10] @pk_total = @splitted_messages.length @pk_number = 1 @logger = EmppLogger.instance end |
Instance Attribute Details
#msg_id ⇒ Object
Returns the value of attribute msg_id.
12 13 14 |
# File 'lib/empp/msg_submit.rb', line 12 def msg_id @msg_id end |
#pk_number ⇒ Object
Returns the value of attribute pk_number.
12 13 14 |
# File 'lib/empp/msg_submit.rb', line 12 def pk_number @pk_number end |
#pk_total ⇒ Object
Returns the value of attribute pk_total.
12 13 14 |
# File 'lib/empp/msg_submit.rb', line 12 def pk_total @pk_total end |
#sequence_ids ⇒ Object
Returns the value of attribute sequence_ids.
12 13 14 |
# File 'lib/empp/msg_submit.rb', line 12 def sequence_ids @sequence_ids end |
#terminal_id ⇒ Object
Returns the value of attribute terminal_id.
12 13 14 |
# File 'lib/empp/msg_submit.rb', line 12 def terminal_id @terminal_id end |
Instance Method Details
#package ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/empp/msg_submit.rb', line 36 def package @logger.debug("Enter MsgSubmit::package") tmp_buf = '' index = 0 @splitted_messages.each do |msg| @sequence_id = @sequence_ids[index] index += 1 tmp_buf << package_msg(msg) end @logger.debug("Leave MsgSubmit::package") tmp_buf end |