module BlueprintAgreement::Utils

Public Instance Methods

response_parser(response) click to toggle source
# File lib/blueprint_agreement/utils/response_parser.rb, line 15
def response_parser(response)
  return content if response.nil?

  response = JSON.parse(response) if response.is_a? String
  JSON.pretty_generate(response)
rescue JSON::ParserError
  return response.to_s.lstrip
end
to_json(content) click to toggle source
# File lib/blueprint_agreement/utils/response_parser.rb, line 7
def to_json(content)
  return content if content.nil?

  JSON.parse(content, symbolize_names: true)
rescue JSON::ParserError
  return content.to_s.lstrip
end