Class: Twilio::REST::Notify::V1::ServiceContext::NotificationList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/notify/v1/service/notification.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid: nil) ⇒ NotificationList

Initialize the NotificationList



20
21
22
23
24
25
26
27
28
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 20

def initialize(version, service_sid: nil)
  super(version)

  # Path Solution
  @solution = {
      service_sid: service_sid
  }
  @uri = "/Services/#{@solution[:service_sid]}/Notifications"
end

Instance Method Details

#create(body: :unset, priority: :unset, ttl: :unset, title: :unset, sound: :unset, action: :unset, data: :unset, apn: :unset, gcm: :unset, sms: :unset, facebook_messenger: :unset, fcm: :unset, segment: :unset, alexa: :unset, to_binding: :unset, identity: :unset, tag: :unset) ⇒ NotificationInstance

Retrieve a single page of NotificationInstance records from the API. Request is executed immediately.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 51

def create(body: :unset, priority: :unset, ttl: :unset, title: :unset, sound: :unset, action: :unset, data: :unset, apn: :unset, gcm: :unset, sms: :unset, facebook_messenger: :unset, fcm: :unset, segment: :unset, alexa: :unset, to_binding: :unset, identity: :unset, tag: :unset)
  data = Twilio::Values.of({
      'Identity' => identity,
      'Tag' => tag,
      'Body' => body,
      'Priority' => priority,
      'Ttl' => ttl,
      'Title' => title,
      'Sound' => sound,
      'Action' => action,
      'Data' => Twilio.serialize_object(data),
      'Apn' => Twilio.serialize_object(apn),
      'Gcm' => Twilio.serialize_object(gcm),
      'Sms' => Twilio.serialize_object(sms),
      'FacebookMessenger' => Twilio.serialize_object(facebook_messenger),
      'Fcm' => Twilio.serialize_object(fcm),
      'Segment' => segment,
      'Alexa' => Twilio.serialize_object(alexa),
      'ToBinding' => to_binding,
  })

  payload = @version.create(
      'POST',
      @uri,
      data: data
  )

  NotificationInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
  )
end

#to_sObject

Provide a user friendly representation



87
88
89
# File 'lib/twilio-ruby/rest/notify/v1/service/notification.rb', line 87

def to_s
  '#<Twilio.Notify.V1.NotificationList>'
end