et_fake_ccd 0.1.37 → 0.1.38

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: e1fe08652ec25e03d0c5e5d57292f73363380d0cfc64deba70090b9db4705043
4
- data.tar.gz: 066c86bddd3281ed03b5fb40932dd1abeaed890f20e6bfc51a5e97d475977b3e
3
+ metadata.gz: 24ec6475711dd2676f6e954fd0e3efb825ad989bf5b12c622b3ecd41ed7086e8
4
+ data.tar.gz: 67506b29459b751e19c1604a5c28f9ccd91a1262534203ca572b0fd8beafbb9f
5
5
  SHA512:
6
- metadata.gz: 4a49a9b71bf97d2ef8de62ec2f1da9090fc9d363dce8d9582ea238dd4e2dc8da8e3913723e4228d1e40f9d13b1b3f7ae7d74ae8b7e4ea1fa299935a46a168887
7
- data.tar.gz: 44d4ae6a96ea19af355e20832c29c7405a0ca9e0fd94df04701797205fec6c3a2694dae2d1e52ae8838af30d75ca08e8f58eb54bc758f523662f53e5ffe87840
6
+ metadata.gz: 986d188cfcf3a2d3dc62e0b77ec1e5dfc7f9ab268f1acbd003884a44f80532742319fe3203bcfd29c37c8e3718ede387f9dd2ba7ff0f52be57764567fe33e6db
7
+ data.tar.gz: 5325e33ea503b6243b0b74db724236144022768f143a93b58bab2d23166a2f943a8aa5db1617e23ef44519cc5845cad020c550e4d245665b6307459e687e4f06
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- et_fake_ccd (0.1.37)
4
+ et_fake_ccd (0.1.38)
5
5
  activemodel (>= 5.2.3)
6
6
  iodine (~> 0.7)
7
+ json-schema (~> 2.5)
7
8
  roda (~> 3.21)
8
9
  rotp (~> 5.1)
9
10
  thor (~> 0.20.3)
@@ -27,11 +28,13 @@ GEM
27
28
  i18n (1.7.0)
28
29
  concurrent-ruby (~> 1.0)
29
30
  iodine (0.7.34)
31
+ json-schema (2.8.1)
32
+ addressable (>= 2.4)
30
33
  minitest (5.12.2)
31
34
  public_suffix (4.0.1)
32
35
  rack (2.0.7)
33
36
  rake (10.5.0)
34
- roda (3.24.0)
37
+ roda (3.25.0)
35
38
  rack
36
39
  rotp (5.1.0)
37
40
  addressable (~> 2.5)
data/et_fake_ccd.gemspec CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency 'rotp', '~> 5.1'
30
30
  spec.add_dependency 'tilt', '~> 2.0', '>= 2.0.9'
31
31
  spec.add_dependency 'iodine', '~> 0.7'
32
+ spec.add_dependency 'json-schema', '~> 2.5'
32
33
 
33
34
  spec.add_development_dependency "bundler", "~> 2.0"
34
35
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,4 +1,5 @@
1
1
  require 'active_model'
2
+ require 'json-schema'
2
3
  module EtFakeCcd
3
4
  module Command
4
5
  class CreateCaseCommand
@@ -19,6 +20,7 @@ module EtFakeCcd
19
20
  private
20
21
 
21
22
  def validate_data
23
+ validate_json_schema
22
24
  validate_claimant_type
23
25
  validate_primary_claimant
24
26
  end
@@ -54,6 +56,17 @@ module EtFakeCcd
54
56
  errors.add :data, "Case data validation failed", field_error: { id: 'claimantType.claimant_addressUK.PostCode', message: "#{postcode} exceed maximum length 10" } if postcode.length > 10
55
57
  end
56
58
  end
59
+
60
+ def validate_json_schema
61
+ return if EtFakeCcd.config.create_case_schema_file.nil?
62
+
63
+ schema_errors = JSON::Validator.fully_validate(EtFakeCcd.config.create_case_schema_file, json)
64
+ return if schema_errors.empty?
65
+
66
+ schema_errors.each do |error|
67
+ errors.add :data, 'Case data validation failed (json schema)', field_error: { id: 'none', message: error }
68
+ end
69
+ end
57
70
  end
58
71
  end
59
72
  end
@@ -5,6 +5,7 @@ module EtFakeCcd
5
5
 
6
6
  attr_accessor :microservice, :microservice_secret, :valid_credentials, :oauth2_client_id, :oauth2_redirect_url
7
7
  attr_accessor :file_storage_path
8
+ attr_accessor :create_case_schema_file
8
9
  end
9
10
 
10
11
  Config.instance.tap do |c|
@@ -1,3 +1,3 @@
1
1
  module EtFakeCcd
2
- VERSION = "0.1.37"
2
+ VERSION = "0.1.38"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: et_fake_ccd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.37
4
+ version: 0.1.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Taylor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-15 00:00:00.000000000 Z
11
+ date: 2019-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roda
@@ -100,6 +100,20 @@ dependencies:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0.7'
103
+ - !ruby/object:Gem::Dependency
104
+ name: json-schema
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2.5'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '2.5'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: bundler
105
119
  requirement: !ruby/object:Gem::Requirement