Class: VoiceML::IncomingPhoneNumber

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/models/incoming_phone_numbers.rb

Overview

A Twilio-compatible IncomingPhoneNumber — a DID assigned to the tenant.

‘sid` is the canonical `PN`-prefixed identifier (34 chars); `phone_number` carries the E.164 form. These are distinct fields — twilio-ruby callers that lookup-by-number then fetch-by-sid work unchanged.

Twilio-compat fields VoiceML doesn’t track (regulatory, SMS, emergency, trunking) are surfaced verbatim so strict-binding consumers can read e.g. ‘.capabilities`.

Constant Summary collapse

ATTRIBUTES =
%w[
  sid account_sid phone_number friendly_name api_version uri
  voice_url voice_method voice_fallback_url voice_fallback_method
  voice_application_sid voice_caller_id_lookup voice_receive_mode
  origin beta capabilities type
  sms_url sms_method sms_fallback_url sms_fallback_method sms_application_sid
  status_callback status_callback_method
  trunk_sid address_sid address_requirements identity_sid bundle_sid
  emergency_status emergency_address_sid emergency_address_status
  status date_created date_updated
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ IncomingPhoneNumber

Returns a new instance of IncomingPhoneNumber.



29
30
31
32
33
34
# File 'lib/voiceml/models/incoming_phone_numbers.rb', line 29

def initialize(attrs = {})
  ATTRIBUTES.each do |field|
    value = attrs.key?(field) ? attrs[field] : attrs[field.to_sym]
    instance_variable_set("@#{field}", value)
  end
end

Class Method Details

.from_hash(hash) ⇒ Object



36
37
38
39
40
# File 'lib/voiceml/models/incoming_phone_numbers.rb', line 36

def self.from_hash(hash)
  return nil if hash.nil?

  new(hash)
end