yoti_sandbox 1.0.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +8 -1
  4. data/lib/yoti_sandbox.rb +1 -0
  5. data/lib/yoti_sandbox/doc_scan.rb +25 -0
  6. data/lib/yoti_sandbox/doc_scan/client.rb +59 -0
  7. data/lib/yoti_sandbox/doc_scan/errors.rb +83 -0
  8. data/lib/yoti_sandbox/doc_scan/request/check/check.rb +115 -0
  9. data/lib/yoti_sandbox/doc_scan/request/check/document_authenticity_check.rb +29 -0
  10. data/lib/yoti_sandbox/doc_scan/request/check/document_check.rb +48 -0
  11. data/lib/yoti_sandbox/doc_scan/request/check/document_face_match_check.rb +29 -0
  12. data/lib/yoti_sandbox/doc_scan/request/check/document_text_data_check.rb +78 -0
  13. data/lib/yoti_sandbox/doc_scan/request/check/id_document_comparison_check.rb +56 -0
  14. data/lib/yoti_sandbox/doc_scan/request/check/liveness_check.rb +34 -0
  15. data/lib/yoti_sandbox/doc_scan/request/check/report/breakdown.rb +97 -0
  16. data/lib/yoti_sandbox/doc_scan/request/check/report/detail.rb +34 -0
  17. data/lib/yoti_sandbox/doc_scan/request/check/report/recommendation.rb +88 -0
  18. data/lib/yoti_sandbox/doc_scan/request/check/supplementary_document_text_data_check.rb +78 -0
  19. data/lib/yoti_sandbox/doc_scan/request/check/zoom_liveness_check.rb +36 -0
  20. data/lib/yoti_sandbox/doc_scan/request/check_reports.rb +182 -0
  21. data/lib/yoti_sandbox/doc_scan/request/document_filter.rb +77 -0
  22. data/lib/yoti_sandbox/doc_scan/request/response_config.rb +75 -0
  23. data/lib/yoti_sandbox/doc_scan/request/task/document_id_photo.rb +35 -0
  24. data/lib/yoti_sandbox/doc_scan/request/task/document_text_data_extraction_task.rb +170 -0
  25. data/lib/yoti_sandbox/doc_scan/request/task/supplementary_document_text_data_extraction_task.rb +152 -0
  26. data/lib/yoti_sandbox/doc_scan/request/task/text_data_extraction_reason.rb +78 -0
  27. data/lib/yoti_sandbox/doc_scan/request/task/text_data_extraction_recommendation.rb +86 -0
  28. data/lib/yoti_sandbox/doc_scan/request/task_results.rb +96 -0
  29. data/lib/yoti_sandbox/profile.rb +5 -0
  30. data/lib/yoti_sandbox/profile/age_verification.rb +7 -0
  31. data/lib/yoti_sandbox/profile/client.rb +8 -26
  32. data/lib/yoti_sandbox/profile/document_images.rb +69 -0
  33. data/lib/yoti_sandbox/profile/extra_data.rb +92 -0
  34. data/lib/yoti_sandbox/profile/third_party.rb +158 -0
  35. data/lib/yoti_sandbox/profile/token_request.rb +47 -6
  36. data/yoti_sandbox.gemspec +18 -5
  37. metadata +38 -18
  38. data/.github/ISSUE_TEMPLATE.md +0 -17
  39. data/.gitignore +0 -56
  40. data/CONTRIBUTING.md +0 -30
  41. data/Guardfile +0 -11
  42. data/Rakefile +0 -41
  43. data/rubocop.yml +0 -44
  44. data/yardstick.yml +0 -9
