jsonapi_spec_helpers 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jsonapi_spec_helpers/helpers.rb +12 -0
- data/lib/jsonapi_spec_helpers/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3d6ed2df617274528c05fb08ee2ffc179b035de
|
4
|
+
data.tar.gz: e76161c601ac65f8a54b61ef64c20049af240031
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f979f1b8ebd9a276ff054a20696d5fd77a9189ed3ea172f65ac790d320416cfb59ad0d9855359c577d7f453bd40655e660ef535dab45c80ede92458f63e9be0
|
7
|
+
data.tar.gz: 74e5c1017860f0b7060217dc9051c794e52961dd1e7ede0e2e8e170d48f0316a4f95336477e76f84a29a417281ebee6bd6ed0d7e22a22d6226f0f4b50ac33387
|
@@ -54,12 +54,24 @@ module JsonapiSpecHelpers
|
|
54
54
|
ids
|
55
55
|
end
|
56
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
|
+
end
|
63
|
+
end
|
64
|
+
|
57
65
|
def jsonapi_headers
|
58
66
|
{
|
59
67
|
'CONTENT_TYPE' => 'application/vnd.api+json'
|
60
68
|
}
|
61
69
|
end
|
62
70
|
|
71
|
+
def jsonapi_get(url, params: {})
|
72
|
+
get url, params: params, headers: jsonapi_headers
|
73
|
+
end
|
74
|
+
|
63
75
|
def jsonapi_post(url, payload)
|
64
76
|
post url, params: payload.to_json, headers: jsonapi_headers
|
65
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi_spec_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|