Module: Delphix::Util
- Includes:
- Error
- Defined in:
- lib/delphix/util.rb
Overview
This module holds shared logic that doesn’t really belong anywhere else in the gem.
Class Method Summary collapse
Class Method Details
.parse_json(body) ⇒ Object
8 9 10 11 12 |
# File 'lib/delphix/util.rb', line 8 def parse_json(body) JSON.parse(body) unless body.nil? || body.empty? || (body == 'null') rescue JSON::ParserError => ex raise UnexpectedResponseError, ex. end |
.pretty_print_json(body) ⇒ Object
14 15 16 |
# File 'lib/delphix/util.rb', line 14 def pretty_print_json(body) JSON.pretty_generate( JSON.parse( body)) end |