Sha256: 81ccbc0cb9bc2ca0a7dd14b1c3462be6192122bf48e01b577fd9246d2672a073

Contents?: true

Size: 558 Bytes

Versions: 9

Compression:

Stored size: 558 Bytes

Contents

module Smess
  class Sms

    attr_accessor :to, :message, :originator, :output, :results

    def initialize(*args)
      opts = args.first || {}
      @to = opts.fetch(:to, nil)
      @message = opts.fetch(:message, "")
      @originator = opts.fetch(:originator, nil)
      @output = opts.fetch(:output, :auto).to_sym
    end

    def deliver
      out = Smess.named_output_instance(output)
      out.sms = self
      self.results = {sent_with: output}.merge(out.deliver)
    end

    def delivered?
      results[:response_code] == "0"
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
smess-2.0.8 lib/smess/sms.rb
smess-2.0.7 lib/smess/sms.rb
smess-2.0.6 lib/smess/sms.rb
smess-2.0.5 lib/smess/sms.rb
smess-2.0.4 lib/smess/sms.rb
smess-2.0.3 lib/smess/sms.rb
smess-2.0.2 lib/smess/sms.rb
smess-2.0.1 lib/smess/sms.rb
smess-2.0 lib/smess/sms.rb