Class: Restify::Processors::Json

Inherits:
Base
  • Object
show all
Includes:
Parsing
Defined in:
lib/restify/processors/json.rb

Overview

Decode plain JSON responses.

JSON fields matching *_url will be parsed as relations.

Instance Attribute Summary

Attributes inherited from Base

#context, #response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#body, #initialize, #load, #resource

Constructor Details

This class inherits a constructor from Restify::Processors::Base

Class Method Details

.accept?(response) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/restify/processors/json.rb', line 20

def accept?(response)
  response.content_type =~ %r{\Aapplication/json($|;)}
end

Instance Method Details

#deserialized_bodyObject



15
16
17
# File 'lib/restify/processors/json.rb', line 15

def deserialized_body
  ::JSON.parse(body)
end