Class: Koine::RestClient::ResponseParser
- Inherits:
-
Object
- Object
- Koine::RestClient::ResponseParser
- Defined in:
- lib/koine/rest_client/response_parser.rb
Overview
either returns response or raises errors
Instance Method Summary collapse
Instance Method Details
#parse(response) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/koine/rest_client/response_parser.rb', line 7 def parse(response) if block_given? yield(response) end code = Integer(response.code) if code.between?(200, 299) return response.parsed_response end raise error_for_code(code), response end |