yoti 1.6.4 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/Rakefile +0 -8
  4. data/lib/yoti.rb +50 -1
  5. data/lib/yoti/client.rb +13 -4
  6. data/lib/yoti/configuration.rb +7 -2
  7. data/lib/yoti/data_type/age_verification.rb +1 -1
  8. data/lib/yoti/data_type/base_profile.rb +1 -1
  9. data/lib/yoti/data_type/image.rb +4 -12
  10. data/lib/yoti/data_type/image_jpeg.rb +2 -0
  11. data/lib/yoti/data_type/image_png.rb +2 -0
  12. data/lib/yoti/data_type/media.rb +19 -0
  13. data/lib/yoti/doc_scan/client.rb +163 -0
  14. data/lib/yoti/doc_scan/constants.rb +28 -0
  15. data/lib/yoti/doc_scan/session/create/create_session_result.rb +50 -0
  16. data/lib/yoti/doc_scan/session/create/document_filter.rb +31 -0
  17. data/lib/yoti/doc_scan/session/create/document_restrictions_filter.rb +140 -0
  18. data/lib/yoti/doc_scan/session/create/notification_config.rb +142 -0
  19. data/lib/yoti/doc_scan/session/create/orthogonal_restrictions_filter.rb +150 -0
  20. data/lib/yoti/doc_scan/session/create/requested_check.rb +39 -0
  21. data/lib/yoti/doc_scan/session/create/requested_document_authenticity_check.rb +53 -0
  22. data/lib/yoti/doc_scan/session/create/requested_face_match_check.rb +95 -0
  23. data/lib/yoti/doc_scan/session/create/requested_liveness_check.rb +108 -0
  24. data/lib/yoti/doc_scan/session/create/requested_task.rb +39 -0
  25. data/lib/yoti/doc_scan/session/create/requested_text_extraction_task.rb +94 -0
  26. data/lib/yoti/doc_scan/session/create/required_document.rb +31 -0
  27. data/lib/yoti/doc_scan/session/create/required_id_document.rb +53 -0
  28. data/lib/yoti/doc_scan/session/create/sdk_config.rb +221 -0
  29. data/lib/yoti/doc_scan/session/create/session_specification.rb +203 -0
  30. data/lib/yoti/doc_scan/session/retrieve/authenticity_check_response.rb +12 -0
  31. data/lib/yoti/doc_scan/session/retrieve/breakdown_response.rb +38 -0
  32. data/lib/yoti/doc_scan/session/retrieve/check_response.rb +63 -0
  33. data/lib/yoti/doc_scan/session/retrieve/details_response.rb +28 -0
  34. data/lib/yoti/doc_scan/session/retrieve/document_fields_response.rb +21 -0
  35. data/lib/yoti/doc_scan/session/retrieve/face_map_response.rb +21 -0
  36. data/lib/yoti/doc_scan/session/retrieve/face_match_check_response.rb +12 -0
  37. data/lib/yoti/doc_scan/session/retrieve/frame_response.rb +21 -0
  38. data/lib/yoti/doc_scan/session/retrieve/generated_check_response.rb +28 -0
  39. data/lib/yoti/doc_scan/session/retrieve/generated_media.rb +28 -0
  40. data/lib/yoti/doc_scan/session/retrieve/generated_text_data_check_response.rb +12 -0
  41. data/lib/yoti/doc_scan/session/retrieve/get_session_result.rb +113 -0
  42. data/lib/yoti/doc_scan/session/retrieve/id_document_resource_response.rb +52 -0
  43. data/lib/yoti/doc_scan/session/retrieve/liveness_check_response.rb +12 -0
  44. data/lib/yoti/doc_scan/session/retrieve/liveness_resource_response.rb +24 -0
  45. data/lib/yoti/doc_scan/session/retrieve/media_response.rb +38 -0
  46. data/lib/yoti/doc_scan/session/retrieve/page_response.rb +27 -0
  47. data/lib/yoti/doc_scan/session/retrieve/recommendation_response.rb +34 -0
  48. data/lib/yoti/doc_scan/session/retrieve/report_response.rb +31 -0
  49. data/lib/yoti/doc_scan/session/retrieve/resource_container.rb +50 -0
  50. data/lib/yoti/doc_scan/session/retrieve/resource_response.rb +39 -0
  51. data/lib/yoti/doc_scan/session/retrieve/task_response.rb +87 -0
  52. data/lib/yoti/doc_scan/session/retrieve/text_data_check_response.rb +12 -0
  53. data/lib/yoti/doc_scan/session/retrieve/text_extraction_task_response.rb +18 -0
  54. data/lib/yoti/doc_scan/session/retrieve/zoom_liveness_resource_response.rb +33 -0
  55. data/lib/yoti/doc_scan/support/supported_documents.rb +60 -0
  56. data/lib/yoti/dynamic_share_service/extension/thirdparty_attribute_extension.rb +1 -1
  57. data/lib/yoti/dynamic_share_service/policy/dynamic_policy.rb +4 -4
  58. data/lib/yoti/dynamic_share_service/share_url.rb +26 -33
  59. data/lib/yoti/errors.rb +17 -2
  60. data/lib/yoti/http/aml_check_request.rb +12 -6
  61. data/lib/yoti/http/payloads/aml_address.rb +4 -0
  62. data/lib/yoti/http/payloads/aml_profile.rb +7 -1
  63. data/lib/yoti/http/profile_request.rb +11 -6
  64. data/lib/yoti/http/request.rb +218 -18
  65. data/lib/yoti/http/signed_request.rb +13 -4
  66. data/lib/yoti/ssl.rb +2 -2
  67. data/lib/yoti/util/anchor_processor.rb +1 -1
  68. data/lib/yoti/util/validation.rb +41 -0
  69. data/lib/yoti/version.rb +1 -1
  70. data/rubocop.yml +9 -1
  71. data/yoti.gemspec +1 -2
  72. metadata +49 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1d2cbb57b376a252d798c35820fcee63a46eb99809422441e592ed25bc0f9da
