Sha256: 9c3a2b75fe0febae9032978b314aa3914567957482cd51aa736ae6f17352092a
Contents?: true
Size: 463 Bytes
Versions: 9
Compression:
Stored size: 463 Bytes
Contents
require 'json' require 'recursive_open_struct' require 'frenetic/hal_json/response_wrapper' class Frenetic class HalJson < Faraday::Middleware def call( environment ) @app.call(environment).on_complete { |env| on_complete(env) } end def on_complete( env ) if success? env env[:body] = ResponseWrapper.new( JSON.parse(env[:body]) ) end end def success?( env ) (200..201) === env[:status] end end end
Version data entries
9 entries across 9 versions & 1 rubygems