Sha256: 06e14942402a33b77f55ba169ff5961a00e07a02820795da6bf4eb81442bafbc

Contents?: true

Size: 651 Bytes

Versions: 3

Compression:

Stored size: 651 Bytes

Contents

module Skuby
  class SMSResponse
    attr_reader :response, :text, :recipients

    def initialize(response, text, recipients)
      @response = CGI.parse(response)
      @text = text
      @recipients = Array(recipients)
    end

    def success?
      status == "success"
    end

    def sms_id?
      sms_id.present?
    end

    def status
      @response["status"].first
    end

    def remaining_sms
      @response["remaining_sms"].first.to_i
    end

    def sms_id
      @response["id"].first
    end

    def error_code
      @response["code"].first.to_i
    end

    def error_message
      @response["message"].first
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skuby-0.0.5 lib/skuby/sms_response.rb
skuby-0.0.4 lib/skuby/sms_response.rb
skuby-0.0.3 lib/skuby/sms_response.rb