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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd7a2460ef43c2bac238178b5a7d6aca7d9dc8b5
4
- data.tar.gz: b172e3d74e01d9df98c369d3e45c495924e3c794
3
+ metadata.gz: e3d6ed2df617274528c05fb08ee2ffc179b035de
4
+ data.tar.gz: e76161c601ac65f8a54b61ef64c20049af240031
5
5
  SHA512:
6
- metadata.gz: c5847ff14ada7fbf30c72d684c3b2eb2b7aa0ae2090990402f7ca3d5606df2e6c062cd584fde96f0df3ff4ac233c750b226cb03e4c75c2bf53d39dff173bfe0b
7
- data.tar.gz: 2e50b858908871e454661ee6e5fedb40c5f365af767aa6bc2f439f06438ac45516135082259dd1065fe1491b4c66cd9803cdc22e3ee4ea0633d99f5a9870287b
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
@@ -1,3 +1,3 @@
1
1
  module JsonapiSpecHelpers
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  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
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-19 00:00:00.000000000 Z
11
+ date: 2017-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry