Sha256: f395c2504c037cfddaa64d1583ee3fad419c803169892b01cd3352f882408c72

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 KB

Contents

require 'urbanairship'
require 'json'

module Urbanairship
  module Devices
    class SmsNotification
      include Urbanairship::Common
      include Urbanairship::Loggable

      attr_accessor :sms_alert,
                    :generic_alert,
                    :expiry,
                    :shorten_links,
                    :template_id

      def initialize(client: required('client'))
        @client = client
      end

      def sms_notification_override
        {
           "alert": generic_alert,
           "sms": {
              "alert": sms_alert,
              "expiry": expiry,
              "shorten_links": shorten_links
           }
        }
      end

      def sms_inline_template
        inline_template = {
          "sms": {
            "template": {}
          }
        }

        if @template_id
          inline_template[:sms][:template][:template_id] = @template_id
        end

        if @sms_alert
          inline_fields= {
            "fields": {"alert": @sms_alert}
          }
          inline_template[:sms][:template] = inline_fields
        end
        
        inline_template
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
urbanairship-9.2.0 lib/urbanairship/devices/sms_notification.rb
urbanairship-9.1.1 lib/urbanairship/devices/sms_notification.rb
urbanairship-9.1.0 lib/urbanairship/devices/sms_notification.rb
urbanairship-9.0.0 lib/urbanairship/devices/sms_notification.rb
urbanairship-8.0.1 lib/urbanairship/devices/sms_notification.rb
urbanairship-8.0.0 lib/urbanairship/devices/sms_notification.rb
urbanairship-7.0.0 lib/urbanairship/devices/sms_notification.rb
urbanairship-6.0.0 lib/urbanairship/devices/sms_notification.rb
urbanairship-5.9.0 lib/urbanairship/devices/sms_notification.rb
urbanairship-5.8.0 lib/urbanairship/devices/sms_notification.rb
urbanairship-5.7.0 lib/urbanairship/devices/sms_notification.rb
urbanairship-5.6.1 lib/urbanairship/devices/sms_notification.rb
urbanairship-5.6.0 lib/urbanairship/devices/sms_notification.rb