4
- data.tar.gz: 1e31e86853d8e419cad2bec50a260d9e26a9c8043299ff6dc10620635c9169c9
3
+ metadata.gz: 02fe8b8e97eb660a8f100add12f7a07591fd78c39a0b476ce386b01af9d8c18e
4
+ data.tar.gz: b37386c172ecf56164d5e8b18129c41698444459e4611b35e8aeda4da9176287
5
5
  SHA512:
6
- metadata.gz: 88a932e08b8b73b81ef7153935e984df1d0816c9cfdf0fe912342a57ca8b12a91892aec6b226520cd48f94b660264dca2cadd593ef85008dc2564c97c811a409
7
- data.tar.gz: 1b0bdb68176391c56302aff5bda6040aece1d891d6b4491ea605af30029c079de046ea6e03df81c49c99100a1500a0730adfbc6e705c69f18c2a6c96172f0c09
6
+ metadata.gz: 36f47a7c8728ccdde726c67d7ecde1282051f128e63ffd685c6981634d660bba98ff7de9c0aed53dee950112a392978c5ffce44d3a130d16d7487eb5fd22431c
7
+ data.tar.gz: bbbee64ecc44ce41a204c8109fb673339972886d5818db20d3952009b76fedf12222e705b7eb090c4da0fb0f9c8375fc4402e0ed9c595a8a72974e3f37ea5397
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Yoti Ruby SDK
2
2
 
