We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c0b996 commit 289b52dCopy full SHA for 289b52d
lib/jsonapi_spec_helpers/helpers.rb
@@ -54,12 +54,24 @@ def json_ids(integers = false)
54
ids
55
end
56
57
+ def validation_errors
58
+ @validation_errors ||= {}.tap do |errors|
59
+ json['errors'].each do |e|
60
+ errors[e['meta']['attribute'].to_sym] = e['meta']['message']
61
+ end
62
63
64
+
65
def jsonapi_headers
66
{
67
'CONTENT_TYPE' => 'application/vnd.api+json'
68
}
69
70
71
+ def jsonapi_get(url, params: {})
72
+ get url, params: params, headers: jsonapi_headers
73
74
75
def jsonapi_post(url, payload)
76
post url, params: payload.to_json, headers: jsonapi_headers
77
0 commit comments