et_fake_ccd 0.1.39 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/et_fake_ccd/command/create_case_command.rb +1 -39
- data/lib/et_fake_ccd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f4521164ce6e915d1cac0c7c1ad03a3e824c469ee2c1fe7db671c369373975d
|
4
|
+
data.tar.gz: aa2fb84f10c0aac9483763e4ce105a503cb4d935b4653fb61b45e92817e5822f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4a503334e2f745ec63b306072e20389c97cd3093ea803300ec2e1e17486534f08cc5343f6c491cc6f2f9cad9272a6d2a52a73390dc212f687e25669d0ab270f
|
7
|
+
data.tar.gz: 8c5828eb3733c55809a6f27b0463c124660d57bcadd08b8d2e9add6d75f4647074afbb8e7fbccc5dde798566bc416d834c0ef163246ea630be0bc5360d47a537
|
data/Gemfile.lock
CHANGED
@@ -15,48 +15,10 @@ module EtFakeCcd
|
|
15
15
|
new data: json.dup
|
16
16
|
end
|
17
17
|
|
18
|
-
validate :
|
18
|
+
validate :validate_json_schema
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def validate_data
|
23
|
-
validate_json_schema
|
24
|
-
validate_claimant_type
|
25
|
-
validate_primary_claimant
|
26
|
-
end
|
27
|
-
|
28
|
-
def validate_claimant_type
|
29
|
-
data.dig('data', 'claimant_TypeOfClaimant').tap do |claimant_type|
|
30
|
-
errors.add :data, "Case data validation failed", field_error: { "id": "claimant_TypeOfClaimant", "message": "Wrong is not a valid value" } unless ['Individual', 'Company'].include?(claimant_type)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
def validate_primary_claimant
|
34
|
-
data.dig('data', 'claimantType', 'claimant_phone_number').tap do |phone|
|
35
|
-
errors.add :data, "Case data validation failed", field_error: { id: "claimantType.claimant_phone_number", message: "The data entered is not valid for this type of field, please delete and re-enter using only valid data" } if phone.present? && phone.length > 14
|
36
|
-
end
|
37
|
-
data.dig('data', 'claimantType', 'claimant_mobile_number').tap do |phone|
|
38
|
-
errors.add :data, "Case data validation failed", field_error: { id: "claimantType.claimant_mobile_number", message: "The data entered is not valid for this type of field, please delete and re-enter using only valid data" } if phone.present? && phone.length > 14
|
39
|
-
end
|
40
|
-
data.dig('data', 'claimantIndType', 'claimant_gender').tap do |gender|
|
41
|
-
next if gender.nil?
|
42
|
-
valid_values = ['Male', 'Female', 'Not Known', 'Non-binary']
|
43
|
-
errors.add :data, "Case data validation failed", field_error: { id: 'claimantIndType.claimant_gender', message: "#{gender} is not a valid value" } unless valid_values.include?(gender)
|
44
|
-
end
|
45
|
-
data.dig('data', 'claimantIndType', 'claimant_title1').tap do |title|
|
46
|
-
next if title.nil?
|
47
|
-
valid_values = ['Mr', 'Mrs', 'Miss', 'Ms', 'Dr', 'Prof', 'Sir', 'Lord', 'Lady', 'Dame', 'Capt', 'Rev', 'Other']
|
48
|
-
errors.add :data, "Case data validation failed", field_error: { id: 'claimantIndType.claimant_title1', message: "#{title} is not a valid value" } unless valid_values.include?(title)
|
49
|
-
end
|
50
|
-
data.dig('data', 'claimantType', 'claimant_contact_preference').tap do |pref|
|
51
|
-
next if pref.nil?
|
52
|
-
valid_values = ['Email', 'Post']
|
53
|
-
errors.add :data, "Case data validation failed", field_error: { id: 'claimantType.claimant_contact_preference', message: "#{pref} is not a valid value" } unless valid_values.include?(pref)
|
54
|
-
end
|
55
|
-
data.dig('data', 'claimantType', 'claimant_addressUK', 'PostCode').tap do |postcode|
|
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
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
22
|
def validate_json_schema
|
61
23
|
return if EtFakeCcd.config.create_case_schema_file.nil?
|
62
24
|
|
data/lib/et_fake_ccd/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.0
|
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-
|
11
|
+
date: 2019-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roda
|