Class: Twilio::REST::Lookups::V1::PhoneNumberInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Lookups::V1::PhoneNumberInstance
- Defined in:
- lib/twilio-ruby/rest/lookups/v1/phone_number.rb
Instance Method Summary collapse
-
#add_ons ⇒ Hash
A JSON string with the results of the Add-ons you specified in the
add_onsparameters. -
#caller_name ⇒ Hash
The name of the phone number's owner.
-
#carrier ⇒ Hash
The telecom company that provides the phone number.
-
#context ⇒ PhoneNumberContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#country_code ⇒ String
The ISO country code for the phone number.
-
#fetch(country_code: :unset, type: :unset, add_ons: :unset, add_ons_data: :unset) ⇒ PhoneNumberInstance
Fetch the PhoneNumberInstance.
-
#initialize(version, payload, phone_number: nil) ⇒ PhoneNumberInstance
constructor
Initialize the PhoneNumberInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#national_format ⇒ String
The phone number, in national format.
-
#phone_number ⇒ String
The phone number in E.164 format, which consists of a + followed by the country code and subscriber number.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#url ⇒ String
The absolute URL of the resource.
Constructor Details
#initialize(version, payload, phone_number: nil) ⇒ PhoneNumberInstance
Initialize the PhoneNumberInstance
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 237 def initialize(version, payload , phone_number: nil) super(version) # Marshaled Properties @properties = { 'caller_name' => payload['caller_name'], 'country_code' => payload['country_code'], 'phone_number' => payload['phone_number'], 'national_format' => payload['national_format'], 'carrier' => payload['carrier'], 'add_ons' => payload['add_ons'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'phone_number' => phone_number || @properties['phone_number'] , } end |
Instance Method Details
#add_ons ⇒ Hash
Returns A JSON string with the results of the Add-ons you specified in the add_ons parameters. For the format of the object, see Using Add-ons.
300 301 302 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 300 def add_ons @properties['add_ons'] end |
#caller_name ⇒ Hash
Returns The name of the phone number's owner. If null, that information was not available.
270 271 272 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 270 def caller_name @properties['caller_name'] end |
#carrier ⇒ Hash
Returns The telecom company that provides the phone number.
294 295 296 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 294 def carrier @properties['carrier'] end |
#context ⇒ PhoneNumberContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
261 262 263 264 265 266 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 261 def context unless @instance_context @instance_context = PhoneNumberContext.new(@version , @params['phone_number']) end @instance_context end |
#country_code ⇒ String
Returns The ISO country code for the phone number.
276 277 278 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 276 def country_code @properties['country_code'] end |
#fetch(country_code: :unset, type: :unset, add_ons: :unset, add_ons_data: :unset) ⇒ PhoneNumberInstance
Fetch the PhoneNumberInstance
317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 317 def fetch( country_code: :unset, type: :unset, add_ons: :unset, add_ons_data: :unset ) context.fetch( country_code: country_code, type: type, add_ons: add_ons, add_ons_data: add_ons_data, ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
341 342 343 344 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 341 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Lookups.V1.PhoneNumberInstance #{values}>" end |
#national_format ⇒ String
Returns The phone number, in national format.
288 289 290 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 288 def national_format @properties['national_format'] end |
#phone_number ⇒ String
Returns The phone number in E.164 format, which consists of a + followed by the country code and subscriber number.
282 283 284 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 282 def phone_number @properties['phone_number'] end |
#to_s ⇒ Object
Provide a user friendly representation
334 335 336 337 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 334 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Lookups.V1.PhoneNumberInstance #{values}>" end |
#url ⇒ String
Returns The absolute URL of the resource.
306 307 308 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 306 def url @properties['url'] end |