Exception: Marvel::Response::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_hash) ⇒ Error

Returns a new instance of Error.



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

def initialize(response_hash)
  @code = response_hash['code']
  @status = response_hash['status'] || response_hash['message']
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/marvel/error.rb', line 11

def to_s
  "#{@code} #{@status}"
end