Class: PduSms::ServiceCenterTimeStamp
- Inherits:
-
Object
- Object
- PduSms::ServiceCenterTimeStamp
- Defined in:
- lib/pdu_sms/service_center_time_stamp.rb
Class Method Summary collapse
-
.cut_off_pdu(pdu, part = :all, type = :sс) ⇒ Object
tail current.
- .decode_sc(pdu_str) ⇒ Object
- .encode_sc(times) ⇒ Object
Instance Method Summary collapse
- #get_hex ⇒ Object
- #get_time ⇒ Object
-
#initialize(type, data) ⇒ ServiceCenterTimeStamp
constructor
A new instance of ServiceCenterTimeStamp.
Constructor Details
#initialize(type, data) ⇒ ServiceCenterTimeStamp
Returns a new instance of ServiceCenterTimeStamp.
7 8 9 10 11 12 13 14 15 |
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 7 def initialize(type, data) if type == :encode_sc @scts = data elsif type == :decode_sc @scts = data else raise ArgumentError, 'The "type" is incorrect' end end |
Class Method Details
.cut_off_pdu(pdu, part = :all, type = :sс) ⇒ Object
tail current
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 26 def ServiceCenterTimeStamp.cut_off_pdu(pdu, part=:all, type=:s |
.decode_sc(pdu_str) ⇒ Object
21 22 23 24 |
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 21 def ServiceCenterTimeStamp.decode_sc(pdu_str) scts = ServiceCenterTimeStamp.cut_off_pdu(pdu_str, part=:current, :s |
.encode_sc(times) ⇒ Object
17 18 19 |
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 17 def ServiceCenterTimeStamp.encode_sc(times) new(:encode_sc, times).freeze end |
Instance Method Details
#get_hex ⇒ Object
38 39 40 |
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 38 def get_hex @scts end |
#get_time ⇒ Object
42 43 44 |
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 42 def get_time _absolute_pdu @scts end |