Class: Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb

Overview

This is the object containing a response from Asterisk.

Note: not all responses have an ActionID!

Direct Known Subclasses

ManagerInterfaceEvent

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeManagerInterfaceResponse

Returns a new instance of ManagerInterfaceResponse.



27
28
29
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 27

def initialize
  @headers = HashWithIndifferentAccess.new
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



22
23
24
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 22

def action
  @action
end

#action_idObject

Returns the value of attribute action_id.



22
23
24
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 22

def action_id
  @action_id
end

#eventsObject (readonly)

Returns the value of attribute events.



25
26
27
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 25

def events
  @events
end

#text_bodyObject

Returns the value of attribute text_body.



22
23
24
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 22

def text_body
  @text_body
end

Class Method Details

.from_immediate_response(text) ⇒ Object



15
16
17
18
19
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 15

def from_immediate_response(text)
  new.tap do |instance|
    instance.text_body = text
  end
end

Instance Method Details

#[](arg) ⇒ Object



39
40
41
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 39

def [](arg)
  @headers[arg]
end

#[]=(key, value) ⇒ Object



43
44
45
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 43

def []=(key,value)
  @headers[key] = value
end

#has_text_body?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 31

def has_text_body?
  !! @text_body
end

#headersObject



35
36
37
# File 'lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb', line 35

def headers
  @headers.clone
end