Class: Punchblock::Component::Asterisk::AGI::Command::Complete::Success

Inherits:
Event::Complete::Reason show all
Defined in:
lib/punchblock/component/asterisk/agi/command.rb

Instance Attribute Summary

Attributes inherited from RayoNode

#call_id, #client, #component_id, #connection, #domain, #mixer_name, #original_component

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event::Complete::Reason

#name

Methods inherited from RayoNode

class_from_registration, #eql?, import, #inspect, register, #source

Class Method Details

.new(options = {}) ⇒ Object



87
88
89
90
91
92
93
94
95
96
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 87

def self.new(options = {})
  super().tap do |new_node|
    case options
    when Nokogiri::XML::Node
      new_node.inherit options
    else
      options.each_pair { |k,v| new_node.send :"#{k}=", v }
    end
  end
end

Instance Method Details

#codeObject



124
125
126
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 124

def code
  code_node.text.to_i
end

#code=(other) ⇒ Object



128
129
130
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 128

def code=(other)
  code_node.content = other
end

#code_nodeObject



112
113
114
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 112

def code_node
  node_with_name 'code'
end

#dataObject



140
141
142
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 140

def data
  data_node.text
end

#data=(other) ⇒ Object



144
145
146
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 144

def data=(other)
  data_node.content = other
end

#data_nodeObject



120
121
122
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 120

def data_node
  node_with_name 'data'
end

#inspect_attributesObject



148
149
150
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 148

def inspect_attributes
  [:code, :result, :data]
end

#node_with_name(name) ⇒ Object



98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 98

def node_with_name(name)
  n = if self.class.registered_ns
    find_first "ns:#{name}", :ns => self.class.registered_ns
  else
    find_first name
  end

  unless n
    self << (n = RayoNode.new(name, self.document))
    n.namespace = self.class.registered_ns
  end
  n
end

#resultObject



132
133
134
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 132

def result
  result_node.text.to_i
end

#result=(other) ⇒ Object



136
137
138
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 136

def result=(other)
  result_node.content = other
end

#result_nodeObject



116
117
118
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 116

def result_node
  node_with_name 'result'
end