Class: Smpp::Pdu::SubmitSmResponse

Inherits:
Base
  • Object
show all
Defined in:
lib/smpp/pdu/submit_sm_response.rb

Constant Summary

Constants inherited from Base

Base::BIND_RECEIVER, Base::BIND_RECEIVER_RESP, Base::BIND_TRANSCEIVER, Base::BIND_TRANSCEIVER_RESP, Base::BIND_TRANSMITTER, Base::BIND_TRANSMITTER_RESP, Base::CANCEL_SM, Base::CANCEL_SM_RESP, Base::DELIVER_SM, Base::DELIVER_SM_RESP, Base::ENQUIRE_LINK, Base::ENQUIRE_LINK_RESP, Base::ESME_RALYBND, Base::ESME_RBINDFAIL, Base::ESME_RCANCELFAIL, Base::ESME_RCNTSUBDL, Base::ESME_RINVBNDSTS, Base::ESME_RINVCMDID, Base::ESME_RINVCMDLEN, Base::ESME_RINVDESTFLAG, Base::ESME_RINVDLNAME, Base::ESME_RINVDSTADR, Base::ESME_RINVDSTNPI, Base::ESME_RINVDSTTON, Base::ESME_RINVESMCLASS, Base::ESME_RINVMSGID, Base::ESME_RINVMSGLEN, Base::ESME_RINVNUMDESTS, Base::ESME_RINVNUMMSGS, Base::ESME_RINVPASWD, Base::ESME_RINVPRTFLG, Base::ESME_RINVREGDLVFLG, Base::ESME_RINVREPFLAG, Base::ESME_RINVSERTYP, Base::ESME_RINVSRCADR, Base::ESME_RINVSRCNPI, Base::ESME_RINVSRCTON, Base::ESME_RINVSUBREP, Base::ESME_RINVSYSID, Base::ESME_RINVSYSTYP, Base::ESME_RMSGQFUL, Base::ESME_ROK, Base::ESME_RREPLACEFAIL, Base::ESME_RSUBMITFAIL, Base::ESME_RSYSERR, Base::ESME_RTHROTTLED, Base::ESME_RX_T_APPN, Base::GENERIC_NACK, Base::OPTIONAL_MESSAGE_STATE, Base::OPTIONAL_RECEIPTED_MESSAGE_ID, Base::PROTOCOL_VERSION, Base::QUERY_SM, Base::QUERY_SM_RESP, Base::REPLACE_SM, Base::REPLACE_SM_RESP, Base::SEQUENCE_MAX, Base::SUBMIT_MULTI, Base::SUBMIT_MULTI_RESP, Base::SUBMIT_SM, Base::SUBMIT_SM_RESP, Base::UNBIND, Base::UNBIND_RESP

Instance Attribute Summary collapse

Attributes inherited from Base

#body, #command_id, #command_status, #data, #sequence_number

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

create, fixed_int, #fixed_int, handles_cmd, #logger, next_sequence_number, #next_sequence_number, #optional_parameters_to_buffer, optional_parameters_to_buffer, parse_optional_parameters, #to_human

Constructor Details

#initialize(seq, status, message_id, optional_parameters = nil) ⇒ SubmitSmResponse

Returns a new instance of SubmitSmResponse.



7
8
9
10
11
12
13
# File 'lib/smpp/pdu/submit_sm_response.rb', line 7

def initialize(seq, status, message_id, optional_parameters=nil)
  seq ||= next_sequence_number
  body = message_id.to_s + "\000"
  super(SUBMIT_SM_RESP, status, seq, body)
  @message_id = message_id
  @optional_parameters = optional_parameters
end

Instance Attribute Details

#message_idObject

Returns the value of attribute message_id.



4
5
6
# File 'lib/smpp/pdu/submit_sm_response.rb', line 4

def message_id
  @message_id
end

#optional_parametersObject

Returns the value of attribute optional_parameters.



5
6
7
# File 'lib/smpp/pdu/submit_sm_response.rb', line 5

def optional_parameters
  @optional_parameters
end

Class Method Details

.from_wire_data(seq, status, body) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/smpp/pdu/submit_sm_response.rb', line 23

def self.from_wire_data(seq, status, body)
  message_id, remaining_bytes = body.unpack("Z*a*")
  optionals = nil
  if remaining_bytes && !remaining_bytes.empty?
    optionals = parse_optional_parameters(remaining_bytes)
  end
  new(seq, status, message_id, optionals)
end

Instance Method Details

#optional_parameter(tag) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/smpp/pdu/submit_sm_response.rb', line 15

def optional_parameter(tag)
  if optional_parameters 
    if param = optional_parameters[tag]
      param.value
    end
  end
end