Class: VoiceML::OutgoingCallerId

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

Overview

Twilio-compatible OutgoingCallerId resource. The sid is PN-prefixed to mirror Twilio (caller-id resources share the IncomingPhoneNumber SID space upstream); phone_number carries the verified E.164 number.

Constant Summary collapse

ATTRIBUTES =
%w[
  sid account_sid friendly_name phone_number
  date_created date_updated uri
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ OutgoingCallerId

Returns a new instance of OutgoingCallerId.



17
18
19
20
21
22
# File 'lib/voiceml/models/outgoing_caller_ids.rb', line 17

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



24
25
26
27
28
# File 'lib/voiceml/models/outgoing_caller_ids.rb', line 24

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

  new(hash)
end