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

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/verify/v2/safelist.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, payload, phone_number: nil) ⇒ SafelistInstance

Initialize the SafelistInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • phone_number (String) (defaults to: nil)

    The phone number to be fetched from SafeList. Phone numbers must be in E.164 format.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 140

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:



159
160
161
162
163
164
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 159

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



194
195
196
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 194

def delete
  context.delete
end

#fetchSafelistInstance

Fetch the SafelistInstance

Returns:



187
188
189
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 187

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



207
208
209
210
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 207

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.



174
175
176
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 174

def phone_number
  @properties['phone_number']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource.



168
169
170
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 168

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



200
201
202
203
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 200

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.



180
181
182
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 180

def url
  @properties['url']
end