Class: Restify::Processors::Json
- Defined in:
- lib/restify/processors/json.rb
Overview
Decode plain JSON responses.
JSON fields matching *_url will be parsed as relations.
Class Attribute Summary collapse
-
.indifferent_access ⇒ Object
writeonly
Sets the attribute indifferent_access.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Restify::Processors::Base
Class Attribute Details
.indifferent_access=(value) ⇒ Object (writeonly)
Sets the attribute indifferent_access
86 87 88 |
# File 'lib/restify/processors/json.rb', line 86 def indifferent_access=(value) @indifferent_access = value end |
Class Method Details
.accept?(response) ⇒ Boolean
78 79 80 |
# File 'lib/restify/processors/json.rb', line 78 def accept?(response) response.content_type =~ %r{\Aapplication/json($|;)} end |
.indifferent_access? ⇒ Boolean
82 83 84 |
# File 'lib/restify/processors/json.rb', line 82 def indifferent_access? @indifferent_access end |
Instance Method Details
#load ⇒ Object
14 15 16 |
# File 'lib/restify/processors/json.rb', line 14 def load parse ::JSON.parse(body), root: true end |