Class: Twilio::REST::Numbers::V1::PortingPortabilityInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/numbers/v1/porting_portability.rb

Instance Method Summary collapse

Constructor Details

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

Initialize the PortingPortabilityInstance

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 PortingPortability resource.

  • sid (String)

    The SID of the Call resource to fetch.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 140

def initialize(version, payload , phone_number: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'phone_number' => payload['phone_number'],
        'account_sid' => payload['account_sid'],
        'portable' => payload['portable'],
        'pin_and_account_number_required' => payload['pin_and_account_number_required'],
        'not_portable_reason' => payload['not_portable_reason'],
        'not_portable_reason_code' => payload['not_portable_reason_code'] == nil ? payload['not_portable_reason_code'] : payload['not_portable_reason_code'].to_i,
        'number_type' => payload['number_type'],
        'country' => payload['country'],
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

Returns Account Sid that the phone number belongs to in Twilio. This is only returned for phone numbers that already exist in Twilio’s inventory and belong to your account or sub account.

Returns:

  • (String)

    Account Sid that the phone number belongs to in Twilio. This is only returned for phone numbers that already exist in Twilio’s inventory and belong to your account or sub account.



180
181
182
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 180

def 
    @properties['account_sid']
end

#contextPortingPortabilityContext

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

Returns:



165
166
167
168
169
170
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 165

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

#countryString

Returns Country the phone number belongs to.

Returns:

  • (String)

    Country the phone number belongs to.



216
217
218
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 216

def country
    @properties['country']
end

#fetch(target_account_sid: :unset, address_sid: :unset) ⇒ PortingPortabilityInstance

Fetch the PortingPortabilityInstance

Parameters:

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

    Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account.

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

    Address Sid of customer to which the number will be ported.

Returns:



231
232
233
234
235
236
237
238
239
240
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 231

def fetch(
    target_account_sid: :unset, 
    address_sid: :unset
)

    context.fetch(
        target_account_sid: , 
        address_sid: address_sid, 
    )
end

#inspectObject

Provide a detailed, user friendly representation



251
252
253
254
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 251

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

#not_portable_reasonString

Returns Reason why the phone number cannot be ported into Twilio, ‘null` otherwise.

Returns:

  • (String)

    Reason why the phone number cannot be ported into Twilio, ‘null` otherwise.



198
199
200
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 198

def not_portable_reason
    @properties['not_portable_reason']
end

#not_portable_reason_codeString

Returns The Portability Reason Code for the phone number if it cannot be ported into Twilio, ‘null` otherwise.

Returns:

  • (String)

    The Portability Reason Code for the phone number if it cannot be ported into Twilio, ‘null` otherwise.



204
205
206
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 204

def not_portable_reason_code
    @properties['not_portable_reason_code']
end

#number_typeNumberType

Returns:

  • (NumberType)


210
211
212
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 210

def number_type
    @properties['number_type']
end

#phone_numberString

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

Returns:

  • (String)

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



174
175
176
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 174

def phone_number
    @properties['phone_number']
end

#pin_and_account_number_requiredBoolean

Returns Indicates if the port in process will require a personal identification number (PIN) and an account number for this phone number. If this is true you will be required to submit both a PIN and account number from the losing carrier for this number when opening a port in request. These fields will be required in order to complete the port in process to Twilio.

Returns:

  • (Boolean)

    Indicates if the port in process will require a personal identification number (PIN) and an account number for this phone number. If this is true you will be required to submit both a PIN and account number from the losing carrier for this number when opening a port in request. These fields will be required in order to complete the port in process to Twilio.



192
193
194
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 192

def 
    @properties['pin_and_account_number_required']
end

#portableBoolean

Returns Boolean flag indicates if the phone number can be ported into Twilio through the Porting API or not.

Returns:

  • (Boolean)

    Boolean flag indicates if the phone number can be ported into Twilio through the Porting API or not.



186
187
188
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 186

def portable
    @properties['portable']
end

#to_sObject

Provide a user friendly representation



244
245
246
247
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 244

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

#urlString

Returns This is the url of the request that you’re trying to reach out to locate the resource.

Returns:

  • (String)

    This is the url of the request that you’re trying to reach out to locate the resource.



222
223
224
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 222

def url
    @properties['url']
end