Class: Punchblock::Event::Asterisk::AMI::Event
- Inherits:
-
Punchblock::Event
- Object
- Niceogiri::XML::Node
- RayoNode
- Punchblock::Event
- Punchblock::Event::Asterisk::AMI::Event
- Defined in:
- lib/punchblock/event/asterisk/ami/event.rb
Defined Under Namespace
Classes: Attribute
Instance Attribute Summary
Attributes inherited from RayoNode
#client, #component_id, #connection, #domain, #original_component, #target_call_id, #target_mixer_name
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Array[Attribute]) attributes
Attributes.
- - (Object) attributes=(attributes)
-
- (Hash) attributes_hash
Hash of key-value pairs of attributes.
-
- (Object) inspect_attributes
:nodoc:.
- - (Object) name
- - (Object) name=(other)
Methods inherited from RayoNode
class_from_registration, #eql?, import, #inspect, register, #source
Class Method Details
+ (Object) new(options = {})
12 13 14 15 16 |
# File 'lib/punchblock/event/asterisk/ami/event.rb', line 12 def self.new( = {}) super().tap do |new_node| .each_pair { |k,v| new_node.send :#{k}=", v } end end |
Instance Method Details
- (Array[Attribute]) attributes
Attributes
39 40 41 42 43 |
# File 'lib/punchblock/event/asterisk/ami/event.rb', line 39 def attributes find('//ns:attribute', :ns => self.class.registered_ns).map do |i| Attribute.new i end end |
- (Object) attributes=(attributes)
48 49 50 51 52 53 54 55 |
# File 'lib/punchblock/event/asterisk/ami/event.rb', line 48 def attributes=(attributes) find('//ns:attribute', :ns => self.class.registered_ns).each(&:remove) if attributes.is_a? Hash attributes.each_pair { |k,v| self << Attribute.new(k, v) } elsif attributes.is_a? Array [attributes].flatten.each { |i| self << Attribute.new(i) } end end |
- (Hash) attributes_hash
Hash of key-value pairs of attributes
29 30 31 32 33 34 |
# File 'lib/punchblock/event/asterisk/ami/event.rb', line 29 def attributes_hash attributes.inject({}) do |hash, attribute| hash[attribute.name] = attribute.value hash end end |
- (Object) inspect_attributes
:nodoc:
57 58 59 |
# File 'lib/punchblock/event/asterisk/ami/event.rb', line 57 def inspect_attributes # :nodoc: [:name, :attributes_hash] + super end |
- (Object) name
18 19 20 |
# File 'lib/punchblock/event/asterisk/ami/event.rb', line 18 def name read_attr :name end |
- (Object) name=(other)
22 23 24 |
# File 'lib/punchblock/event/asterisk/ami/event.rb', line 22 def name=(other) write_attr :name, other end |