aliquot 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aliquot/validator.rb +7 -8
  3. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2770596cedb5e18b0d1abd71b16081826a9f78668a8b04994913a31f21c593ca
4
- data.tar.gz: 3b4525df139a05d3a963fb06eae0881d833b686a45a6bf06707ad6ff44b98b0d
3
+ metadata.gz: e752bf7cf311e4fe611e3c868ed08510c54d9e1b05b327d5dfa390b3eeb8cee7
4
+ data.tar.gz: 5c7df397cabccc5009c712546838c67329f4e2c835935ba56e62f71b6c368920
5
5
  SHA512:
6
- metadata.gz: 5e50437ca7ad2733ca13f8bfb4448fba30b8187a01f304b213da5d6261b485af2ca8aff141031c3d7ab031d8a25f7b295e863c582fa9a8de7112865d0d9e8d5a
7
- data.tar.gz: 23af415ed4ac86e67932d26220f9cbbe5664f4966db378aefc4bd563c521a399fa4659930b3c7f44a698baf574be10b12f6606a5d80a1b1aa85deeb63d0ad2b5
6
+ metadata.gz: 648c2bb459b2a09b602c13dab8c8221fc726c886e047789c84ebf51d1436a3f5fece61255905744cf817dcf114d9833f3f0281d5c7ed18a6eb1c44a60b770521
7
+ data.tar.gz: eb060ab6212f664bf3545a306dee4eaac7f63a6388921faf70cc28393e7bc606731d408edb3224ce737c3bc9ef8be8efa16942df717e157a1f3e0f746ad467f6
@@ -226,7 +226,7 @@ module Aliquot
226
226
  @validation ||= @schema.call(@input)
227
227
  @output = @validation.to_h
228
228
  return true if @validation.success?
229
- raise Aliquot::ValidationError, "validation error(s), #{errors_formatted}"
229
+ raise Aliquot::ValidationError, "validation error(s): #{error_list.join(', ')}"
230
230
  end
231
231
 
232
232
  def valid?
@@ -241,13 +241,12 @@ module Aliquot
241
241
  @validation.errors
242
242
  end
243
243
 
244
- def errors_formatted(node = [errors])
245
- node.pop.flat_map do |key, value|
246
- if value.is_a?(Array)
247
- value.map { |error| "#{(node + [key]).join('.')} #{error}" }
248
- else
249
- errors_formatted(node + [key, value])
250
- end
244
+ def error_list(node = errors.to_h, path = '')
245
+ if node.is_a?(Array)
246
+ node.map { |error| "#{path} #{error}" }
247
+ elsif node.is_a?(Hash)
248
+ path = "#{path}." unless path.empty?
249
+ node.flat_map { |key, sub_node| error_list(sub_node, "#{path}#{key}") }
251
250
  end
252
251
  end
253
252
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aliquot
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clearhaus
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-05 00:00:00.000000000 Z
11
+ date: 2023-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-validation
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.14.1
97
- description:
97
+ description:
98
98
  email: hello@clearhaus.com
99
99
  executables: []
100
100
  extensions: []
@@ -108,7 +108,7 @@ homepage: https://github.com/clearhaus/aliquot
108
108
  licenses:
109
109
  - MIT
110
110
  metadata: {}
111
- post_install_message:
111
+ post_install_message:
112
112
  rdoc_options: []
113
113
  require_paths:
114
114
  - lib
@@ -123,8 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
- rubygems_version: 3.3.7
127
- signing_key:
126
+ rubygems_version: 3.3.5
127
+ signing_key:
128
128
  specification_version: 4
129
129
  summary: Validates Google Pay tokens
130
130
  test_files: []