Class: DotloopApi::CodeMap

Inherits:
Object
  • Object
show all
Defined in:
lib/dotloop_api/exceptions.rb

Class Method Summary collapse

Class Method Details

.call(code) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dotloop_api/exceptions.rb', line 14

def self.call(code)
  return if code == 200
  {
    400 => DotloopApi::BadRequest,
    401 => DotloopApi::Unauthorized,
    403 => DotloopApi::Forbidden,
    404 => DotloopApi::NotFound,
    422 => DotloopApi::UnprocessableEntity,
    429 => DotloopApi::TooManyRequests
  }.fetch(code, StandardError)
end