@@ -0,0 +1,158 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'time'
4
+
5
+ module Yoti
6
+ module Sandbox
7
+ module Profile
8
+ #
9
+ # Provides attribute issuance details data entry
10
+ #
11
+ class AttributeIssuanceDetails < DataEntry
12
+ #
13
+ # @param [AttributeIssuanceDetailsValue] value
14
+ #
15
+ def initialize(value)
16
+ Validation.assert_is_a(AttributeIssuanceDetailsValue, value, 'value')
17
+ super('THIRD_PARTY_ATTRIBUTE', value)
18
+ end
19
+
20
+ #
21
+ # @return [AttributeIssuanceDetailsBuilder]
22
+ #
23
+ def self.builder
24
+ AttributeIssuanceDetailsBuilder.new
25
+ end
26
+ end
27
+
28
+ #
29
+ # Builder for AttributeIssuanceDetails
30
+ #
31
+ class AttributeIssuanceDetailsBuilder
32
+ def initialize
33
+ @definitions = []
34
+ end
35
+
36
+ #
37
+ # @param [String] issuance_token
38
+ #
39
+ # @return [self]
40
+ #
41
+ def with_issuance_token(issuance_token)
42
+ Validation.assert_is_a(String, issuance_token, 'issuance_token')
43
+ @issuance_token = issuance_token
44
+ self
45
+ end
46
+
47
+ #
48
+ # @param [Time, DateTime] expiry_date
49
+ #
50
+ # @return [self]
51
+ #
52
+ def with_expiry_date(expiry_date)
53
+ Validation.assert_respond_to(:to_time, expiry_date, 'expiry_date')
54
+ @expiry_date = expiry_date
55
+ self
56
+ end
57
+
58
+ #
59
+ # @param [String] definition
60
+ #
61
+ # @return [self]
62
+ #
63
+ def with_definition(definition)
64
+ @definitions << AttributeDefinition.new(definition)
65
+ self
66
+ end
67
+
68
+ #
69
+ # @return [AttributeIssuanceDetails]
70
+ #
71
+ def build
72
+ issuing_attributes = IssuingAttributes.new(@expiry_date, @definitions)
73
+ value = AttributeIssuanceDetailsValue.new(@issuance_token, issuing_attributes)
74
+ AttributeIssuanceDetails.new(value)
75
+ end
76
+ end
77
+
78
+ #
79
+ # Provides attribute issuance details value consisting of token and attributes.
80
+ #
81
+ class AttributeIssuanceDetailsValue
82
+ #
83
+ # @param [String] issuance_token
84
+ # @param [IssuingAttributes] issuing_attributes
85
+ #
86
+ def initialize(issuance_token, issuing_attributes)
87
+ Validation.assert_is_a(String, issuance_token, 'issuance_token')
88
+ @issuance_token = issuance_token
89
+
90
+ Validation.assert_is_a(IssuingAttributes, issuing_attributes, 'issuing_attributes')
91
+ @issuing_attributes = issuing_attributes
92
+ end
93
+
94
+ def to_json(*_args)
95
+ as_json.to_json
96
+ end
97
+
98
+ def as_json(*_args)
99
+ {
100
+ issuance_token: @issuance_token,
101
+ issuing_attributes: @issuing_attributes
102
+ }
103
+ end
104
+ end
105
+
106
+ #
107
+ # Provides issuing attributes, consisting of expiry date and list of definitions.
108
+ #
109
+ class IssuingAttributes
110
+ #
111
+ # @param [Time, DateTime] expiry_date
112
+ # @param [Array<AttributeDefinition>] definitions
113
+ #
114
+ def initialize(expiry_date, definitions)
115
+ Validation.assert_respond_to(:to_time, expiry_date, 'expiry_date')
116
+ @expiry_date = expiry_date
117
+
118
+ Validation.assert_is_a(Array, definitions, 'definitions')
119
+ @definitions = definitions
120
+ end
121
+
122
+ def to_json(*_args)
123
+ as_json.to_json
124
+ end
125
+
126
+ def as_json(*_args)
127
+ json = {}
128
+ json[:expiry_date] = @expiry_date.to_time.utc.strftime('%FT%T.%3NZ') unless @expiry_date.nil?
129
+ json[:definitions] = @definitions.map(&:as_json)
130
+ json
131
+ end
132
+ end
133
+
134
+ #
135
+ # Provides a single attribute definition.
136
+ #
137
+ class AttributeDefinition
138
+ #
139
+ # @param [String] name
140
+ #
141
+ def initialize(name)
142
+ Validation.assert_is_a(String, name, 'name')
143
+ @name = name
144
+ end
145
+
146
+ def to_json(*_args)
147
+ as_json.to_json
148
+ end
149
+
150
+ def as_json(*_args)
151
+ {
152
+ name: @name
153
+ }
154
+ end
155
+ end
156
+ end
157
+ end
158
+ end
@@ -14,12 +14,26 @@ module Yoti
14
14
  #
15
15
  class TokenRequest
16
16
  #
17
- # @param [String] remember_me_id
17
+ # @param [String, nil] remember_me_id
18
18
  # @param [Array<Attribute>] attributes
19
+ # @param [ExtraData, nil] extra_data
19
20
  #
20
- def initialize(remember_me_id, attributes)
21
+ def initialize(remember_me_id, attributes, extra_data = nil)
22
+ Validation.assert_is_a(String, remember_me_id, 'remember_me_id', true)
21
23
  @remember_me_id = remember_me_id
24
+
25
+ Validation.assert_is_a(Array, attributes, 'attributes')
22
26
  @attributes = attributes
27
+
28
+ Validation.assert_is_a(ExtraData, extra_data, 'extra_data', true)
29
+ @extra_data = extra_data
30
+ end
31
+
32
+ #
33
+ # @return [TokenRequestBuilder]
34
+ #
35
+ def self.builder
36
+ TokenRequestBuilder.new
23
37
  end
