Sha256: ab0a8542ee38a0751bb4695353b65dbcb85458bf03f3fe94f2c3b45654dacc2b
Contents?: true
Size: 1.14 KB
Versions: 8
Compression:
Stored size: 1.14 KB
Contents
# encoding: utf-8 module RubyAMI ## # This is the object containing a response from Asterisk. # # Note: not all responses have an ActionID! # class Response class << self def from_immediate_response(text) new.tap do |instance| instance.text_body = text end end end attr_accessor :action, :text_body # For "Response: Follows" sections attr_reader :events def initialize @headers = Hash.new end def has_text_body? !!@text_body end def headers @headers.clone end def [](arg) @headers[arg.to_s] end def []=(key,value) @headers[key.to_s] = value end def action_id @headers['ActionID'] end def inspect "#<#{self.class} #{inspect_attributes.map { |c| "#{c}=#{self.__send__(c).inspect rescue nil}" }.compact * ', '}>" end def inspect_attributes [:headers, :text_body, :events, :action] end def eql?(o, *fields) o.is_a?(self.class) && (fields + inspect_attributes).all? { |f| self.__send__(f) == o.__send__(f) } end alias :== :eql? end end # RubyAMI
Version data entries
8 entries across 8 versions & 1 rubygems