Class: RubyAsterisk::Response
- Inherits:
-
Object
- Object
- RubyAsterisk::Response
- Defined in:
- lib/ruby-asterisk/response.rb
Overview
Class for response coming from Asterisk
Instance Attribute Summary collapse
-
#action_id ⇒ Object
readonly
Returns the value of attribute action_id.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, response) ⇒ Response
constructor
A new instance of Response.
- #success ⇒ Object
Constructor Details
#initialize(type, response) ⇒ Response
Returns a new instance of Response.
13 14 15 16 17 18 19 20 21 |
# File 'lib/ruby-asterisk/response.rb', line 13 def initialize(type, response) @raw_response = [response].flatten @type = type @action_id = _parse_action_id @message = @data = _parse_response deep_freeze freeze end |
Instance Attribute Details
#action_id ⇒ Object (readonly)
Returns the value of attribute action_id.
11 12 13 |
# File 'lib/ruby-asterisk/response.rb', line 11 def action_id @action_id end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/ruby-asterisk/response.rb', line 11 def data @data end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
11 12 13 |
# File 'lib/ruby-asterisk/response.rb', line 11 def @message end |
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
11 12 13 |
# File 'lib/ruby-asterisk/response.rb', line 11 def raw_response @raw_response end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
11 12 13 |
# File 'lib/ruby-asterisk/response.rb', line 11 def type @type end |
Instance Method Details
#success ⇒ Object
23 24 25 |
# File 'lib/ruby-asterisk/response.rb', line 23 def success raw_response.join.include?('Response: Success') end |