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.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 134

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'],
        'messaging_carrier' => payload['messaging_carrier'],
        'voice_carrier' => payload['voice_carrier'],
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

Returns The target account sid to which the number will be ported.

Returns:

  • (String)

    The target account sid to which the number will be ported



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

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:



161
162
163
164
165
166
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 161

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.



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

def country
    @properties['country']
end

#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:



238
239
240
241
242
243
244
245
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 238

def fetch(
    target_account_sid: :unset
)

    context.fetch(
        target_account_sid: , 
    )
end

#inspectObject

Provide a detailed, user friendly representation



256
257
258
259
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 256

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

#messaging_carrierString

Returns Current messaging carrier of the phone number.

Returns:

  • (String)

    Current messaging carrier of the phone number



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

def messaging_carrier
    @properties['messaging_carrier']
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.



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

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. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`.

Returns:

  • (String)

    The Portability Reason Code for the phone number if it cannot be ported into Twilio, ‘null` otherwise. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`.



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

def not_portable_reason_code
    @properties['not_portable_reason_code']
end

#number_typeNumberType

Returns:

  • (NumberType)


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

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).



170
171
172
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 170

def phone_number
    @properties['phone_number']
end

#pin_and_account_number_requiredBoolean

Returns Boolean flag specifying if PIN and account number is required for the phone number.

Returns:

  • (Boolean)

    Boolean flag specifying if PIN and account number is required for the phone number.



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

def 
    @properties['pin_and_account_number_required']
end

#portableBoolean

Returns Boolean flag specifying if phone number is portable or not.

Returns:

  • (Boolean)

    Boolean flag specifying if phone number is portable or not.



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

def portable
    @properties['portable']
end

#to_sObject

Provide a user friendly representation



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

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.



230
231
232
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 230

def url
    @properties['url']
end

#voice_carrierString

Returns Current voice carrier of the phone number.

Returns:

  • (String)

    Current voice carrier of the phone number



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

def voice_carrier
    @properties['voice_carrier']
end