Class: RubyAsterisk::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-asterisk/response.rb

Overview

Class for response coming from Asterisk

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, response) ⇒ Response

Returns a new instance of Response.



11
12
13
14
15
16
17
# File 'lib/ruby-asterisk/response.rb', line 11

def initialize(type,response)
  self.raw_response = response
  self.type = type
  self.action_id = self._parse_action_id
  self.message = self._parse_message
  self.data = self._parse_response
end

Instance Attribute Details

#action_idObject

Returns the value of attribute action_id.



9
10
11
# File 'lib/ruby-asterisk/response.rb', line 9

def action_id
  @action_id
end

#dataObject

Returns the value of attribute data.



9
10
11
# File 'lib/ruby-asterisk/response.rb', line 9

def data
  @data
end

#messageObject

Returns the value of attribute message.



9
10
11
# File 'lib/ruby-asterisk/response.rb', line 9

def message
  @message
end

#raw_responseObject

Returns the value of attribute raw_response.



9
10
11
# File 'lib/ruby-asterisk/response.rb', line 9

def raw_response
  @raw_response
end

#typeObject

Returns the value of attribute type.



9
10
11
# File 'lib/ruby-asterisk/response.rb', line 9

def type
  @type
end

Instance Method Details

#successObject



19
20
21
# File 'lib/ruby-asterisk/response.rb', line 19

def success
  self.raw_response.include?("Response: Success")
end