Class: Twilio::REST::Lookups::V2::PhoneNumberInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Lookups::V2::PhoneNumberInstance
- Defined in:
- lib/twilio-ruby/rest/lookups/v2/phone_number.rb
Overview
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Instance Method Summary collapse
-
#call_forwarding ⇒ Hash
An object that contains call forwarding status information.
-
#caller_name ⇒ Hash
An object that contains caller name information.
-
#calling_country_code ⇒ String
International dialing prefix.
-
#context ⇒ PhoneNumberContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#country_code ⇒ String
Phone number’s ISO country code.
-
#fetch(fields: :unset, country_code: :unset) ⇒ PhoneNumberInstance
Fetch the PhoneNumberInstance.
-
#initialize(version, payload, phone_number: nil) ⇒ PhoneNumberInstance
constructor
Initialize the PhoneNumberInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#line_type_intelligence ⇒ Hash
An object that contains line type information.
-
#live_activity ⇒ Hash
An object that contains live activity information.
-
#national_format ⇒ String
Phone number in national format.
-
#phone_number ⇒ String
Phone number in E.164 format.
-
#sim_swap ⇒ Hash
An object that contains SIM swap information.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#url ⇒ String
The absolute URL of the resource.
-
#valid ⇒ Boolean
Boolean which indicates if the phone number is valid.
-
#validation_errors ⇒ Array[phone_number.ValidationError]
Contains reasons why a phone number is invalid.
Constructor Details
#initialize(version, payload, phone_number: nil) ⇒ PhoneNumberInstance
Initialize the PhoneNumberInstance
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 124 def initialize(version, payload, phone_number: nil) super(version) # Marshaled Properties @properties = { 'calling_country_code' => payload['calling_country_code'], 'country_code' => payload['country_code'], 'phone_number' => payload['phone_number'], 'national_format' => payload['national_format'], 'valid' => payload['valid'], 'validation_errors' => payload['validation_errors'], 'caller_name' => payload['caller_name'], 'sim_swap' => payload['sim_swap'], 'call_forwarding' => payload['call_forwarding'], 'live_activity' => payload['live_activity'], 'line_type_intelligence' => payload['line_type_intelligence'], 'url' => payload['url'], } # Context @instance_context = nil @params = {'phone_number' => phone_number || @properties['phone_number'], } end |
Instance Method Details
#call_forwarding ⇒ Hash
Returns An object that contains call forwarding status information.
209 210 211 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 209 def call_forwarding @properties['call_forwarding'] end |
#caller_name ⇒ Hash
Returns An object that contains caller name information.
197 198 199 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 197 def caller_name @properties['caller_name'] end |
#calling_country_code ⇒ String
Returns International dialing prefix.
161 162 163 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 161 def calling_country_code @properties['calling_country_code'] 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
152 153 154 155 156 157 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 152 def context unless @instance_context @instance_context = PhoneNumberContext.new(@version, @params['phone_number'], ) end @instance_context end |
#country_code ⇒ String
Returns Phone number’s ISO country code.
167 168 169 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 167 def country_code @properties['country_code'] end |
#fetch(fields: :unset, country_code: :unset) ⇒ PhoneNumberInstance
Fetch the PhoneNumberInstance
240 241 242 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 240 def fetch(fields: :unset, country_code: :unset) context.fetch(fields: fields, country_code: country_code, ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
253 254 255 256 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 253 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Lookups.V2.PhoneNumberInstance #{values}>" end |
#line_type_intelligence ⇒ Hash
Returns An object that contains line type information.
221 222 223 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 221 def line_type_intelligence @properties['line_type_intelligence'] end |
#live_activity ⇒ Hash
Returns An object that contains live activity information.
215 216 217 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 215 def live_activity @properties['live_activity'] end |
#national_format ⇒ String
Returns Phone number in national format.
179 180 181 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 179 def national_format @properties['national_format'] end |
#phone_number ⇒ String
Returns Phone number in E.164 format.
173 174 175 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 173 def phone_number @properties['phone_number'] end |
#sim_swap ⇒ Hash
Returns An object that contains SIM swap information.
203 204 205 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 203 def sim_swap @properties['sim_swap'] end |
#to_s ⇒ Object
Provide a user friendly representation
246 247 248 249 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 246 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Lookups.V2.PhoneNumberInstance #{values}>" end |
#url ⇒ String
Returns The absolute URL of the resource.
227 228 229 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 227 def url @properties['url'] end |
#valid ⇒ Boolean
Returns Boolean which indicates if the phone number is valid.
185 186 187 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 185 def valid @properties['valid'] end |
#validation_errors ⇒ Array[phone_number.ValidationError]
Returns Contains reasons why a phone number is invalid.
191 192 193 |
# File 'lib/twilio-ruby/rest/lookups/v2/phone_number.rb', line 191 def validation_errors @properties['validation_errors'] end |