Sha256: c00ea832cdd4e6a996fcdf381cf4e102d5e34946dd055b60d028380e00733ba5

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

module Outbox
  module Messages
    # SMS tend to support very different types of parameters, so only
    # the most common ones will be directly applied to the SMS message class.
    # All of the other ones can be set using the arbitrary field access with
    # [] and []=.
    #
    #   sms = Outbox::Messages::SMS.new do
    #     to '+14155551212'
    #     from 'Company Name'
    #     body 'Hellow world'
    #   end
    #   sms.client :twilio, api_key: '...'
    #   sms.deliver
    class SMS < Base
      required_fields :to, :from, :body

      def audience=(audience) # :nodoc:
        case audience
        when String
          self.to = audience
        else
          audience = Outbox::Accessor.new(audience)
          self.to = audience[:to]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
outbox-0.2.1 lib/outbox/messages/sms.rb
outbox-0.2.0 lib/outbox/messages/sms.rb