graphiti_errors 1.0.alpha.2 → 1.0.alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e0ac02ec824fd98eac0e01f515350539d30a421
4
- data.tar.gz: 1a8375c9d25fe7929d478fcbdf16c48a0de53aac
3
+ metadata.gz: 7ee6fb0df9c1138e511b565ce7a4650af63f3661
4
+ data.tar.gz: 1c5b34e21ebf1287a9bf2e1cd175369354b504d1
5
5
  SHA512:
6
- metadata.gz: e16a9a55cb1675d9d359b1041f1f14cd80d269372501e8c57c0f14f3f8cd15f5130590cdd86fea5a20a2620848138b6f125f7111b0318e2104dcdf7e30dbec6e
7
- data.tar.gz: abdae9dc497b6dd703e6f230d78538c8b3cfef5dc952bb9acd1f527ee5f44d701b5f8365109174598f4b0093ffc873e887725c2362ac678766e9ececd49cf2cc
6
+ metadata.gz: 6f1eaacb86a6360f690c00f808fc7fd967a67bfe5c8a92cbc3bd6a6dd31aefebd777aa5b35d0ef9a226bf3fd5875ead8fd53e895f32e353e2f0a8525132adf2d
7
+ data.tar.gz: 50879fd50d319c2b687c1db975e8e22daaa5b25a1d42190cdc06d2b53c46d93559fd5dc2b6699a7e8d972457ff377ce12132a7ad8cbd4a19ab66f12b76d91a64
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # JsonapiErrorable
2
2
 