24
38
 
25
39
  #
@@ -28,8 +42,9 @@ module Yoti
28
42
  def as_json(*_args)
29
43
  {
30
44
  remember_me_id: @remember_me_id,
31
- profile_attributes: @attributes.map(&:as_json)
32
- }
45
+ profile_attributes: @attributes.map(&:as_json),
46
+ extra_data: @extra_data
47
+ }.compact
33
48
  end
34
49
 
35
50
  #
@@ -45,7 +60,6 @@ module Yoti
45
60
  #
46
61
  class TokenRequestBuilder
47
62
  def initialize
48
- @remember_me_id = ''
49
63
  @attributes = []
50
64
  end
51
65
 
@@ -283,11 +297,38 @@ module Yoti
283
297
  )
284
298
  end
285
299
 
300
+ #
301
+ # @param [DocumentImages] document_images
302
+ # @param [Array<Anchor>] anchors
303
+ #
304
+ # @return [self]
305
+ #
306
+ def with_document_images(document_images, anchors: [])
307
+ with_attribute(
308
+ create_attribute(
309
+ name: Yoti::Attribute::DOCUMENT_IMAGES,
310
+ value: document_images.value,
311
+ anchors: anchors
312
+ )
313
+ )
314
+ end
315
+
316
+ #
317
+ # @param [ExtraData] extra_data
318
+ #
319
+ # @return [self]
320
+ #
321
+ def with_extra_data(extra_data)
322
+ Validation.assert_is_a(ExtraData, extra_data, 'extra_data')
323
+ @extra_data = extra_data
324
+ self
325
+ end
326
+
286
327
  #
287
328
  # @return [TokenRequest]
288
329
  #
289
330
  def build
290
- TokenRequest.new(@remember_me_id, @attributes)
331
+ TokenRequest.new(@remember_me_id, @attributes, @extra_data)
291
332
  end
292
333
 
293
334
  private
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'yoti_sandbox'
6
- spec.version = '1.0.0'
6
+ spec.version = '1.4.0'
7
7
  spec.authors = ['Yoti']
8
8
  spec.email = ['websdk@yoti.com']
9
9
 
@@ -16,17 +16,30 @@ Gem::Specification.new do |spec|
16
16
  spec.homepage = 'https://github.com/getyoti/yoti-ruby-sdk-sandbox'
17
17
  spec.license = 'MIT'
18
18
 
19
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|examples)/|^sonar-project.properties$|^.dependabot/config.yml$|^.travis.yml$}) }
19
+ exclude_patterns = [
20
+ '^(test|spec|features|examples|docs|.github)/',
21
+ '^.gitignore$',
22
+ '^.pre-commit-config.yaml$',
23
+ '^sonar-project.properties$',
24
+ '^.dependabot/config.yml$',
25
+ '^.travis.yml$',
26
+ '^CONTRIBUTING.md$',
27
+ '^Guardfile$',
28
+ '^Rakefile$',
29
+ '^yardstick.yml$',
30
+ '^rubocop.yml$'
31
+ ]
32
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/#{exclude_patterns.join('|')}/) }
20
33
  spec.require_paths = ['lib']
21
34
 
22
35
  spec.required_ruby_version = '>= 2.4'
23
36
 
24
- spec.add_dependency 'yoti', '~> 1.6'
37
+ spec.add_dependency 'yoti', '~> 1.7'
25
38
 
26
39
  spec.add_development_dependency 'bundler', '~> 2.0'
27
- spec.add_development_dependency 'rake', '~> 12.0'
40
+ spec.add_development_dependency 'rake', '~> 13.0'
28
41
  spec.add_development_dependency 'rspec', '~> 3.5'
29
- spec.add_development_dependency 'simplecov', '~> 0.13'
42
+ spec.add_development_dependency 'simplecov', '~> 0.17.1'
30
43
  spec.add_development_dependency 'webmock', '~> 3.3'
31
44
  spec.add_development_dependency 'yard', '~> 0.9'
32
45
  spec.add_development_dependency 'yardstick', '~> 0.9'
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.0.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoti
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-06 00:00:00.000000000 Z
11
+ date: 2020-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yoti
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '12.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '12.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.13'
75
+ version: 0.17.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.13'
82
+ version: 0.17.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -131,29 +131,49 @@ executables: []
131
131
  extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
- - ".github/ISSUE_TEMPLATE.md"
135
- - ".gitignore"
136
- - CONTRIBUTING.md
137
134
  - Gemfile
138
- - Guardfile
139
135
  - LICENSE
140
136
  - README.md
141
- - Rakefile
142
137
  - lib/yoti_sandbox.rb
