Exception: RubyAMI::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ruby_ami/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(headers = {}) ⇒ Error



6
7
8
# File 'lib/ruby_ami/error.rb', line 6

def initialize(headers = {})
  @headers = headers
end

Instance Attribute Details

#actionObject

Returns the value of attribute action



4
5
6
# File 'lib/ruby_ami/error.rb', line 4

def action
  @action
end

#messageObject

Returns the value of attribute message



4
5
6
# File 'lib/ruby_ami/error.rb', line 4

def message
  @message
end

Instance Method Details

#[](key) ⇒ Object



10
11
12
# File 'lib/ruby_ami/error.rb', line 10

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

#[]=(key, value) ⇒ Object



14
15
16
17
# File 'lib/ruby_ami/error.rb', line 14

def []=(key,value)
  self.message = value if key == 'Message'
  @headers[key] = value
end

#action_idObject



19
20
21
# File 'lib/ruby_ami/error.rb', line 19

def action_id
  @headers['ActionID']
end

#inspectObject



23
24
25
# File 'lib/ruby_ami/error.rb', line 23

def inspect
  "#<#{self.class} #{[:message, :headers].map { |c| "#{c}=#{self.__send__(c).inspect rescue nil}" }.compact * ', '}>"
end