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

#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

+ (Object) new(options = {})



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

- (Object) code



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

def code
  code_node.text.to_i
end

- (Object) code=(other)



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

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

- (Object) code_node



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

def code_node
  node_with_name 'code'
end

- (Object) data



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

def data
  data_node.text
end

- (Object) data=(other)



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

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

- (Object) data_node



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

def data_node
  node_with_name 'data'
end

- (Object) inspect_attributes



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

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

- (Object) node_with_name(name)



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

- (Object) result



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

def result
  result_node.text.to_i
end

- (Object) result=(other)



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

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

- (Object) result_node



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

def result_node
  node_with_name 'result'
end