Class: Urbanairship::Devices::SmsNotification

Inherits:
Object
  • Object
show all
Includes:
Common, Loggable
Defined in:
lib/urbanairship/devices/sms_notification.rb

Constant Summary

Constants included from Common

Common::CONTENT_TYPE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Loggable

create_logger, logger, #logger

Methods included from Common

#apid_path, #channel_path, #compact_helper, #create_and_send_path, #custom_events_path, #device_token_path, #experiments_path, #lists_path, #named_users_path, #open_channel_path, #pipelines_path, #push_path, #reports_path, #required, #schedules_path, #segments_path, #tag_lists_path, #try_helper

Constructor Details

#initialize(client: required('client')) ⇒ SmsNotification

Returns a new instance of SmsNotification.



16
17
18
# File 'lib/urbanairship/devices/sms_notification.rb', line 16

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

Instance Attribute Details

#expiryObject

Returns the value of attribute expiry.



10
11
12
# File 'lib/urbanairship/devices/sms_notification.rb', line 10

def expiry
  @expiry
end

#generic_alertObject

Returns the value of attribute generic_alert.



10
11
12
# File 'lib/urbanairship/devices/sms_notification.rb', line 10

def generic_alert
  @generic_alert
end

Returns the value of attribute shorten_links.



10
11
12
# File 'lib/urbanairship/devices/sms_notification.rb', line 10

def shorten_links
  @shorten_links
end

#sms_alertObject

Returns the value of attribute sms_alert.



10
11
12
# File 'lib/urbanairship/devices/sms_notification.rb', line 10

def sms_alert
  @sms_alert
end

#template_idObject

Returns the value of attribute template_id.



10
11
12
# File 'lib/urbanairship/devices/sms_notification.rb', line 10

def template_id
  @template_id
end

Instance Method Details

#sms_inline_templateObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/urbanairship/devices/sms_notification.rb', line 31

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

#sms_notification_overrideObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/urbanairship/devices/sms_notification.rb', line 20

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