class Twilio::REST::Proxy::V1::ServiceContext::PhoneNumberContext

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

Public Class Methods

new(version, service_sid, sid) click to toggle source

Initialize the PhoneNumberContext @param [Version] version Version that contains the resource @param [String] service_sid The SID of the parent

{Service}[https://www.twilio.com/docs/proxy/api/service] of the PhoneNumber
resource to fetch.

@param [String] sid The Twilio-provided string that uniquely identifies the

PhoneNumber resource to fetch.

@return [PhoneNumberContext] PhoneNumberContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb
184 def initialize(version, service_sid, sid)
185   super(version)
186 
187   # Path Solution
188   @solution = {service_sid: service_sid, sid: sid, }
189   @uri = "/Services/#{@solution[:service_sid]}/PhoneNumbers/#{@solution[:sid]}"
190 end

Public Instance Methods

delete() click to toggle source

Delete the PhoneNumberInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb
195 def delete
196    @version.delete('DELETE', @uri)
197 end
fetch() click to toggle source

Fetch the PhoneNumberInstance @return [PhoneNumberInstance] Fetched PhoneNumberInstance

    # File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb
202 def fetch
203   payload = @version.fetch('GET', @uri)
204 
205   PhoneNumberInstance.new(
206       @version,
207       payload,
208       service_sid: @solution[:service_sid],
209       sid: @solution[:sid],
210   )
211 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb
242 def inspect
243   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
244   "#<Twilio.Proxy.V1.PhoneNumberContext #{context}>"
245 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb
235 def to_s
236   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
237   "#<Twilio.Proxy.V1.PhoneNumberContext #{context}>"
238 end
update(is_reserved: :unset) click to toggle source

Update the PhoneNumberInstance @param [Boolean] is_reserved Whether the phone number should be reserved and not

be assigned to a participant using proxy pool logic. See {Reserved Phone
Numbers}[https://www.twilio.com/docs/proxy/reserved-phone-numbers] for more
information.

@return [PhoneNumberInstance] Updated PhoneNumberInstance

    # File lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb
220 def update(is_reserved: :unset)
221   data = Twilio::Values.of({'IsReserved' => is_reserved, })
222 
223   payload = @version.update('POST', @uri, data: data)
224 
225   PhoneNumberInstance.new(
226       @version,
227       payload,
228       service_sid: @solution[:service_sid],
229       sid: @solution[:sid],
230   )
231 end