Module: Vzaar::Response

Defined in:
lib/vzaar/response/base.rb

Defined Under Namespace

Classes: Base

Class Method Summary collapse

Class Method Details

.error(msg) ⇒ Object

Raises:



36
37
38
# File 'lib/vzaar/response/base.rb', line 36

def self.error(msg)
  raise(Vzaar::Error, msg)
end

.handle_response(response) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vzaar/response/base.rb', line 19

def self.handle_response(response)
  case response.code.to_i
  when 302
    error("Moved Temporarily")
  when 401
    error("Protected Resource")
  when 403
    error("Forbidden")
  when 404
    error("Not Found")
  when 502
    error("Bad Gateway")
  else
    response
  end
end