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.



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 = _parse_message
  @data = _parse_response
  deep_freeze
  freeze
end

Instance Attribute Details

#action_idObject (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

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

#raw_responseObject (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

#typeObject (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

#successObject



23
24
25
# File 'lib/ruby-asterisk/response.rb', line 23

def success
  raw_response.join.include?('Response: Success')
end