Class: Twilio::REST::Verify::V2::SafelistInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/verify/v2/safelist.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, phone_number: nil) ⇒ SafelistInstance

Initialize the SafelistInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Safelist resource.

  • sid (String)

    The SID of the Call resource to fetch.



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 354

def initialize(version, payload , phone_number: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'phone_number' => payload['phone_number'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'phone_number' => phone_number  || @properties['phone_number']  , }
end

Instance Method Details

#contextSafelistContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



374
375
376
377
378
379
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 374

def context
    unless @instance_context
        @instance_context = SafelistContext.new(@version , @params['phone_number'])
    end
    @instance_context
end

#deleteBoolean

Delete the SafelistInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



402
403
404
405
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 402

def delete

    context.delete
end

#fetchSafelistInstance

Fetch the SafelistInstance

Returns:



410
411
412
413
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 410

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



424
425
426
427
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 424

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Verify.V2.SafelistInstance #{values}>"
end

#phone_numberString

Returns The phone number in SafeList.

Returns:

  • (String)

    The phone number in SafeList.



389
390
391
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 389

def phone_number
    @properties['phone_number']
end

#sidString

Returns The unique string that we created to identify the SafeList resource.

Returns:

  • (String)

    The unique string that we created to identify the SafeList resource.



383
384
385
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 383

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



417
418
419
420
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 417

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Verify.V2.SafelistInstance #{values}>"
end

#urlString

Returns The absolute URL of the SafeList resource.

Returns:

  • (String)

    The absolute URL of the SafeList resource.



395
396
397
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 395

def url
    @properties['url']
end