lib/ruby_ami/response.rb in ruby_ami-1.3.4 vs lib/ruby_ami/response.rb in ruby_ami-2.0.0
- old
+ new
@@ -1,27 +1,25 @@
# 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
+ attr_accessor :text_body, # For "Response: Follows" sections
+ :events
- def initialize
- @headers = Hash.new
+ def initialize(headers = {})
+ @headers = headers
+ @events = []
end
def has_text_body?
!!@text_body
end
@@ -45,10 +43,10 @@
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]
+ [:headers, :text_body, :events]
end
def eql?(o, *fields)
o.is_a?(self.class) && (fields + inspect_attributes).all? { |f| self.__send__(f) == o.__send__(f) }
end