Sha256: 5378694a691e3b3de03fce601d2d2a0c514fb268bb8c5d430e1d79f2287b02cd

Contents?: true

Size: 807 Bytes

Versions: 24

Compression:

Stored size: 807 Bytes

Contents

# encoding: utf-8

module Punchblock
  class Event
    module Asterisk
      module AMI
        class Event < Punchblock::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
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
punchblock-2.7.5 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.7.3 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.7.2 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.7.1 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.7.0 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.6.0 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.5.3 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.5.2 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.5.1 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.5.0 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.4.2 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.4.0 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.3.1 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.3.0 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.2.2 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.2.1 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.2.0 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.1.1 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.1.0 lib/punchblock/event/asterisk/ami/event.rb
punchblock-2.0.2 lib/punchblock/event/asterisk/ami/event.rb