Class: RubyAMI::Response
Overview
This is the object containing a response from Asterisk.
Note: not all responses have an ActionID!
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#text_body ⇒ Object
Returns the value of attribute text_body.
Class Method Summary collapse
Instance Method Summary collapse
- #[](arg) ⇒ Object
- #[]=(key, value) ⇒ Object
- #action_id ⇒ Object
- #has_text_body? ⇒ Boolean
- #headers ⇒ Object
-
#initialize ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
20 21 22 |
# File 'lib/ruby_ami/response.rb', line 20 def initialize @headers = HashWithIndifferentAccess.new end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
16 17 18 |
# File 'lib/ruby_ami/response.rb', line 16 def action @action end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
18 19 20 |
# File 'lib/ruby_ami/response.rb', line 18 def events @events end |
#text_body ⇒ Object
Returns the value of attribute text_body.
16 17 18 |
# File 'lib/ruby_ami/response.rb', line 16 def text_body @text_body end |
Class Method Details
.from_immediate_response(text) ⇒ Object
9 10 11 12 13 |
# File 'lib/ruby_ami/response.rb', line 9 def from_immediate_response(text) new.tap do |instance| instance.text_body = text end end |
Instance Method Details
#[](arg) ⇒ Object
32 33 34 |
# File 'lib/ruby_ami/response.rb', line 32 def [](arg) @headers[arg] end |
#[]=(key, value) ⇒ Object
36 37 38 |
# File 'lib/ruby_ami/response.rb', line 36 def []=(key,value) @headers[key] = value end |
#action_id ⇒ Object
40 41 42 |
# File 'lib/ruby_ami/response.rb', line 40 def action_id @headers['ActionID'] end |
#has_text_body? ⇒ Boolean
24 25 26 |
# File 'lib/ruby_ami/response.rb', line 24 def has_text_body? !!@text_body end |
#headers ⇒ Object
28 29 30 |
# File 'lib/ruby_ami/response.rb', line 28 def headers @headers.clone end |