yoti_sandbox 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/yoti_sandbox/doc_scan.rb +5 -0
- data/lib/yoti_sandbox/doc_scan/request/check/check.rb +1 -1
- data/lib/yoti_sandbox/doc_scan/request/check/document_check.rb +2 -2
- data/lib/yoti_sandbox/doc_scan/request/check/document_text_data_check.rb +6 -9
- data/lib/yoti_sandbox/doc_scan/request/check/liveness_check.rb +1 -1
- data/lib/yoti_sandbox/doc_scan/request/check/supplementary_document_text_data_check.rb +78 -0
- data/lib/yoti_sandbox/doc_scan/request/check_reports.rb +29 -2
- data/lib/yoti_sandbox/doc_scan/request/task/document_id_photo.rb +35 -0
- data/lib/yoti_sandbox/doc_scan/request/task/document_text_data_extraction_task.rb +69 -14
- data/lib/yoti_sandbox/doc_scan/request/task/supplementary_document_text_data_extraction_task.rb +152 -0
- data/lib/yoti_sandbox/doc_scan/request/task/text_data_extraction_reason.rb +78 -0
- data/lib/yoti_sandbox/doc_scan/request/task/text_data_extraction_recommendation.rb +86 -0
- data/lib/yoti_sandbox/doc_scan/request/task_results.rb +34 -3
- data/lib/yoti_sandbox/profile/extra_data.rb +1 -1
- data/yoti_sandbox.gemspec +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50664707d70da0ad9d28f183b68074c795f74ef59c05dbf4fbd1a0cef280d819
|
4
|
+
data.tar.gz: 6bae10a1f1675592f178d9ae1f47fdf3992196f1480a03e6a736b177a7638ea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe42559fa4b25d2a3f5d239471bfe86a0f1b59e00cb6c4bcb52cd895b52f2e2a4bf8087ce710d50be5514cf745e804204e245dac7f8bdf1dccf6157c9092efa1
|
7
|
+
data.tar.gz: 8de1edf888b5ede3604532ed62dd4210f7a55aa3de899c79062fefa980c37bd7d1ebf4045a40e9d879b5c87e83b3f2331d79985d7ecc447c1224a28f836afef7
|
data/Gemfile
CHANGED
@@ -12,9 +12,14 @@ require_relative 'doc_scan/request/check/document_authenticity_check'
|
|
12
12
|
require_relative 'doc_scan/request/check/id_document_comparison_check'
|
13
13
|
require_relative 'doc_scan/request/check/document_face_match_check'
|
14
14
|
require_relative 'doc_scan/request/check/document_text_data_check'
|
15
|
+
require_relative 'doc_scan/request/check/supplementary_document_text_data_check'
|
15
16
|
require_relative 'doc_scan/request/check/liveness_check'
|
16
17
|
require_relative 'doc_scan/request/check/zoom_liveness_check'
|
17
18
|
require_relative 'doc_scan/request/check/report/breakdown'
|
18
19
|
require_relative 'doc_scan/request/check/report/recommendation'
|
19
20
|
require_relative 'doc_scan/request/check/report/detail'
|
20
21
|
require_relative 'doc_scan/request/task/document_text_data_extraction_task'
|
22
|
+
require_relative 'doc_scan/request/task/supplementary_document_text_data_extraction_task'
|
23
|
+
require_relative 'doc_scan/request/task/document_id_photo'
|
24
|
+
require_relative 'doc_scan/request/task/text_data_extraction_recommendation'
|
25
|
+
require_relative 'doc_scan/request/task/text_data_extraction_reason'
|
@@ -9,7 +9,7 @@ module Yoti
|
|
9
9
|
# @param [CheckResult] result
|
10
10
|
#
|
11
11
|
def initialize(result)
|
12
|
-
raise(TypeError, "#{self.class} cannot be instantiated") if
|
12
|
+
raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(Check)
|
13
13
|
|
14
14
|
Validation.assert_is_a(CheckResult, result, 'result')
|
15
15
|
@result = result
|
@@ -10,7 +10,7 @@ module Yoti
|
|
10
10
|
# @param [DocumentFilter] document_filter
|
11
11
|
#
|
12
12
|
def initialize(result, document_filter)
|
13
|
-
raise(TypeError, "#{self.class} cannot be instantiated") if
|
13
|
+
raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(DocumentCheck)
|
14
14
|
|
15
15
|
super(result)
|
16
16
|
|
@@ -27,7 +27,7 @@ module Yoti
|
|
27
27
|
|
28
28
|
class DocumentCheckBuilder < CheckBuilder
|
29
29
|
def initialize
|
30
|
-
raise(TypeError, "#{self.class} cannot be instantiated") if
|
30
|
+
raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(DocumentCheckBuilder)
|
31
31
|
|
32
32
|
super
|
33
33
|
end
|
@@ -18,13 +18,15 @@ module Yoti
|
|
18
18
|
class DocumentTextDataCheckResult < CheckResult
|
19
19
|
#
|
20
20
|
# @param [CheckReport] report
|
21
|
-
# @param [Hash] document_fields
|
21
|
+
# @param [Hash,nil] document_fields
|
22
22
|
#
|
23
23
|
def initialize(report, document_fields)
|
24
24
|
super(report)
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
unless document_fields.nil?
|
27
|
+
Validation.assert_is_a(Hash, document_fields, 'document_fields')
|
28
|
+
document_fields.each { |_k, v| Validation.assert_respond_to(:to_json, v, 'document_fields value') }
|
29
|
+
end
|
28
30
|
@document_fields = document_fields
|
29
31
|
end
|
30
32
|
|
@@ -36,12 +38,6 @@ module Yoti
|
|
36
38
|
end
|
37
39
|
|
38
40
|
class DocumentTextDataCheckBuilder < DocumentCheckBuilder
|
39
|
-
def initialize
|
40
|
-
super
|
41
|
-
|
42
|
-
@document_fields = {}
|
43
|
-
end
|
44
|
-
|
45
41
|
#
|
46
42
|
# @param [String] key
|
47
43
|
# @param [#to_json] value
|
@@ -51,6 +47,7 @@ module Yoti
|
|
51
47
|
def with_document_field(key, value)
|
52
48
|
Validation.assert_is_a(String, key, 'key')
|
53
49
|
Validation.assert_respond_to(:to_json, value, 'value')
|
50
|
+
@document_fields ||= {}
|
54
51
|
@document_fields[key] = value
|
55
52
|
self
|
56
53
|
end
|
@@ -10,7 +10,7 @@ module Yoti
|
|
10
10
|
# @param [String] liveness_type
|
11
11
|
#
|
12
12
|
def initialize(result, liveness_type)
|
13
|
-
raise(TypeError, "#{self.class} cannot be instantiated") if
|
13
|
+
raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(LivenessCheck)
|
14
14
|
|
15
15
|
super(result)
|
16
16
|
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Yoti
|
6
|
+
module Sandbox
|
7
|
+
module DocScan
|
8
|
+
module Request
|
9
|
+
class SupplementaryDocumentTextDataCheck < DocumentCheck
|
10
|
+
#
|
11
|
+
# @return [SupplementaryDocumentTextDataCheckBuilder]
|
12
|
+
#
|
13
|
+
def self.builder
|
14
|
+
SupplementaryDocumentTextDataCheckBuilder.new
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class SupplementaryDocumentTextDataCheckResult < CheckResult
|
19
|
+
#
|
20
|
+
# @param [CheckReport] report
|
21
|
+
# @param [Hash,nil] document_fields
|
22
|
+
#
|
23
|
+
def initialize(report, document_fields)
|
24
|
+
super(report)
|
25
|
+
|
26
|
+
unless document_fields.nil?
|
27
|
+
Validation.assert_is_a(Hash, document_fields, 'document_fields')
|
28
|
+
document_fields.each { |_k, v| Validation.assert_respond_to(:to_json, v, 'document_fields value') }
|
29
|
+
end
|
30
|
+
@document_fields = document_fields
|
31
|
+
end
|
32
|
+
|
33
|
+
def as_json(*_args)
|
34
|
+
super.merge(
|
35
|
+
document_fields: @document_fields
|
36
|
+
).compact
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class SupplementaryDocumentTextDataCheckBuilder < DocumentCheckBuilder
|
41
|
+
#
|
42
|
+
# @param [String] key
|
43
|
+
# @param [#to_json] value
|
44
|
+
#
|
45
|
+
# @return [self]
|
46
|
+
#
|
47
|
+
def with_document_field(key, value)
|
48
|
+
Validation.assert_is_a(String, key, 'key')
|
49
|
+
Validation.assert_respond_to(:to_json, value, 'value')
|
50
|
+
@document_fields ||= {}
|
51
|
+
@document_fields[key] = value
|
52
|
+
self
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# @param [Hash] document_fields
|
57
|
+
#
|
58
|
+
# @return [self]
|
59
|
+
#
|
60
|
+
def with_document_fields(document_fields)
|
61
|
+
Validation.assert_is_a(Hash, document_fields, 'document_fields')
|
62
|
+
@document_fields = document_fields
|
63
|
+
self
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# @return [SupplementaryDocumentTextDataCheck]
|
68
|
+
#
|
69
|
+
def build
|
70
|
+
report = CheckReport.new(@recommendation, @breakdowns)
|
71
|
+
result = SupplementaryDocumentTextDataCheckResult.new(report, @document_fields)
|
72
|
+
SupplementaryDocumentTextDataCheck.new(result, @document_filter)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -19,7 +19,8 @@ module Yoti
|
|
19
19
|
liveness_checks,
|
20
20
|
document_face_match_checks,
|
21
21
|
async_report_delay,
|
22
|
-
id_document_comparison_checks = nil
|
22
|
+
id_document_comparison_checks = nil,
|
23
|
+
supplementary_document_text_data_checks = nil
|
23
24
|
)
|
24
25
|
Validation.assert_is_a(Array, document_text_data_checks, 'document_text_data_checks')
|
25
26
|
@document_text_data_checks = document_text_data_checks
|
@@ -38,6 +39,14 @@ module Yoti
|
|
38
39
|
|
39
40
|
Validation.assert_is_a(Array, id_document_comparison_checks, 'id_document_comparison_checks', true)
|
40
41
|
@id_document_comparison_checks = id_document_comparison_checks
|
42
|
+
|
43
|
+
Validation.assert_is_a(
|
44
|
+
Array,
|
45
|
+
supplementary_document_text_data_checks,
|
46
|
+
'supplementary_document_text_data_checks',
|
47
|
+
true
|
48
|
+
)
|
49
|
+
@supplementary_document_text_data_checks = supplementary_document_text_data_checks
|
41
50
|
end
|
42
51
|
|
43
52
|
def self.builder
|
@@ -55,6 +64,7 @@ module Yoti
|
|
55
64
|
ID_DOCUMENT_FACE_MATCH: @document_face_match_checks,
|
56
65
|
LIVENESS: @liveness_checks,
|
57
66
|
ID_DOCUMENT_COMPARISON: @id_document_comparison_checks,
|
67
|
+
SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK: @supplementary_document_text_data_checks,
|
58
68
|
async_report_delay: @async_report_delay
|
59
69
|
}.compact
|
60
70
|
end
|
@@ -67,6 +77,7 @@ module Yoti
|
|
67
77
|
@document_authenticity_checks = []
|
68
78
|
@document_face_match_checks = []
|
69
79
|
@id_document_comparison_checks = []
|
80
|
+
@supplementary_document_text_data_checks = []
|
70
81
|
end
|
71
82
|
|
72
83
|
#
|
@@ -135,6 +146,21 @@ module Yoti
|
|
135
146
|
self
|
136
147
|
end
|
137
148
|
|
149
|
+
#
|
150
|
+
# @param [SupplementaryDocumentTextDataCheck] supplementary_document_text_data_check
|
151
|
+
#
|
152
|
+
# @return [self]
|
153
|
+
#
|
154
|
+
def with_supplementary_document_text_data_check(supplementary_document_text_data_check)
|
155
|
+
Validation.assert_is_a(
|
156
|
+
SupplementaryDocumentTextDataCheck,
|
157
|
+
supplementary_document_text_data_check,
|
158
|
+
'supplementary_document_text_data_check'
|
159
|
+
)
|
160
|
+
@supplementary_document_text_data_checks << supplementary_document_text_data_check
|
161
|
+
self
|
162
|
+
end
|
163
|
+
|
138
164
|
#
|
139
165
|
# @return [CheckReports]
|
140
166
|
#
|
@@ -145,7 +171,8 @@ module Yoti
|
|
145
171
|
@liveness_checks,
|
146
172
|
@document_face_match_checks,
|
147
173
|
@async_report_delay,
|
148
|
-
@id_document_comparison_checks
|
174
|
+
@id_document_comparison_checks,
|
175
|
+
@supplementary_document_text_data_checks
|
149
176
|
)
|
150
177
|
end
|
151
178
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'base64'
|
4
|
+
|
5
|
+
module Yoti
|
6
|
+
module Sandbox
|
7
|
+
module DocScan
|
8
|
+
module Request
|
9
|
+
class DocumentIdPhoto
|
10
|
+
#
|
11
|
+
# @param [String] content_type
|
12
|
+
# @param [bin] data
|
13
|
+
#
|
14
|
+
def initialize(content_type, data)
|
15
|
+
Validation.assert_is_a(String, content_type, 'content_type')
|
16
|
+
@content_type = content_type
|
17
|
+
|
18
|
+
@data = data
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_json(*_args)
|
22
|
+
as_json.to_json
|
23
|
+
end
|
24
|
+
|
25
|
+
def as_json(*_args)
|
26
|
+
{
|
27
|
+
content_type: @content_type,
|
28
|
+
data: Base64.strict_encode64(@data)
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -12,8 +12,6 @@ module Yoti
|
|
12
12
|
# @param [DocumentFilter] document_filter
|
13
13
|
#
|
14
14
|
def initialize(result, document_filter)
|
15
|
-
raise(TypeError, "#{self.class} cannot be instantiated") if self.class == DocumentCheck
|
16
|
-
|
17
15
|
Validation.assert_is_a(DocumentTextDataExtractionTaskResult, result, 'result')
|
18
16
|
@result = result
|
19
17
|
|
@@ -43,12 +41,31 @@ module Yoti
|
|
43
41
|
|
44
42
|
class DocumentTextDataExtractionTaskResult
|
45
43
|
#
|
46
|
-
# @param [Hash] document_fields
|
47
|
-
#
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
# @param [Hash,nil] document_fields
|
45
|
+
# @param [DocumentIdPhoto,nil] document_id_photo
|
46
|
+
# @param [String,nil] detected_country
|
47
|
+
# @param [TextDataExtractionRecommendation,nil] recommendation
|
48
|
+
#
|
49
|
+
def initialize(
|
50
|
+
document_fields,
|
51
|
+
document_id_photo = nil,
|
52
|
+
detected_country = nil,
|
53
|
+
recommendation = nil
|
54
|
+
)
|
55
|
+
unless document_fields.nil?
|
56
|
+
Validation.assert_is_a(Hash, document_fields, 'document_fields')
|
57
|
+
document_fields.each { |_k, v| Validation.assert_respond_to(:to_json, v, 'document_fields value') }
|
58
|
+
end
|
51
59
|
@document_fields = document_fields
|
60
|
+
|
61
|
+
Validation.assert_is_a(DocumentIdPhoto, document_id_photo, 'document_id_photo', true)
|
62
|
+
@document_id_photo = document_id_photo
|
63
|
+
|
64
|
+
Validation.assert_is_a(String, detected_country, 'detected_country', true)
|
65
|
+
@detected_country = detected_country
|
66
|
+
|
67
|
+
Validation.assert_is_a(TextDataExtractionRecommendation, recommendation, 'recommendation', true)
|
68
|
+
@recommendation = recommendation
|
52
69
|
end
|
53
70
|
|
54
71
|
def to_json(*_args)
|
@@ -57,16 +74,15 @@ module Yoti
|
|
57
74
|
|
58
75
|
def as_json(*_args)
|
59
76
|
{
|
60
|
-
document_fields: @document_fields
|
61
|
-
|
77
|
+
document_fields: @document_fields,
|
78
|
+
document_id_photo: @document_id_photo,
|
79
|
+
detected_country: @detected_country,
|
80
|
+
recommendation: @recommendation
|
81
|
+
}.compact
|
62
82
|
end
|
63
83
|
end
|
64
84
|
|
65
85
|
class DocumentTextDataExtractionTaskBuilder
|
66
|
-
def initialize
|
67
|
-
@document_fields = {}
|
68
|
-
end
|
69
|
-
|
70
86
|
#
|
71
87
|
# @param [String] key
|
72
88
|
# @param [#to_json] value
|
@@ -76,6 +92,7 @@ module Yoti
|
|
76
92
|
def with_document_field(key, value)
|
77
93
|
Validation.assert_is_a(String, key, 'key')
|
78
94
|
Validation.assert_respond_to(:to_json, value, 'value')
|
95
|
+
@document_fields ||= {}
|
79
96
|
@document_fields[key] = value
|
80
97
|
self
|
81
98
|
end
|
@@ -101,11 +118,49 @@ module Yoti
|
|
101
118
|
self
|
102
119
|
end
|
103
120
|
|
121
|
+
#
|
122
|
+
# @param [String] content_type
|
123
|
+
# @param [bin] data
|
124
|
+
#
|
125
|
+
# @return [self]
|
126
|
+
#
|
127
|
+
def with_document_id_photo(content_type, data)
|
128
|
+
@document_id_photo = DocumentIdPhoto.new(content_type, data)
|
129
|
+
self
|
130
|
+
end
|
131
|
+
|
132
|
+
#
|
133
|
+
# @param [TextDataExtractionRecommendation] recommendation
|
134
|
+
#
|
135
|
+
# @return [self]
|
136
|
+
#
|
137
|
+
def with_recommendation(recommendation)
|
138
|
+
Validation.assert_is_a(TextDataExtractionRecommendation, recommendation, 'recommendation')
|
139
|
+
@recommendation = recommendation
|
140
|
+
self
|
141
|
+
end
|
142
|
+
|
143
|
+
#
|
144
|
+
# @param [String] detected_country
|
145
|
+
#
|
146
|
+
# @return [self]
|
147
|
+
#
|
148
|
+
def with_detected_country(detected_country)
|
149
|
+
Validation.assert_is_a(String, detected_country, 'detected_country')
|
150
|
+
@detected_country = detected_country
|
151
|
+
self
|
152
|
+
end
|
153
|
+
|
104
154
|
#
|
105
155
|
# @return [DocumentTextDataExtractionTask]
|
106
156
|
#
|
107
157
|
def build
|
108
|
-
result = DocumentTextDataExtractionTaskResult.new(
|
158
|
+
result = DocumentTextDataExtractionTaskResult.new(
|
159
|
+
@document_fields,
|
160
|
+
@document_id_photo,
|
161
|
+
@detected_country,
|
162
|
+
@recommendation
|
163
|
+
)
|
109
164
|
DocumentTextDataExtractionTask.new(result, @document_filter)
|
110
165
|
end
|
111
166
|
end
|
data/lib/yoti_sandbox/doc_scan/request/task/supplementary_document_text_data_extraction_task.rb
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Yoti
|
6
|
+
module Sandbox
|
7
|
+
module DocScan
|
8
|
+
module Request
|
9
|
+
class SupplementaryDocumentTextDataExtractionTask
|
10
|
+
#
|
11
|
+
# @param [SupplementaryDocumentTextDataExtractionTaskResult] result
|
12
|
+
# @param [DocumentFilter] document_filter
|
13
|
+
#
|
14
|
+
def initialize(result, document_filter)
|
15
|
+
Validation.assert_is_a(SupplementaryDocumentTextDataExtractionTaskResult, result, 'result')
|
16
|
+
@result = result
|
17
|
+
|
18
|
+
Validation.assert_is_a(DocumentFilter, document_filter, 'document_filter', true)
|
19
|
+
@document_filter = document_filter
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_json(*_args)
|
23
|
+
as_json.to_json
|
24
|
+
end
|
25
|
+
|
26
|
+
def as_json(*_args)
|
27
|
+
json = {
|
28
|
+
result: @result.as_json
|
29
|
+
}
|
30
|
+
json[:document_filter] = @document_filter.as_json unless @document_filter.nil?
|
31
|
+
json
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# @return [SupplementaryDocumentTextDataExtractionTaskBuilder]
|
36
|
+
#
|
37
|
+
def self.builder
|
38
|
+
SupplementaryDocumentTextDataExtractionTaskBuilder.new
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class SupplementaryDocumentTextDataExtractionTaskResult
|
43
|
+
#
|
44
|
+
# @param [Hash,nil] document_fields
|
45
|
+
# @param [String,nil] detected_country
|
46
|
+
# @param [TextDataExtractionRecommendation,nil] recommendation
|
47
|
+
#
|
48
|
+
def initialize(
|
49
|
+
document_fields,
|
50
|
+
detected_country = nil,
|
51
|
+
recommendation = nil
|
52
|
+
)
|
53
|
+
unless document_fields.nil?
|
54
|
+
Validation.assert_is_a(Hash, document_fields, 'document_fields')
|
55
|
+
document_fields.each { |_k, v| Validation.assert_respond_to(:to_json, v, 'document_fields value') }
|
56
|
+
end
|
57
|
+
@document_fields = document_fields
|
58
|
+
|
59
|
+
Validation.assert_is_a(String, detected_country, 'detected_country', true)
|
60
|
+
@detected_country = detected_country
|
61
|
+
|
62
|
+
Validation.assert_is_a(TextDataExtractionRecommendation, recommendation, 'recommendation', true)
|
63
|
+
@recommendation = recommendation
|
64
|
+
end
|
65
|
+
|
66
|
+
def to_json(*_args)
|
67
|
+
as_json.to_json
|
68
|
+
end
|
69
|
+
|
70
|
+
def as_json(*_args)
|
71
|
+
{
|
72
|
+
document_fields: @document_fields,
|
73
|
+
detected_country: @detected_country,
|
74
|
+
recommendation: @recommendation
|
75
|
+
}.compact
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class SupplementaryDocumentTextDataExtractionTaskBuilder
|
80
|
+
#
|
81
|
+
# @param [String] key
|
82
|
+
# @param [#to_json] value
|
83
|
+
#
|
84
|
+
# @return [self]
|
85
|
+
#
|
86
|
+
def with_document_field(key, value)
|
87
|
+
Validation.assert_is_a(String, key, 'key')
|
88
|
+
Validation.assert_respond_to(:to_json, value, 'value')
|
89
|
+
@document_fields ||= {}
|
90
|
+
@document_fields[key] = value
|
91
|
+
self
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# @param [Hash] document_fields
|
96
|
+
#
|
97
|
+
# @return [self]
|
98
|
+
#
|
99
|
+
def with_document_fields(document_fields)
|
100
|
+
Validation.assert_is_a(Hash, document_fields, 'document_fields')
|
101
|
+
@document_fields = document_fields
|
102
|
+
self
|
103
|
+
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# @param [DocumentFilter] document_filter
|
107
|
+
#
|
108
|
+
# @return [self]
|
109
|
+
#
|
110
|
+
def with_document_filter(document_filter)
|
111
|
+
@document_filter = document_filter
|
112
|
+
self
|
113
|
+
end
|
114
|
+
|
115
|
+
#
|
116
|
+
# @param [TextDataExtractionRecommendation] recommendation
|
117
|
+
#
|
118
|
+
# @return [self]
|
119
|
+
#
|
120
|
+
def with_recommendation(recommendation)
|
121
|
+
Validation.assert_is_a(TextDataExtractionRecommendation, recommendation, 'recommendation')
|
122
|
+
@recommendation = recommendation
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
#
|
127
|
+
# @param [String] detected_country
|
128
|
+
#
|
129
|
+
# @return [self]
|
130
|
+
#
|
131
|
+
def with_detected_country(detected_country)
|
132
|
+
Validation.assert_is_a(String, detected_country, 'detected_country')
|
133
|
+
@detected_country = detected_country
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
#
|
138
|
+
# @return [SupplementaryDocumentTextDataExtractionTask]
|
139
|
+
#
|
140
|
+
def build
|
141
|
+
result = SupplementaryDocumentTextDataExtractionTaskResult.new(
|
142
|
+
@document_fields,
|
143
|
+
@detected_country,
|
144
|
+
@recommendation
|
145
|
+
)
|
146
|
+
SupplementaryDocumentTextDataExtractionTask.new(result, @document_filter)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Yoti
|
6
|
+
module Sandbox
|
7
|
+
module DocScan
|
8
|
+
module Request
|
9
|
+
class TextDataExtractionReason
|
10
|
+
#
|
11
|
+
# @param [String] value
|
12
|
+
# @param [String] detail
|
13
|
+
#
|
14
|
+
def initialize(value, detail)
|
15
|
+
Validation.assert_is_a(String, value, 'value')
|
16
|
+
@value = value
|
17
|
+
|
18
|
+
Validation.assert_is_a(String, detail, 'detail', true)
|
19
|
+
@detail = detail
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_json(*_args)
|
23
|
+
as_json.to_json
|
24
|
+
end
|
25
|
+
|
26
|
+
def as_json(*_args)
|
27
|
+
{
|
28
|
+
value: @value,
|
29
|
+
detail: @detail
|
30
|
+
}.compact
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# @return [TextDataExtractionReasonBuilder]
|
35
|
+
#
|
36
|
+
def self.builder
|
37
|
+
TextDataExtractionReasonBuilder.new
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class TextDataExtractionReasonBuilder
|
42
|
+
#
|
43
|
+
# @return [self]
|
44
|
+
#
|
45
|
+
def for_quality
|
46
|
+
@value = 'QUALITY'
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# @return [self]
|
52
|
+
#
|
53
|
+
def for_user_error
|
54
|
+
@value = 'USER_ERROR'
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# @param [String] detail
|
60
|
+
#
|
61
|
+
# @return [self]
|
62
|
+
#
|
63
|
+
def with_detail(detail)
|
64
|
+
@detail = detail
|
65
|
+
self
|
66
|
+
end
|
67
|
+
|
68
|
+
#
|
69
|
+
# @return [TextDataExtractionReason]
|
70
|
+
#
|
71
|
+
def build
|
72
|
+
TextDataExtractionReason.new(@value, @detail)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Yoti
|
6
|
+
module Sandbox
|
7
|
+
module DocScan
|
8
|
+
module Request
|
9
|
+
class TextDataExtractionRecommendation
|
10
|
+
#
|
11
|
+
# @param [String] value
|
12
|
+
# @param [TextDataExtractionReason] reason
|
13
|
+
#
|
14
|
+
def initialize(value, reason)
|
15
|
+
Validation.assert_is_a(String, value, 'value')
|
16
|
+
@value = value
|
17
|
+
|
18
|
+
Validation.assert_is_a(TextDataExtractionReason, reason, 'reason', true)
|
19
|
+
@reason = reason
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_json(*_args)
|
23
|
+
as_json.to_json
|
24
|
+
end
|
25
|
+
|
26
|
+
def as_json(*_args)
|
27
|
+
{
|
28
|
+
value: @value,
|
29
|
+
reason: @reason
|
30
|
+
}.compact
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# @return [TextDataExtractionRecommendationBuilder]
|
35
|
+
#
|
36
|
+
def self.builder
|
37
|
+
TextDataExtractionRecommendationBuilder.new
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class TextDataExtractionRecommendationBuilder
|
42
|
+
#
|
43
|
+
# @return [self]
|
44
|
+
#
|
45
|
+
def for_progress
|
46
|
+
@value = 'PROGRESS'
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# @return [self]
|
52
|
+
#
|
53
|
+
def for_should_try_again
|
54
|
+
@value = 'SHOULD_TRY_AGAIN'
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# @return [self]
|
60
|
+
#
|
61
|
+
def for_must_try_again
|
62
|
+
@value = 'MUST_TRY_AGAIN'
|
63
|
+
self
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# @param [TextDataExtractionReason] reason
|
68
|
+
#
|
69
|
+
# @return [self]
|
70
|
+
#
|
71
|
+
def with_reason(reason)
|
72
|
+
@reason = reason
|
73
|
+
self
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# @return [TextDataExtractionRecommendation]
|
78
|
+
#
|
79
|
+
def build
|
80
|
+
TextDataExtractionRecommendation.new(@value, @reason)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -7,14 +7,25 @@ module Yoti
|
|
7
7
|
class TaskResults
|
8
8
|
#
|
9
9
|
# @param [Array<DocumentTextDataExtractionTask>] document_text_data_extraction_tasks
|
10
|
+
# @param [Array<SupplementaryDocumentTextDataExtractionTask>] supplementary_document_text_data_extraction_tasks
|
10
11
|
#
|
11
|
-
def initialize(
|
12
|
+
def initialize(
|
13
|
+
document_text_data_extraction_tasks,
|
14
|
+
supplementary_document_text_data_extraction_tasks
|
15
|
+
)
|
12
16
|
Validation.assert_is_a(
|
13
17
|
Array,
|
14
18
|
document_text_data_extraction_tasks,
|
15
19
|
'document_text_data_extraction_tasks'
|
16
20
|
)
|
17
21
|
@document_text_data_extraction_tasks = document_text_data_extraction_tasks
|
22
|
+
|
23
|
+
Validation.assert_is_a(
|
24
|
+
Array,
|
25
|
+
supplementary_document_text_data_extraction_tasks,
|
26
|
+
'supplementary_document_text_data_extraction_tasks'
|
27
|
+
)
|
28
|
+
@supplementary_document_text_data_extraction_tasks = supplementary_document_text_data_extraction_tasks
|
18
29
|
end
|
19
30
|
|
20
31
|
def self.builder
|
@@ -27,7 +38,8 @@ module Yoti
|
|
27
38
|
|
28
39
|
def as_json(*_args)
|
29
40
|
{
|
30
|
-
|
41
|
+
ID_DOCUMENT_TEXT_DATA_EXTRACTION: @document_text_data_extraction_tasks,
|
42
|
+
SUPPLEMENTARY_DOCUMENT_TEXT_DATA_EXTRACTION: @supplementary_document_text_data_extraction_tasks
|
31
43
|
}
|
32
44
|
end
|
33
45
|
end
|
@@ -35,6 +47,7 @@ module Yoti
|
|
35
47
|
class TaskResultsBuilder
|
36
48
|
def initialize
|
37
49
|
@document_text_data_extraction_tasks = []
|
50
|
+
@supplementary_document_text_data_extraction_tasks = []
|
38
51
|
end
|
39
52
|
|
40
53
|
#
|
@@ -52,11 +65,29 @@ module Yoti
|
|
52
65
|
self
|
53
66
|
end
|
54
67
|
|
68
|
+
#
|
69
|
+
# @param [SupplementaryDocumentTextDataExtractionTask] supplementary_document_text_data_extraction_task
|
70
|
+
#
|
71
|
+
# @return [self]
|
72
|
+
#
|
73
|
+
def with_supplementary_document_text_data_extraction_task(supplementary_document_text_data_extraction_task)
|
74
|
+
Validation.assert_is_a(
|
75
|
+
SupplementaryDocumentTextDataExtractionTask,
|
76
|
+
supplementary_document_text_data_extraction_task,
|
77
|
+
'supplementary_document_text_data_extraction_task'
|
78
|
+
)
|
79
|
+
@supplementary_document_text_data_extraction_tasks << supplementary_document_text_data_extraction_task
|
80
|
+
self
|
81
|
+
end
|
82
|
+
|
55
83
|
#
|
56
84
|
# @return [TaskResults]
|
57
85
|
#
|
58
86
|
def build
|
59
|
-
TaskResults.new(
|
87
|
+
TaskResults.new(
|
88
|
+
@document_text_data_extraction_tasks,
|
89
|
+
@supplementary_document_text_data_extraction_tasks
|
90
|
+
)
|
60
91
|
end
|
61
92
|
end
|
62
93
|
end
|
@@ -41,7 +41,7 @@ module Yoti
|
|
41
41
|
# @param [#as_json] value
|
42
42
|
#
|
43
43
|
def initialize(type, value)
|
44
|
-
raise(TypeError, "#{self.class} cannot be instantiated") if
|
44
|
+
raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(DataEntry)
|
45
45
|
|
46
46
|
Validation.assert_is_a(String, type, 'type')
|
47
47
|
@type = type
|
data/yoti_sandbox.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yoti_sandbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yoti
|
@@ -148,11 +148,16 @@ files:
|
|
148
148
|
- lib/yoti_sandbox/doc_scan/request/check/report/breakdown.rb
|
149
149
|
- lib/yoti_sandbox/doc_scan/request/check/report/detail.rb
|
150
150
|
- lib/yoti_sandbox/doc_scan/request/check/report/recommendation.rb
|
151
|
+
- lib/yoti_sandbox/doc_scan/request/check/supplementary_document_text_data_check.rb
|
151
152
|
- lib/yoti_sandbox/doc_scan/request/check/zoom_liveness_check.rb
|
152
153
|
- lib/yoti_sandbox/doc_scan/request/check_reports.rb
|
153
154
|
- lib/yoti_sandbox/doc_scan/request/document_filter.rb
|
154
155
|
- lib/yoti_sandbox/doc_scan/request/response_config.rb
|
156
|
+
- lib/yoti_sandbox/doc_scan/request/task/document_id_photo.rb
|
155
157
|
- lib/yoti_sandbox/doc_scan/request/task/document_text_data_extraction_task.rb
|
158
|
+
- lib/yoti_sandbox/doc_scan/request/task/supplementary_document_text_data_extraction_task.rb
|
159
|
+
- lib/yoti_sandbox/doc_scan/request/task/text_data_extraction_reason.rb
|
160
|
+
- lib/yoti_sandbox/doc_scan/request/task/text_data_extraction_recommendation.rb
|
156
161
|
- lib/yoti_sandbox/doc_scan/request/task_results.rb
|
157
162
|
- lib/yoti_sandbox/profile.rb
|
158
163
|
- lib/yoti_sandbox/profile/age_verification.rb
|