Sha256: ed91871cf061929b12bfdbf957f134a614c7c32839aae9660b306d248960c1aa

Contents?: true

Size: 1.67 KB

Versions: 12

Compression:

Stored size: 1.67 KB

Contents

module Adhearsion
  module VoIP
    module Asterisk
      module Manager


        ##
        # This is the object containing a response from Asterisk.
        #
        # Note: not all responses have an ActionID!
        #
        class ManagerInterfaceResponse
        
          class << self
            def from_immediate_response(text)
              returning new do |instance|
                instance.text_body = text
              end
            end
          end
          
          attr_accessor :action,
                        :action_id,
                        :text_body  # For "Response: Follows" sections
          attr_reader   :events
          
          def initialize
            @headers = HashWithIndifferentAccess.new
          end
          
          def has_text_body?
            !! @text_body
          end
          
          def headers
            @headers.clone
          end
        
          def [](arg)
            @headers[arg]
          end
  
          def []=(key,value)
            @headers[key] = value
          end
          
        end
      
        class ManagerInterfaceError < Exception
          
          attr_accessor :message
          def initialize
            @headers = HashWithIndifferentAccess.new
          end
          
          def [](key)
            @headers[key]
          end
          
          def []=(key,value)
            @headers[key] = value
          end
          
        end
        
        class ManagerInterfaceEvent < ManagerInterfaceResponse
  
          attr_reader :name
          def initialize(name)
            super()
            @name = name
          end
          
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 6 rubygems

Version Path
eric-adhearsion-0.8.0 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
jicksta-adhearsion-0.7.999 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
jicksta-adhearsion-0.8.0 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
jicksta-adhearsion-0.8.2 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
jicksta-adhearsion-0.8.3 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
kenwiesner-adhearsioncw-0.8.3 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
mtrudel-adhearsion-0.8.3 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
sevenscale-adhearsion-0.8.0 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
adhearsion-0.8.3 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
adhearsion-0.8.0 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
adhearsion-0.8.1 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
adhearsion-0.8.2 lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb