Class: Twilio::REST::Verify::V2::ServiceContext::EntityContext::ChallengeContext::NotificationList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/verify/v2/service/entity/challenge/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, identity: nil, challenge_sid: nil) ⇒ NotificationList

Initialize the NotificationList

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String) (defaults to: nil)

    The unique SID identifier of the Service.

  • identity (String) (defaults to: nil)

    Customer unique identity for the Entity owner of the Challenge. This value must be between 8 and 64 characters long.

  • challenge_sid (String) (defaults to: nil)

    The unique SID identifier of the Challenge.


27
28
29
30
31
32
33
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb', line 27

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

  # Path Solution
  @solution = {service_sid: service_sid, identity: identity, challenge_sid: challenge_sid}
  @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}/Challenges/#{@solution[:challenge_sid]}/Notifications"
end

Instance Method Details

#create(ttl: :unset) ⇒ NotificationInstance

Create the NotificationInstance

Parameters:

  • ttl (String) (defaults to: :unset)

    How long, in seconds, the notification is valid. Can be an integer between 0 and 300. Default is 300. Delivery is attempted until the TTL elapses, even if the device is offline. 0 means that the notification delivery is attempted immediately, only once, and is not stored for future delivery.

Returns:


42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb', line 42

def create(ttl: :unset)
  data = Twilio::Values.of({'Ttl' => ttl, })

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

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

#to_sObject

Provide a user friendly representation


58
59
60
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb', line 58

def to_s
  '#<Twilio.Verify.V2.NotificationList>'
end