module Delphix::Util
This module holds shared logic that doesn’t really belong anywhere else in the gem.
Public Class Methods
parse_json(body)
click to toggle source
# 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.message end
pretty_print_json(body)
click to toggle source
# File lib/delphix/util.rb, line 14 def pretty_print_json(body) JSON.pretty_generate( JSON.parse( body)) end
Private Instance Methods
parse_json(body)
click to toggle source
# 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.message end
pretty_print_json(body)
click to toggle source
# File lib/delphix/util.rb, line 14 def pretty_print_json(body) JSON.pretty_generate( JSON.parse( body)) end