Exception: RubyAMI::Error
- Inherits:
-
StandardError
- Object
- StandardError
- RubyAMI::Error
- Defined in:
- lib/ruby_ami/error.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #action_id ⇒ Object
-
#initialize(headers = {}) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
- #merge_headers!(hash) ⇒ Object
Constructor Details
#initialize(headers = {}) ⇒ Error
Returns a new instance of Error.
6 7 8 |
# File 'lib/ruby_ami/error.rb', line 6 def initialize(headers = {}) @headers = headers end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
4 5 6 |
# File 'lib/ruby_ami/error.rb', line 4 def action @action end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/ruby_ami/error.rb', line 4 def @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. = value if key == 'Message' @headers[key] = value end |
#action_id ⇒ Object
24 25 26 |
# File 'lib/ruby_ami/error.rb', line 24 def action_id @headers['ActionID'] end |
#inspect ⇒ Object
28 29 30 |
# File 'lib/ruby_ami/error.rb', line 28 def inspect "#<#{self.class} #{[:message, :headers].map { |c| "#{c}=#{self.__send__(c).inspect rescue nil}" }.compact * ', '}>" end |
#merge_headers!(hash) ⇒ Object
19 20 21 22 |
# File 'lib/ruby_ami/error.rb', line 19 def merge_headers!(hash) self. = hash['Message'] if hash.has_key?('Message') @headers.merge!(hash) end |