Class: VoiceML::Notification

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

Overview

Twilio-compatible Notification resource — a log row for a specific webhook / TwiML invocation failure (HTTP non-2xx, parse error, etc.).

VoiceML treats /Notifications and /Calls/{Sid}/Notifications as compat stubs (always-empty list, fetch-by-sid returns 404), so this model decodes Twilio's documented shape for migration tooling and conformance checks without implying voiceml emits notification rows.

The same resource shape backs both account-scoped and call-scoped fetches.

Constant Summary collapse

ATTRIBUTES =
%w[
  sid account_sid call_sid api_version
  error_code more_info message_date message_text log
  request_method request_url request_variables
  response_body response_headers
  date_created date_updated uri
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Notification

Returns a new instance of Notification.



26
27
28
29
30
31
# File 'lib/voiceml/models/notifications.rb', line 26

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



33
34
35
36
37
# File 'lib/voiceml/models/notifications.rb', line 33

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

  new(hash)
end