Class: Chef::HTTP::JSONToModelOutput

Inherits:
JSONOutput show all
Defined in:
lib/chef/http/json_to_model_output.rb

Overview

A Middleware-ish thing that takes an HTTP response, parses it as JSON if possible, and converts it into an appropriate model object if it contains a json_class key.

Instance Attribute Summary

Attributes inherited from JSONOutput

#inflate_json_class, #raw_output

Instance Method Summary collapse

Methods inherited from JSONOutput

#handle_request, #handle_response, #handle_stream_complete, #stream_response_handler

Constructor Details

#initialize(opts = {}) ⇒ JSONToModelOutput

Returns a new instance of JSONToModelOutput


28
29
30
31
# File 'lib/chef/http/json_to_model_output.rb', line 28

def initialize(opts = {})
  opts[:inflate_json_class] = true if !opts.has_key?(:inflate_json_class)
  super
end