Module: ComunikaGsm::PDU

Includes:
ComunikaGsm
Defined in:
lib/comunika_gsm/pdu.rb

Defined Under Namespace

Classes: PDUDecode

Constant Summary

Constants included from ComunikaGsm

VERSION

Class Method Summary collapse

Class Method Details

.decode(pdu) ⇒ Object



11
12
13
14
# File 'lib/comunika_gsm/pdu.rb', line 11

def self.decode(pdu)
  result = @@pdu_converter.call("getPDUMetaInfo", pdu)
  self.parse_json(result)
end

.encode(num, message, params = {}) ⇒ Object



4
5
6
7
8
9
# File 'lib/comunika_gsm/pdu.rb', line 4

def self.encode(num, message, params = {})
  return unless message
  return unless num
  result = @@pdu_converter.call("stringToPDU",message,num,params[:smsc] || '',params[:ecoding] || 7,params[:sms_class] || 1,params[:valid],params[:deliver] || true,params[:valid_flag] || false)
  self.parse_json(result)
end

.parse_json(value) ⇒ Object



16
17
18
# File 'lib/comunika_gsm/pdu.rb', line 16

def self.parse_json(value)
  JSON.parse(value, :symbolize_names => true) ## Return hash with name in format symbol
end