Sha256: de13da034e089b2085d241256f7c3243446a085859b8b26898f6eadf9b4a6723
Contents?: true
Size: 525 Bytes
Versions: 4
Compression:
Stored size: 525 Bytes
Contents
require 'ostruct' module PerfectAudit class ResponseParser def self.parse(response) struct = OpenStruct.new(JSON.parse(response)) raise StandardError, struct.message if struct.status != 200 case struct.response when Hash struct.response.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} when Array struct.response.map do |item| item.inject({}){ |memo,(k,v)| memo[k.to_sym] = v; memo } end else struct.response end end end end
Version data entries
4 entries across 4 versions & 1 rubygems