3
3
  [![Build Status](https://travis-ci.com/getyoti/yoti-ruby-sdk.svg?branch=master)](https://travis-ci.com/getyoti/yoti-ruby-sdk)
4
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aruby&metric=coverage)](https://sonarcloud.io/dashboard?id=getyoti%3Aruby)
5
+ [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aruby&metric=bugs)](https://sonarcloud.io/dashboard?id=getyoti%3Aruby)
6
+ [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aruby&metric=code_smells)](https://sonarcloud.io/dashboard?id=getyoti%3Aruby)
7
+ [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aruby&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=getyoti%3Aruby)
4
8
 
5
9
  Welcome to the Yoti Ruby SDK. This repository contains the tools you need to quickly integrate your Ruby back-end with Yoti so that your users can share their identity details with your application in a secure and trusted way.
6
10
 
data/Rakefile CHANGED
@@ -14,14 +14,6 @@ RSpec::Core::RakeTask.new(:test_generators) do |t|
14
14
  t.pattern = ['spec/generators']
15
15
  end
16
16
 
17
- ################################
18
- # Coveralls #
19
- ################################
20
-
21
- require 'coveralls/rake/task'
22
- Coveralls::RakeTask.new
23
- task test_with_coveralls: [:spec, 'coveralls:push']
24
-
25
17
  ################################
26
18
  # Rubocop #
27
19
  ################################
@@ -18,6 +18,7 @@ require_relative 'yoti/data_type/application_profile'
18
18
  require_relative 'yoti/data_type/profile'
19
19
  require_relative 'yoti/data_type/attribute'
20
20
  require_relative 'yoti/data_type/signed_time_stamp'
21
+ require_relative 'yoti/data_type/media'
21
22
  require_relative 'yoti/data_type/image'
22
23
  require_relative 'yoti/data_type/image_jpeg'
23
24
  require_relative 'yoti/data_type/image_png'
@@ -26,7 +27,8 @@ require_relative 'yoti/data_type/document_details'
26
27
 
27
28
  require_relative 'yoti/util/age_processor'
28
29
  require_relative 'yoti/util/anchor_processor'
29
- require_relative 'yoti/util/log.rb'
30
+ require_relative 'yoti/util/log'
31
+ require_relative 'yoti/util/validation'
30
32
 
31
33
  require_relative 'yoti/activity_details'
32
34
  require_relative 'yoti/client'
@@ -47,6 +49,53 @@ require_relative 'yoti/dynamic_share_service/extension/thirdparty_attribute_exte
47
49
  require_relative 'yoti/share/extra_data'
48
50
  require_relative 'yoti/share/attribute_issuance_details'
49
51
 
52
+ require_relative 'yoti/doc_scan/client'
53
+ require_relative 'yoti/doc_scan/constants'
54
+
55
+ require_relative 'yoti/doc_scan/session/create/create_session_result'
56
+ require_relative 'yoti/doc_scan/session/create/requested_check'
57
+ require_relative 'yoti/doc_scan/session/create/requested_document_authenticity_check'
58
+ require_relative 'yoti/doc_scan/session/create/requested_face_match_check'
59
+ require_relative 'yoti/doc_scan/session/create/requested_liveness_check'
60
+ require_relative 'yoti/doc_scan/session/create/requested_task'
61
+ require_relative 'yoti/doc_scan/session/create/requested_text_extraction_task'
62
+ require_relative 'yoti/doc_scan/session/create/document_filter'
63
+ require_relative 'yoti/doc_scan/session/create/document_restrictions_filter'
64
+ require_relative 'yoti/doc_scan/session/create/orthogonal_restrictions_filter'
65
+ require_relative 'yoti/doc_scan/session/create/required_document'
66
+ require_relative 'yoti/doc_scan/session/create/required_id_document'
67
+ require_relative 'yoti/doc_scan/session/create/sdk_config'
68
+ require_relative 'yoti/doc_scan/session/create/notification_config'
69
+ require_relative 'yoti/doc_scan/session/create/session_specification'
70
+
71
+ require_relative 'yoti/doc_scan/session/retrieve/check_response'
72
+ require_relative 'yoti/doc_scan/session/retrieve/resource_response'
73
+ require_relative 'yoti/doc_scan/session/retrieve/authenticity_check_response'
74
+ require_relative 'yoti/doc_scan/session/retrieve/breakdown_response'
75
+ require_relative 'yoti/doc_scan/session/retrieve/details_response'
76
+ require_relative 'yoti/doc_scan/session/retrieve/document_fields_response'
77
+ require_relative 'yoti/doc_scan/session/retrieve/face_map_response'
78
+ require_relative 'yoti/doc_scan/session/retrieve/face_match_check_response'
79
+ require_relative 'yoti/doc_scan/session/retrieve/frame_response'
80
+ require_relative 'yoti/doc_scan/session/retrieve/generated_check_response'
81
+ require_relative 'yoti/doc_scan/session/retrieve/generated_media'
82
+ require_relative 'yoti/doc_scan/session/retrieve/generated_text_data_check_response'
83
+ require_relative 'yoti/doc_scan/session/retrieve/get_session_result'
84
+ require_relative 'yoti/doc_scan/session/retrieve/id_document_resource_response'
85
+ require_relative 'yoti/doc_scan/session/retrieve/liveness_check_response'
86
+ require_relative 'yoti/doc_scan/session/retrieve/liveness_resource_response'
87
+ require_relative 'yoti/doc_scan/session/retrieve/media_response'
88
+ require_relative 'yoti/doc_scan/session/retrieve/page_response'
89
+ require_relative 'yoti/doc_scan/session/retrieve/recommendation_response'
90
+ require_relative 'yoti/doc_scan/session/retrieve/report_response'
91
+ require_relative 'yoti/doc_scan/session/retrieve/resource_container'
92
+ require_relative 'yoti/doc_scan/session/retrieve/task_response'
93
+ require_relative 'yoti/doc_scan/session/retrieve/text_data_check_response'
94
+ require_relative 'yoti/doc_scan/session/retrieve/text_extraction_task_response'
95
+ require_relative 'yoti/doc_scan/session/retrieve/zoom_liveness_resource_response'
96
+
97
+ require_relative 'yoti/doc_scan/support/supported_documents'
98
+
50
99
  # The main module namespace of the Yoti gem
51
100
  module Yoti
52
101
  class << self
@@ -1,15 +1,17 @@
1
1
  module Yoti
2
2
  #
3
- # Handles all the publicly accesible Yoti methods for
4
- # geting data using an encrypted connect token
3
+ # Handles all the publicly accessible Yoti methods for
4
+ # getting data using an encrypted connect token
5
5
  #
6
6
  module Client
7
7
  #
8
8
  # Performs all the steps required to get the decrypted profile from an API request
9
9
  #
10
- # @param encrypted_connect_token [String] token provided as a base 64 string
10
+ # @param [String] encrypted_connect_token
11
+ # Token provided as a base 64 string
11
12
  #
12
- # @return [Object] an ActivityDetails instance encapsulating the user profile
13
+ # @return [ActivityDetails]
14
+ # An ActivityDetails instance encapsulating the user profile
13
15
  #
14
16
  def self.get_activity_details(encrypted_connect_token)
15
17
  receipt = Yoti::ProfileRequest.new(encrypted_connect_token).receipt
@@ -22,6 +24,13 @@ module Yoti
22
24
  ActivityDetails.new(receipt, user_profile, application_profile, extra_data)
23
25
  end
24
26
 
27
+ #
28
+ # Perform AML check
29
+ #
30
+ # @param [AmlProfile] aml_profile
31
+ #
32
+ # @return [<Hash>]
33
+ #
25
34
  def self.aml_check(aml_profile)
26
35
  Yoti::AmlCheckRequest.new(aml_profile).response
27
36
  end
@@ -3,7 +3,7 @@ module Yoti
3
3
  attr_accessor :client_sdk_id, :key_file_path, :key, :sdk_identifier,
4
4
  :api_url, :api_port, :api_version
5
5
 
6
- attr_writer :api_endpoint
6
+ attr_writer :api_endpoint, :doc_scan_api_endpoint
7
7
 
8
8
  # Set config variables by using a configuration block
9
9
  def initialize
@@ -18,7 +18,12 @@ module Yoti
18
18
 
19
19
  # @return [String] the API endpoint for the selected API version
20
20
  def api_endpoint
21
- @api_endpoint ||= "#{@api_url}/api/#{@api_version}"
21
+ @api_endpoint ||= ENV['YOTI_API_URL'] || "#{@api_url}/api/#{@api_version}"
22
+ end
23
+
24
+ # @return [String] the Doc Scan API endpoint
25
+ def doc_scan_api_endpoint
26
+ @doc_scan_api_endpoint ||= ENV['YOTI_DOC_SCAN_API_URL'] || "#{@api_url}/idverify/#{@api_version}"
22
27
  end
23
28
 
24
29
  # Validates the configuration values set in instance variables
@@ -37,7 +37,7 @@ module Yoti
37
37
  attr_reader :age
38
38
 
39
39
  #
40
- # @param [Yoti::Attribute]
40
+ # @param [Yoti::Attribute] attribute
41
41
  #
42
42
  def initialize(attribute)
43
43
  raise(ArgumentError, "'#{attribute.name}' is not a valid age verification") unless /^[^:]+:(?!.*:)[0-9]+$/.match?(attribute.name)
@@ -37,7 +37,7 @@ module Yoti
37
37
  #
38
38
  # @param [String] name
39
39
  #
40
- # @returns [Array]
40
+ # @return [Array]
41
41
  #
42
42
  def find_attributes_starting_with(name)
43
43
  @attributes.select { |key| key.to_s.start_with?(name) }
@@ -1,19 +1,11 @@
1
- require 'base64'
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Yoti
4
- class Image
5
- attr_reader :content
6
- attr_reader :mime_type
7
-
4
+ class Image < Media
8
5
  def initialize(content, mime_type)
9
- raise(TypeError, 'Image is an abstract class, so cannot be instantiated') if self.class == Yoti::Image
10
-
11
- @content = content
12
- @mime_type = mime_type
13
- end
6
+ raise(TypeError, "#{self.class} is an abstract class, so cannot be instantiated") if self.class == Image
14
7
 
15
- def base64_content
16
- "data:#{mime_type};base64,#{Base64.strict_encode64(content)}"
8
+ super(content, mime_type)
17
9
  end
18
10
  end
19
11
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Yoti
2
4
  class ImageJpeg < Image
3
5
  def initialize(content)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Yoti
2
4
  class ImagePng < Image
3
5
  def initialize(content)
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+
5
+ module Yoti
6
+ class Media
7
+ attr_reader :content
8
+ attr_reader :mime_type
9
+
10
+ def initialize(content, mime_type)
11
+ @content = content
12
+ @mime_type = mime_type
13
+ end
14
+
15
+ def base64_content
16
+ "data:#{mime_type};base64,#{Base64.strict_encode64(content)}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,163 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ class Client
6
+ class << self
7
+ #
8
+ # Creates a Doc Scan session using the supplied session specification
9
+ #
10
+ # @param [Yoti::DocScan::Session::Create::SessionSpecification] session_specification
11
+ #
12
+ # @return [Yoti::DocScan::Session::Create::CreateSessionResult]
13
+ #
14
+ def create_session(session_specification)
15
+ Validation.assert_is_a(
16
+ Yoti::DocScan::Session::Create::SessionSpecification,
17
+ session_specification,
18
+ 'session_specification'
19
+ )
20
+
21
+ response = create_request
22
+ .with_http_method('POST')
23
+ .with_endpoint('sessions')
24
+ .with_payload(session_specification)
25
+ .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
26
+ .build
27
+ .execute
28
+
29
+ Yoti::DocScan::Session::Create::CreateSessionResult.new(JSON.parse(response.body))
30
+ end
31
+
32
+ #
33
+ # Retrieves the state of a previously created Yoti Doc Scan session
34
+ #
35
+ # @param [String] session_id
36
+ #
37
+ # @return [Yoti::DocScan::Session::Retrieve::GetSessionResult]
38
+ #
39
+ def get_session(session_id)
40
+ Validation.assert_is_a(String, session_id, 'session_id')
41
+
42
+ response = create_request
43
+ .with_http_method('GET')
44
+ .with_endpoint(session_path(session_id))
45
+ .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
46
+ .build
47
+ .execute
48
+
49
+ Yoti::DocScan::Session::Retrieve::GetSessionResult.new(JSON.parse(response.body))
50
+ end
51
+
52
+ #
53
+ # Deletes a previously created Yoti Doc Scan session and all
54
+ # of its related resources
55
+ #
56
+ # @param [String] session_id
57
+ #
58
+ def delete_session(session_id)
59
+ Validation.assert_is_a(String, session_id, 'session_id')
60
+
61
+ create_request
62
+ .with_http_method('DELETE')
63
+ .with_endpoint(session_path(session_id))
64
+ .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
65
+ .build
66
+ .execute
67
+ end
68
+
69
+ #
70
+ # Retrieves media related to a Yoti Doc Scan session based
71
+ # on the supplied media ID
72
+ #
73
+ # @param [String] session_id
74
+ # @param [String] media_id
75
+ #
76
+ # @return [Yoti::Media]
77
+ #
78
+ def get_media_content(session_id, media_id)
79
+ Validation.assert_is_a(String, session_id, 'session_id')
80
+ Validation.assert_is_a(String, media_id, 'media_id')
81
+
82
+ response = create_request
83
+ .with_http_method('GET')
84
+ .with_endpoint(media_path(session_id, media_id))
85
+ .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
86
+ .build
87
+ .execute
88
+
89
+ Yoti::Media.new(
90
+ response.body,
91
+ response.get_fields('content-type')[0]
92
+ )
93
+ end
94
+
95
+ #
96
+ # Deletes media related to a Yoti Doc Scan session based
97
+ # on the supplied media ID
98
+ #
99
+ # @param [String] session_id
100
+ # @param [String] media_id
101
+ #
102
+ def delete_media_content(session_id, media_id)
103
+ Validation.assert_is_a(String, session_id, 'session_id')
104
+ Validation.assert_is_a(String, media_id, 'media_id')
105
+
106
+ create_request
107
+ .with_http_method('DELETE')
108
+ .with_endpoint(media_path(session_id, media_id))
109
+ .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
110
+ .build
111
+ .execute
112
+ end
113
+
114
+ #
115
+ # Gets a list of supported documents.
116
+ #
117
+ # @return [Yoti::DocScan::Support::SupportedDocumentsResponse]
118
+ #
119
+ def supported_documents
120
+ response = create_request
121
+ .with_http_method('GET')
122
+ .with_endpoint('supported-documents')
123
+ .build
124
+ .execute
125
+
126
+ Yoti::DocScan::Support::SupportedDocumentsResponse.new(JSON.parse(response.body))
127
+ end
128
+
129
+ private
130
+
131
+ #
132
+ # @param [String] session_id
133
+ #
134
+ # @return [String]
135
+ #
136
+ def session_path(session_id)
137
+ "sessions/#{session_id}"
138
+ end
139
+
140
+ #
141
+ # @param [String] session_id
142
+ # @param [String] media_id
143
+ #
144
+ # @return [String]
145
+ #
146
+ def media_path(session_id, media_id)
147
+ "#{session_path(session_id)}/media/#{media_id}/content"
148
+ end
149
+
150
+ #
151
+ # Create a base Doc Scan request
152
+ #
153
+ # @return [Yoti::Request]
154
+ #
155
+ def create_request
156
+ Yoti::Request
157
+ .builder
158
+ .with_base_url(Yoti.configuration.doc_scan_api_endpoint)
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ class Constants
6
+ ID_DOCUMENT_AUTHENTICITY = 'ID_DOCUMENT_AUTHENTICITY'
7
+ ID_DOCUMENT_TEXT_DATA_CHECK = 'ID_DOCUMENT_TEXT_DATA_CHECK'
8
+ ID_DOCUMENT_FACE_MATCH = 'ID_DOCUMENT_FACE_MATCH'
9
+ LIVENESS = 'LIVENESS'
10
+ ID_DOCUMENT_TEXT_DATA_EXTRACTION = 'ID_DOCUMENT_TEXT_DATA_EXTRACTION'
11
+ ID_DOCUMENT = 'ID_DOCUMENT'
12
+ ORTHOGONAL_RESTRICTIONS = 'ORTHOGONAL_RESTRICTIONS'
13
+ DOCUMENT_RESTRICTIONS = 'DOCUMENT_RESTRICTIONS'
14
+ INCLUDE = 'WHITELIST'
15
+ EXCLUDE = 'BLACKLIST'
16
+ ALWAYS = 'ALWAYS'
17
+ FALLBACK = 'FALLBACK'
18
+ NEVER = 'NEVER'
19
+ ZOOM = 'ZOOM'
20
+ CAMERA = 'CAMERA'
21
+ CAMERA_AND_UPLOAD = 'CAMERA_AND_UPLOAD'
22
+ RESOURCE_UPDATE = 'RESOURCE_UPDATE'
23
+ TASK_COMPLETION = 'TASK_COMPLETION'
24
+ CHECK_COMPLETION = 'CHECK_COMPLETION'
25
+ SESSION_COMPLETION = 'SESSION_COMPLETION'
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Create
7
+ #
8
+ # The response to a successful CreateSession call
9
+ #
10
+ class CreateSessionResult
11
+ #
12
+ # Returns the time-to-live (TTL) for the client session
13
+ # token for the created session
14
+ #
15
+ # @return [Integer]
16
+ #
17
+ attr_reader :client_session_token_ttl
18
+
19
+ #
20
+ # Returns the client session token for the created session
21
+ #
22
+ # @return [String]
23
+ #
24
+ attr_reader :client_session_token
25
+
26
+ #
27
+ # Session ID of the created session
28
+ #
29
+ # @return [String]
30
+ #
31
+ attr_reader :session_id
32
+
33
+ #
34
+ # @param [Hash] response
35
+ #
36
+ def initialize(response)
37
+ Validation.assert_is_a(Integer, response['client_session_token_ttl'], 'client_session_token_ttl', true)
38
+ @client_session_token_ttl = response['client_session_token_ttl']
39
+
40
+ Validation.assert_is_a(String, response['client_session_token'], 'client_session_token', true)
41
+ @client_session_token = response['client_session_token']
42
+
43
+ Validation.assert_is_a(String, response['session_id'], 'session_id', true)
44
+ @session_id = response['session_id']
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end