3
- [![Build Status](https://travis-ci.org/jsonapi-suite/jsonapi_errorable.svg?branch=master)](https://travis-ci.org/jsonapi-suite/jsonapi_errorable)
3
+ ![Build Status](https://travis-ci.org/graphiti-api/graphiti_errors.svg?branch=master)
4
4
 
5
5
  Error handling patterns for jsonapi.org-compatible APIs.
6
6
 
@@ -5,6 +5,7 @@ source "https://rubygems.org"
5
5
  gem "rails", "~> 4.1"
6
6
 
7
7
  group :test do
8
+ gem "activemodel"
8
9
  gem "appraisal"
9
10
  gem "pry"
10
11
  gem "pry-byebug"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- jsonapi_errorable (0.8.0)
4
+ graphiti_errors (1.0.alpha.2)
5
5
  jsonapi-serializable (~> 0.1)
6
6
 
7
7
  GEM
@@ -55,12 +55,13 @@ GEM
55
55
  erubis (2.7.0)
56
56
  globalid (0.3.7)
57
57
  activesupport (>= 4.1.0)
58
+ graphiti_spec_helpers (1.0.alpha.2)
59
+ rspec (~> 3.0)
58
60
  i18n (0.7.0)
59
61
  json (1.8.3)
60
62
  jsonapi-renderer (0.2.0)
61
63
  jsonapi-serializable (0.3.0)
62
64
  jsonapi-renderer (~> 0.2.0)
63
- jsonapi_spec_helpers (0.2.0)
64
65
  loofah (2.0.3)
65
66
  nokogiri (>= 1.5.9)
66
67
  mail (2.6.4)
@@ -110,6 +111,10 @@ GEM
110
111
  rake (>= 0.8.7)
111
112
  thor (>= 0.18.1, < 2.0)
112
113
  rake (10.5.0)
114
+ rspec (3.5.0)
115
+ rspec-core (~> 3.5.0)
116
+ rspec-expectations (~> 3.5.0)
117
+ rspec-mocks (~> 3.5.0)
113
118
  rspec-core (3.5.3)
114
119
  rspec-support (~> 3.5.0)
115
120
  rspec-expectations (3.5.0)
@@ -145,10 +150,11 @@ PLATFORMS
145
150
  ruby
146
151
 
147
152
  DEPENDENCIES
153
+ activemodel
148
154
  appraisal
149
155
  bundler (~> 1.11)
150
- jsonapi_errorable!
151
- jsonapi_spec_helpers
156
+ graphiti_errors!
157
+ graphiti_spec_helpers
152
158
  pry
153
159
  pry-byebug
154
160
  rails (~> 4.1)
@@ -5,6 +5,7 @@ source "https://rubygems.org"
5
5
  gem "rails", "~> 5.0"
6
6
 
7
7
  group :test do
8
+ gem "activemodel"
8
9
  gem "appraisal"
9
10
  gem "pry"
10
11
  gem "pry-byebug"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- jsonapi_errorable (0.8.0)
4
+ graphiti_errors (1.0.alpha.2)
5
5
  jsonapi-serializable (~> 0.1)
6
6
 
7
7
  GEM
@@ -57,11 +57,12 @@ GEM
57
57
  erubis (2.7.0)
58
58
  globalid (0.3.7)
59
59
  activesupport (>= 4.1.0)
60
+ graphiti_spec_helpers (1.0.alpha.2)
61
+ rspec (~> 3.0)
60
62
  i18n (0.7.0)
61
63
  jsonapi-renderer (0.2.0)
62
64
  jsonapi-serializable (0.3.0)
63
65
  jsonapi-renderer (~> 0.2.0)
64
- jsonapi_spec_helpers (0.2.0)
65
66
  loofah (2.0.3)
66
67
  nokogiri (>= 1.5.9)
67
68
  mail (2.6.4)
@@ -111,6 +112,10 @@ GEM
111
112
  rake (>= 0.8.7)
112
113
  thor (>= 0.18.1, < 2.0)
113
114
  rake (10.5.0)
115
+ rspec (3.5.0)
116
+ rspec-core (~> 3.5.0)
117
+ rspec-expectations (~> 3.5.0)
118
+ rspec-mocks (~> 3.5.0)
114
119
  rspec-core (3.5.3)
115
120
  rspec-support (~> 3.5.0)
116
121
  rspec-expectations (3.5.0)
@@ -149,10 +154,11 @@ PLATFORMS
149
154
  ruby
150
155
 
151
156
  DEPENDENCIES
157
+ activemodel
152
158
  appraisal
153
159
  bundler (~> 1.11)
154
- jsonapi_errorable!
155
- jsonapi_spec_helpers
160
+ graphiti_errors!
161
+ graphiti_spec_helpers
156
162
  pry
157
163
  pry-byebug
158
164
  rails (~> 5.0)
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rspec-rails", "~> 3.0"
27
27
  spec.add_development_dependency "sqlite3"
28
- spec.add_development_dependency "graphiti_spec_helpers"
28
+ spec.add_development_dependency "graphiti_spec_helpers", '>= 1.0.alpha.3'
29
29
  end
@@ -30,7 +30,7 @@ module GraphitiErrors
30
30
  return [] unless object.respond_to?(:errors)
31
31
 
32
32
  all_errors = attribute_errors
33
- all_errors |= relationship_errors(@relationship_payloads)
33
+ all_errors |= relationship_errors(object, @relationship_payloads)
34
34
  all_errors
35
35
  end
36
36
 
@@ -105,11 +105,11 @@ module GraphitiErrors
105
105
  object.class.respond_to?(:reflect_on_all_associations)
106
106
  end
107
107
 
108
- def traverse_relationships(relationship_params)
108
+ def traverse_relationships(model, relationship_params)
109
109
  return unless relationship_params
110
110
 
111
111
  relationship_params.each_pair do |name, payload|
112
- relationship_objects = Array(@object.send(name))
112
+ relationship_objects = Array(model.send(name))
113
113
 
114
114
  relationship_objects.each do |relationship_object|
115
115
  related_payload = payload
@@ -123,14 +123,14 @@ module GraphitiErrors
123
123
  end
124
124
 
125
125
  yield name, relationship_object, related_payload
126
- relationship_errors(related_payload[:relationships])
126
+ relationship_errors(relationship_object, related_payload[:relationships])
127
127
  end
128
128
  end
129
129
  end
130
130
 
131
- def relationship_errors(relationship_payloads)
131
+ def relationship_errors(model, relationship_payloads)
132
132
  errors = []
133
- traverse_relationships(relationship_payloads) do |name, model, payload|
133
+ traverse_relationships(model, relationship_payloads) do |name, model, payload|
134
134
  meta = {}.tap do |hash|
135
135
  hash[:name] = name
136
136
  hash[:type] = payload[:meta][:jsonapi_type]
@@ -1,3 +1,3 @@
1
1
  module GraphitiErrors
2
- VERSION = "1.0.alpha.2"
2
+ VERSION = "1.0.alpha.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.alpha.2
4
+ version: 1.0.alpha.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-03 00:00:00.000000000 Z
11
+ date: 2018-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 1.0.alpha.3
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 1.0.alpha.3
97
97
  description: Handles application errors and model validations
98
98
  email:
99
99
  - lrichmond1@bloomberg.net