Class: ActionDispatch::Response
- Inherits:
-
Object
- Object
- ActionDispatch::Response
- Defined in:
- lib/sixarm_ruby_action_dispatch_response_json.rb
Instance Method Summary collapse
-
#data ⇒ Object
Returns the response json “data” field.
-
#errors ⇒ Object
Returns the response json “errors” field.
-
#json ⇒ Object
Returns the response body as JSON.
-
#json=(json) ⇒ Object
Allows you to manually set or override the response body as JSON.
-
#linked ⇒ Object
Returns the response json “linked” field.
-
#links ⇒ Object
Returns the response json “links” field.
-
#meta ⇒ Object
Returns the response json “meta” field.
Instance Method Details
#data ⇒ Object
Returns the response json “data” field.
24 25 26 |
# File 'lib/sixarm_ruby_action_dispatch_response_json.rb', line 24 def data json["data"] end |
#errors ⇒ Object
Returns the response json “errors” field.
29 30 31 |
# File 'lib/sixarm_ruby_action_dispatch_response_json.rb', line 29 def errors json["errors"] end |
#json ⇒ Object
Returns the response body as JSON.
13 14 15 |
# File 'lib/sixarm_ruby_action_dispatch_response_json.rb', line 13 def json @json ||= JSON.parse(body) end |
#json=(json) ⇒ Object
Allows you to manually set or override the response body as JSON.
18 19 20 21 |
# File 'lib/sixarm_ruby_action_dispatch_response_json.rb', line 18 def json=(json) self.body=json @json = nil end |
#linked ⇒ Object
Returns the response json “linked” field.
34 35 36 |
# File 'lib/sixarm_ruby_action_dispatch_response_json.rb', line 34 def linked json["linked"] end |
#links ⇒ Object
Returns the response json “links” field.
39 40 41 |
# File 'lib/sixarm_ruby_action_dispatch_response_json.rb', line 39 def links json["links"] end |
#meta ⇒ Object
Returns the response json “meta” field.
44 45 46 |
# File 'lib/sixarm_ruby_action_dispatch_response_json.rb', line 44 def json["meta"] end |