Class: Twilio::REST::Numbers::V1::PortingPortabilityContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/numbers/v1/porting_portability.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, phone_number) ⇒ PortingPortabilityContext

Initialize the PortingPortabilityContext

Parameters:

  • version (Version)

    Version that contains the resource

  • phone_number (String)

    The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212).



50
51
52
53
54
55
56
57
58
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 50

def initialize(version, phone_number)
    super(version)

    # Path Solution
    @solution = { phone_number: phone_number,  }
    @uri = "/Porting/Portability/PhoneNumber/#{CGI.escape(@solution[:phone_number]).gsub("+", "%20")}"

    
end

Instance Method Details

#fetch(target_account_sid: :unset) ⇒ PortingPortabilityInstance

Fetch the PortingPortabilityInstance

Parameters:

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

    The SID of the account where the phone number(s) will be ported.

Returns:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 63

def fetch(
    target_account_sid: :unset
)

    params = Twilio::Values.of({
        'TargetAccountSid' => ,
    })
    payload = @version.fetch('GET', @uri, params: params)
    PortingPortabilityInstance.new(
        @version,
        payload,
        phone_number: @solution[:phone_number],
    )
end

#inspectObject

Provide a detailed, user friendly representation



88
89
90
91
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 88

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Numbers.V1.PortingPortabilityContext #{context}>"
end

#to_sObject

Provide a user friendly representation



81
82
83
84
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 81

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Numbers.V1.PortingPortabilityContext #{context}>"
end