class Smsbroadcast::SmsResponse

Attributes

message[R]
number[R]
ref[R]
status[R]

Public Class Methods

new(response_string) click to toggle source
# File lib/smsbroadcast/sms_response.rb, line 6
def initialize(response_string)
  @response_string = response_string
  parse_response
end

Private Instance Methods

parse_response() click to toggle source
# File lib/smsbroadcast/sms_response.rb, line 13
def parse_response
  arry = @response_string.split(":")
  @status = arry.first.downcase.to_sym

  case @status
  when :ok
    @number  = arry[1]
    @ref     = arry[2]
  when :bad
    @number  = arry[1]
    @message = arry[2]
  when :error
    @message = arry[1]
  end
end