salestation 4.5.0 → 4.6.0

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
  SHA256:
3
- metadata.gz: 50948c2e3f36bfe0779cb2458cf42cc6d7dd8e9b38b77a00e7bf0e975f7f2140
4
- data.tar.gz: 490a6207820bdc32b745e1d3d6c9cbbdb33e547783f557aa14ff89791b351173
3
+ metadata.gz: 0a374933b6b6c2191a57c6cceeb4dfed40263dee8378587f47b15a9b036f9867
4
+ data.tar.gz: d66178d5ac10fdf0a4ffc317cf28521912629d09105aa03feeaa191ef8183060
5
5
  SHA512:
6
- metadata.gz: d99f0b753951b98f0905d2084d432071d33d2a2370ae07726225db8d90f8dc8d5bdb6acc453ff2654a2bc81dc23ba27f125202eb1bbc8adceb09faca73638755
7
- data.tar.gz: 2d41a2673bc8a59fb78e97ecff19b4c58ed11c01e66111a538ee3e8c1d5c18b9ad504437368a5a5538e7cfb879efe94b6ef19678c8977348c5dbecc62b8b9489
6
+ metadata.gz: 69ef7cb09a68ee274d797079f3f4fe241cc28aab7ece3d8f18a59b9b478a276444c4e058029967e02d716d743b6ecf33a8f50ca09cc0ca271ff42c7f42f50e81
7
+ data.tar.gz: 9bef5feb7d0cf02e11639c26115846770e69ba1233db20a2090fba46e93a17259fc6eca1cabc71693a1efcd192b4edc53ad357082405e06743d2b35f859253cd
@@ -6,12 +6,27 @@ module Salestation
6
6
  def verify_input(schema)
7
7
  -> (request) do
8
8
  result = schema.call(request.input)
9
- if result.success?
10
- request.replace_input(result.output)
9
+
10
+ dry_validation_version = Gem.loaded_specs['dry-validation'].version
11
+ if dry_validation_version < Gem::Version.new('1.0')
12
+ Mapper.from_dry_validation_result(result.output, result.errors, custom_error_map)
13
+ if result.success?
14
+ request.replace_input(result.output)
15
+ else
16
+ Deterministic::Result::Failure(
17
+ Errors::InvalidInput.new(errors: result.errors, hints: result.hints)
18
+ )
19
+ end
20
+ elsif dry_validation_version <= Gem::Version.new('1.8')
21
+ if result.success?
22
+ request.replace_input(result.to_h)
23
+ else
24
+ Deterministic::Result::Failure(
25
+ Errors::InvalidInput.new(errors: result.errors.to_h, hints: result.hints.to_h)
26
+ )
27
+ end
11
28
  else
12
- Deterministic::Result::Failure(
13
- Errors::InvalidInput.new(errors: result.errors, hints: result.hints)
14
- )
29
+ raise 'Unsupported dry-validation version'
15
30
  end
16
31
  end
17
32
  end
data/salestation.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "salestation"
7
- spec.version = "4.5.0"
7
+ spec.version = "4.6.0"
8
8
  spec.authors = ["Glia TechMovers"]
9
9
  spec.email = ["techmovers@glia.com"]
10
10
 
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rspec", "~> 3.0"
25
25
  spec.add_development_dependency "pry", "~> 0.10.4"
26
26
  spec.add_development_dependency "glia-errors", "~> 0.11.4"
27
- spec.add_development_dependency "dry-validation", "~> 1.6.0"
27
+ spec.add_development_dependency "dry-validation", "~> 1.7.0"
28
28
 
29
29
  spec.add_dependency 'deterministic'
30
30
  spec.add_dependency 'dry-struct'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salestation
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-08 00:00:00.000000000 Z
11
+ date: 2022-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.6.0
89
+ version: 1.7.0
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: 1.6.0
96
+ version: 1.7.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: deterministic
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -189,7 +189,7 @@ homepage: ''
189
189
  licenses:
190
190
  - MIT
191
191
  metadata: {}
192
- post_install_message:
192
+ post_install_message:
193
193
  rdoc_options: []
194
194
  require_paths:
195
195
  - lib
@@ -204,8 +204,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  - !ruby/object:Gem::Version
205
205
  version: '0'
206
206
  requirements: []
207
- rubygems_version: 3.0.6
208
- signing_key:
207
+ rubygems_version: 3.1.6
208
+ signing_key:
209
209
  specification_version: 4
210
210
  summary: ''
211
211
  test_files: []