138
+ - lib/yoti_sandbox/doc_scan.rb
139
+ - lib/yoti_sandbox/doc_scan/client.rb
140
+ - lib/yoti_sandbox/doc_scan/errors.rb
141
+ - lib/yoti_sandbox/doc_scan/request/check/check.rb
142
+ - lib/yoti_sandbox/doc_scan/request/check/document_authenticity_check.rb
143
+ - lib/yoti_sandbox/doc_scan/request/check/document_check.rb
144
+ - lib/yoti_sandbox/doc_scan/request/check/document_face_match_check.rb
145
+ - lib/yoti_sandbox/doc_scan/request/check/document_text_data_check.rb
146
+ - lib/yoti_sandbox/doc_scan/request/check/id_document_comparison_check.rb
147
+ - lib/yoti_sandbox/doc_scan/request/check/liveness_check.rb
148
+ - lib/yoti_sandbox/doc_scan/request/check/report/breakdown.rb
149
+ - lib/yoti_sandbox/doc_scan/request/check/report/detail.rb
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
152
+ - lib/yoti_sandbox/doc_scan/request/check/zoom_liveness_check.rb
153
+ - lib/yoti_sandbox/doc_scan/request/check_reports.rb
154
+ - lib/yoti_sandbox/doc_scan/request/document_filter.rb
155
+ - lib/yoti_sandbox/doc_scan/request/response_config.rb
156
+ - lib/yoti_sandbox/doc_scan/request/task/document_id_photo.rb
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
161
+ - lib/yoti_sandbox/doc_scan/request/task_results.rb
143
162
  - lib/yoti_sandbox/profile.rb
144
163
  - lib/yoti_sandbox/profile/age_verification.rb
145
164
  - lib/yoti_sandbox/profile/anchor.rb
146
165
  - lib/yoti_sandbox/profile/attribute.rb
147
166
  - lib/yoti_sandbox/profile/client.rb
167
+ - lib/yoti_sandbox/profile/document_images.rb
168
+ - lib/yoti_sandbox/profile/extra_data.rb
169
+ - lib/yoti_sandbox/profile/third_party.rb
148
170
  - lib/yoti_sandbox/profile/token_request.rb
149
- - rubocop.yml
150
- - yardstick.yml
151
171
  - yoti_sandbox.gemspec
152
172
  homepage: https://github.com/getyoti/yoti-ruby-sdk-sandbox
153
173
  licenses:
154
174
  - MIT
155
175
  metadata: {}
156
- post_install_message:
176
+ post_install_message:
157
177
  rdoc_options: []
158
178
  require_paths:
159
179
  - lib
@@ -169,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
189
  version: '0'
170
190
  requirements: []
171
191
  rubygems_version: 3.0.6
172
- signing_key:
192
+ signing_key:
173
193
  specification_version: 4
174
194
  summary: Yoti Ruby Sandbox SDK for back-end integration.
175
195
  test_files: []
@@ -1,17 +0,0 @@
1
- ---
2
- name: Custom issue template
3
- about: " There's a better way to get help!"
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- #
11
- # Wait ✋
12
- #
13
- # There's a better way to get help!
14
- #
15
- # Send your questions or issues to sdksupport@yoti.com
16
- #
17
- #
data/.gitignore DELETED
@@ -1,56 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /InstalledFiles
6
- /pkg/
7
- /spec/reports/
8
- /spec/examples.txt
9
- /test/tmp/
10
- /test/version_tmp/
11
- /tmp/
12
-
13
- # Used by dotenv library to load environment variables.
14
- .env
15
-
16
- # Ignore Byebug command history file.
17
- .byebug_history
18
-
19
- ## Specific to RubyMotion:
20
- .dat*
21
- .repl_history
22
- build/
23
- *.bridgesupport
24
- build-iPhoneOS/
25
- build-iPhoneSimulator/
26
-
27
- ## Specific to RubyMotion (use of CocoaPods):
28
- #
29
- # We recommend against adding the Pods directory to your .gitignore. However
30
- # you should judge for yourself, the pros and cons are mentioned at:
31
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
- #
33
- # vendor/Pods/
34
-
35
- ## Documentation cache and generated files:
36
- /.yardoc/
37
- /_yardoc/
38
- /doc/
39
- /rdoc/
40
-
41
- ## Environment normalization:
42
- /.bundle/
43
- /vendor/bundle
44
- /lib/bundler/man/
45
-
46
- # for a library or gem, you might want to ignore these files since the code is
47
- # intended to run in multiple environments; otherwise, check them in:
48
- Gemfile.lock
49
- .ruby-version
50
- .ruby-gemset
51
-
52
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
- .rvmrc
54
-
55
- # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
- # .rubocop-https?--*