Class: Restify::Processors::Json
- Inherits:
-
Base
- Object
- Base
- Restify::Processors::Json
show all
- Defined in:
- lib/restify/processors/json.rb
Overview
Decode plain JSON responses.
JSON fields matching *_url will be parsed as relations.
Constant Summary
collapse
- @@indifferent_access =
true
Instance Attribute Summary
Attributes inherited from Base
#context, #response
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#body, #initialize, #resource
Class Method Details
.accept?(response) ⇒ Boolean
69
70
71
|
# File 'lib/restify/processors/json.rb', line 69
def accept?(response)
response.content_type =~ /\Aapplication\/json($|;)/
end
|
.indifferent_access=(value) ⇒ Object
77
78
79
|
# File 'lib/restify/processors/json.rb', line 77
def indifferent_access=(value)
@@indifferent_access = value
end
|
.indifferent_access? ⇒ Boolean
73
74
75
|
# File 'lib/restify/processors/json.rb', line 73
def indifferent_access?
@@indifferent_access
end
|
Instance Method Details
#load ⇒ Object
13
14
15
|
# File 'lib/restify/processors/json.rb', line 13
def load
parse ::JSON.load(body), root: true
end
|