Sha256: 535a3c8c4c0ba1824cbce83da60a621d5c126a97c9dc08f334f0dd537ed41bec

Contents?: true

Size: 724 Bytes

Versions: 3

Compression:

Stored size: 724 Bytes

Contents

# encoding: utf-8

module Adhearsion
  class Event
    module Asterisk
      class AMI < Event
        register :event, :ami

        attribute :name
        attribute :headers, Hash, default: {}

        alias :attributes :headers

        def inherit(xml_node)
          xml_node.xpath('//ns:attribute', ns: self.class.registered_ns).to_a.each do |attribute|
            headers[attribute[:name]] = attribute[:value]
          end
          super
        end

        def rayo_attributes
          {'name' => name}
        end

        def rayo_children(root)
          super
          headers.each do |name, value|
            root.attribute name: name, value: value
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adhearsion-3.0.0.rc1 lib/adhearsion/event/asterisk/ami.rb
adhearsion-3.0.0.beta2 lib/adhearsion/event/asterisk/ami.rb
adhearsion-3.0.0.beta1 lib/adhearsion/event/asterisk/ami.rb