Class: ActionDispatch::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/sixarm_ruby_action_dispatch_response_json.rb

Instance Method Summary collapse

Instance Method Details

#dataObject

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

#errorsObject

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

#jsonObject

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

#linkedObject

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

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

#metaObject

Returns the response json “meta” field.



44
45
46
# File 'lib/sixarm_ruby_action_dispatch_response_json.rb', line 44

def meta
  json["meta"]
end