Sha256: ba2fe3548e4ab81043d8035da1c8fed165c864e622153e8ad0efc388fa649345
Contents?: true
Size: 525 Bytes
Versions: 1
Compression:
Stored size: 525 Bytes
Contents
module Credly module Response class ParseJson < Faraday::Response::Middleware def on_complete(env) if respond_to? :parse env[:body] = parse(env[:body]) unless [204,302,304,307].index env[:status] end end def parse(body) case body when '' nil else response_hash = ::MultiJson.decode(body) #raise LearnSprout::RequestException, response_hash["message"] if response_hash["message"] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
credly-0.0.1 | lib/credly/response/parse_json.rb |