class Smpp::OptionalParameter

Attributes

tag[R]
value[R]

Public Class Methods

from_wire_data(data) click to toggle source
# File lib/smpp/optional_parameter.rb, line 20
def from_wire_data(data)

  return nil if data.nil?
  tag, length, remaining_bytes = data.unpack('H4na*')
  tag = tag.hex

  if tag == 0 || length.nil?
    Smpp::Base.logger.error "invalid data, cannot parse optional parameters tag: #{tag} length:#{length}"
    length = length.to_i
  end

  value = remaining_bytes.slice!(0...length)

  return new(tag, value), remaining_bytes
end
new(tag, value) click to toggle source
# File lib/smpp/optional_parameter.rb, line 5
def initialize(tag, value)
  @tag = tag
  @value = value
end

Public Instance Methods

[](symbol) click to toggle source
# File lib/smpp/optional_parameter.rb, line 10
def [](symbol)
  self.send symbol
end
to_s() click to toggle source
# File lib/smpp/optional_parameter.rb, line 14
def to_s
  self.inspect
end