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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 052f623e7edee662badfe3767e3a7c48eb708b16aca8f55de64fd292240fd8c3
4
- data.tar.gz: 411ce8c9d80d6c0d27653adf7d6821c3bc35b12f15f84f72f403997688439902
3
+ metadata.gz: 4f4521164ce6e915d1cac0c7c1ad03a3e824c469ee2c1fe7db671c369373975d
4
+ data.tar.gz: aa2fb84f10c0aac9483763e4ce105a503cb4d935b4653fb61b45e92817e5822f
5
5
  SHA512:
6
- metadata.gz: 9e3ec22f0f1ec0809d76745ef0713eaf8882088c4610ea01994b134bcf6f31e053234254650cb852c86c634df082f92a3c6174b75b4932931d77335848b55c81
7
- data.tar.gz: 17e9c9df8ede479baf09aa147b4ac52d0e7c9bc4cd16d9758238ff4fb4fa3d946373a4935eba96879f0d610dc659ff5f504d6cf7a2394f93397cd82d141bcfe1
6
+ metadata.gz: f4a503334e2f745ec63b306072e20389c97cd3093ea803300ec2e1e17486534f08cc5343f6c491cc6f2f9cad9272a6d2a52a73390dc212f687e25669d0ab270f
7
+ data.tar.gz: 8c5828eb3733c55809a6f27b0463c124660d57bcadd08b8d2e9add6d75f4647074afbb8e7fbccc5dde798566bc416d834c0ef163246ea630be0bc5360d47a537
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- et_fake_ccd (0.1.39)
4
+ et_fake_ccd (1.0.0)
5
5
  activemodel (>= 5.2.3)
6
6
  iodine (~> 0.7)
7
7
  json-schema (~> 2.5)
@@ -15,48 +15,10 @@ module EtFakeCcd
15
15
  new data: json.dup
16
16
  end
17
17
 
18
- validate :validate_data
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
 
@@ -1,3 +1,3 @@
1
1
  module EtFakeCcd
2
- VERSION = "0.1.39"
2
+ VERSION = "1.0.0"
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.39
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-16 00:00:00.000000000 Z
11
+ date: 2019-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roda