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

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

Constant Summary

Constants inherited from RayoNode

RayoNode::InvalidNodeError

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

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



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

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



126
127
128
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 126

def code
  code_node.text.to_i
end

#code=(other) ⇒ Object



130
131
132
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 130

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

#code_nodeObject



114
115
116
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 114

def code_node
  node_with_name 'code'
end

#dataObject



142
143
144
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 142

def data
  data_node.text
end

#data=(other) ⇒ Object



146
147
148
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 146

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

#data_nodeObject



122
123
124
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 122

def data_node
  node_with_name 'data'
end

#inspect_attributesObject



150
151
152
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 150

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

#node_with_name(name) ⇒ Object



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

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



134
135
136
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 134

def result
  result_node.text.to_i
end

#result=(other) ⇒ Object



138
139
140
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 138

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

#result_nodeObject



118
119
120
# File 'lib/punchblock/component/asterisk/agi/command.rb', line 118

def result_node
  node_with_name 'result'
end