Class: Owa::Requests::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/owa/requests/parser.rb

Instance Method Summary collapse

Instance Method Details

#call(response) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/owa/requests/parser.rb', line 5

def call(response)
  case response.status
  when 400
    raise BadRequest.new
  when 401
    raise Unauthorized.new
  when 404
    raise NotFound.new
  else
    JSON.parse(response.body, object_class: OpenStruct)
  end
end