glia-errors 0.17.0 → 0.19.0
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 +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +7 -5
- data/glia-errors.gemspec +2 -2
- data/lib/glia/errors/client_errors.rb +2 -2
- data/lib/glia/errors/error.rb +1 -1
- data/lib/glia/errors/naming.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0d630cd9434d092ad29a2249479a58b8400cb66877786cd0c7e2006965f32c5
|
|
4
|
+
data.tar.gz: dcf120a2284cb22be8db1ad3efc2a36b4cb7e09b55db7507f4a0ee7a313087a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2de32667c456c627f0b6ffad56a1a625fbeecf6cda75e3682e318acf1b498c07427c7000b7623a8cec0f83076c4e2355ddec57ec3764786bebb719ce27bc5463
|
|
7
|
+
data.tar.gz: 26159e9b5ed8c13073786d3a0a64036ca369f174645790c7ddc6fb06f0294beff05f7eaf4933997624e5f572d0aba86c1d43474c505e58b77e62c094d1663307
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
glia-errors (0.
|
|
4
|
+
glia-errors (0.19.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
9
|
ast (2.4.3)
|
|
10
10
|
attr_extras (6.2.5)
|
|
11
|
+
bigdecimal (4.1.3)
|
|
11
12
|
concurrent-ruby (1.3.7)
|
|
12
13
|
diff-lcs (1.5.0)
|
|
13
14
|
dry-configurable (1.0.1)
|
|
@@ -30,11 +31,12 @@ GEM
|
|
|
30
31
|
dry-logic (>= 1.5, < 2)
|
|
31
32
|
dry-types (>= 1.7, < 2)
|
|
32
33
|
zeitwerk (~> 2.6)
|
|
33
|
-
dry-types (1.
|
|
34
|
+
dry-types (1.9.1)
|
|
35
|
+
bigdecimal (>= 3.0)
|
|
34
36
|
concurrent-ruby (~> 1.0)
|
|
35
|
-
dry-core (~> 1.0
|
|
36
|
-
dry-inflector (~> 1.0
|
|
37
|
-
dry-logic (
|
|
37
|
+
dry-core (~> 1.0)
|
|
38
|
+
dry-inflector (~> 1.0)
|
|
39
|
+
dry-logic (~> 1.4)
|
|
38
40
|
zeitwerk (~> 2.6)
|
|
39
41
|
dry-validation (1.10.0)
|
|
40
42
|
concurrent-ruby (~> 1.0)
|
data/glia-errors.gemspec
CHANGED
|
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'glia-errors'
|
|
8
|
-
spec.version = '0.
|
|
8
|
+
spec.version = '0.19.0'
|
|
9
9
|
spec.authors = ['Glia TechMovers']
|
|
10
10
|
spec.email = ['techmovers@glia.com']
|
|
11
11
|
|
|
@@ -18,5 +18,5 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
end
|
|
19
19
|
spec.require_paths = ['lib']
|
|
20
20
|
|
|
21
|
-
spec.required_ruby_version = '>=
|
|
21
|
+
spec.required_ruby_version = '>= 3.3', '< 4.0'
|
|
22
22
|
end
|
|
@@ -222,14 +222,14 @@ module Glia
|
|
|
222
222
|
end
|
|
223
223
|
|
|
224
224
|
class ResourceAlreadyExistsError < Error
|
|
225
|
-
def initialize(resource:, message: nil)
|
|
225
|
+
def initialize(resource:, id: nil, message: nil)
|
|
226
226
|
Naming.assert_snake_case(resource)
|
|
227
227
|
|
|
228
228
|
super(
|
|
229
229
|
type: RESOURCE_ALREADY_EXISTS_ERROR,
|
|
230
230
|
ref: create_ref(RESOURCE_ALREADY_EXISTS_ERROR),
|
|
231
231
|
message: message || "#{Naming.humanize(resource)} already exists",
|
|
232
|
-
error_details: { resource: resource }
|
|
232
|
+
error_details: { resource: resource, id: id }.compact
|
|
233
233
|
)
|
|
234
234
|
end
|
|
235
235
|
end
|
data/lib/glia/errors/error.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Glia
|
|
|
25
25
|
return details if primitive?(details)
|
|
26
26
|
|
|
27
27
|
if details.is_a?(Hash)
|
|
28
|
-
details.
|
|
28
|
+
details.to_h { |field, value| [field, error_details_to_h(value)] }
|
|
29
29
|
elsif details.is_a?(Array)
|
|
30
30
|
details.map { |error| error_details_to_h(error) }
|
|
31
31
|
elsif details.respond_to?(:to_h)
|
data/lib/glia/errors/naming.rb
CHANGED
|
@@ -27,10 +27,10 @@ module Glia
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
private_class_method def self.upcase_first(value)
|
|
30
|
-
value[0].upcase.concat(value[1
|
|
30
|
+
value[0].upcase.concat(value[1..])
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
SNAKE_CASE_REGEX = /\A[a-z0-9]+(_[a-z0-9]+)*\z
|
|
33
|
+
SNAKE_CASE_REGEX = /\A[a-z0-9]+(_[a-z0-9]+)*\z/
|
|
34
34
|
|
|
35
35
|
def self.assert_snake_case(value)
|
|
36
36
|
return if value.to_s.match(SNAKE_CASE_REGEX)
|
|
@@ -38,7 +38,7 @@ module Glia
|
|
|
38
38
|
raise ArgumentError, "Expected '#{value}' to be in snake case"
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
HEADER_REGEX = /\A[A-Z0-9]+[a-z0-9]*(-[A-Z0-9]+[a-zz0-9]*)*\z
|
|
41
|
+
HEADER_REGEX = /\A[A-Z0-9]+[a-z0-9]*(-[A-Z0-9]+[a-zz0-9]*)*\z/
|
|
42
42
|
|
|
43
43
|
def self.assert_header(value)
|
|
44
44
|
return if value.to_s.match(HEADER_REGEX)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: glia-errors
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.19.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Glia TechMovers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-09-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: ''
|
|
14
14
|
email:
|
|
@@ -46,7 +46,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
46
46
|
requirements:
|
|
47
47
|
- - ">="
|
|
48
48
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '
|
|
49
|
+
version: '3.3'
|
|
50
50
|
- - "<"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
52
|
version: '4.0'
|