Class: Otter::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Error

Returns a new instance of Error.



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

def initialize(code)
  @code = code.to_i
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

Instance Method Details

#messageObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/otter/error.rb', line 10

def message
  case self.code
  when 400 then 'Parameter Check Failed'
  when 403 then 'Forbidden'
  when 404 then 'Action Not Supported'
  when 500 then 'Unexpected Internal Error'
  when 503 then 'Temporarily Unavailable'
  else 'Unkown'
  end
end