yoti 1.7.1 → 1.8.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: f78d9caae30514cbb608f4156a54d6c8c2f7d82a3df8afbdf6295b8239e983a7
4
- data.tar.gz: 59b9aad24b60db06445300441abfdf20203b52de713976d3a6815aca159b6579
3
+ metadata.gz: e34d2dbc6a002d6ea68375d1e0d0ba861587db16a7502e597aaacac5f97799f4
4
+ data.tar.gz: 81e54ccb7d6b3270efea24d7e1a632d4719f604eccd7da49f101ff6e565ca99d
5
5
  SHA512:
6
- metadata.gz: f656f156b49a6b96ed09271fcbb1fa312ef918195c184631481a9dee5e427c1c1866c58d43d97f09f7f38c7072b1bb9adb2de9acafa99d9c9f783845090d2eab
7
- data.tar.gz: 601d9374b0320b4c59bf6c5378e50dbba524337ef28b2b6d74ba7eebbef4f30c029f187ce75f52a631343178e9281cd5d28c8b25e1c96c3531d1816bc67c0de8
6
+ metadata.gz: 4433d2b8ac27da64991fe3f1f0d2271feb3c1ad41f43b50c49d9ec0615a75714042e63ef343fb93f4f8ae98860f93a4534f2128eafe1af7813ceba6d88458620
7
+ data.tar.gz: 0a2338a401a97000ba2a4999347c3e4471bfa896565653d87ac2b548c11b8eae73c86a1241cad5293ef3e19922e97caa7c67658df603c7704ced9965a806abc7
@@ -51,6 +51,7 @@ require_relative 'yoti/share/attribute_issuance_details'
51
51
 
52
52
  require_relative 'yoti/doc_scan/client'
53
53
  require_relative 'yoti/doc_scan/constants'
54
+ require_relative 'yoti/doc_scan/errors'
54
55
 
55
56
  require_relative 'yoti/doc_scan/session/create/create_session_result'
56
57
  require_relative 'yoti/doc_scan/session/create/requested_check'
@@ -74,6 +75,7 @@ require_relative 'yoti/doc_scan/session/retrieve/authenticity_check_response'
74
75
  require_relative 'yoti/doc_scan/session/retrieve/breakdown_response'
75
76
  require_relative 'yoti/doc_scan/session/retrieve/details_response'
76
77
  require_relative 'yoti/doc_scan/session/retrieve/document_fields_response'
78
+ require_relative 'yoti/doc_scan/session/retrieve/document_id_photo_response'
77
79
  require_relative 'yoti/doc_scan/session/retrieve/face_map_response'
78
80
  require_relative 'yoti/doc_scan/session/retrieve/face_match_check_response'
79
81
  require_relative 'yoti/doc_scan/session/retrieve/frame_response'
@@ -5,7 +5,7 @@ module Yoti
5
5
 
6
6
  def initialize(version, time_stamp)
7
7
  @version = version
8
- @time_stamp = time_stamp
8
+ @time_stamp = time_stamp.utc
9
9
  end
10
10
  end
11
11
  end
@@ -18,15 +18,18 @@ module Yoti
18
18
  'session_specification'
19
19
  )
20
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))
21
+ request = 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
+
28
+ begin
29
+ Yoti::DocScan::Session::Create::CreateSessionResult.new(JSON.parse(request.execute.body))
30
+ rescue Yoti::RequestError => e
31
+ raise Yoti::DocScan::Error.wrap(e)
32
+ end
30
33
  end
31
34
 
32
35
  #
@@ -39,14 +42,17 @@ module Yoti
39
42
  def get_session(session_id)
40
43
  Validation.assert_is_a(String, session_id, 'session_id')
41
44
 
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))
45
+ request = create_request
46
+ .with_http_method('GET')
47
+ .with_endpoint(session_path(session_id))
48
+ .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
49
+ .build
50
+
51
+ begin
52
+ Yoti::DocScan::Session::Retrieve::GetSessionResult.new(JSON.parse(request.execute.body))
53
+ rescue Yoti::RequestError => e
54
+ raise Yoti::DocScan::Error.wrap(e)
55
+ end
50
56
  end
51
57
 
52
58
  #
@@ -58,12 +64,17 @@ module Yoti
58
64
  def delete_session(session_id)
59
65
  Validation.assert_is_a(String, session_id, 'session_id')
60
66
 
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
+ request = create_request
68
+ .with_http_method('DELETE')
69
+ .with_endpoint(session_path(session_id))
70
+ .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
71
+ .build
72
+
73
+ begin
74
+ request.execute
75
+ rescue Yoti::RequestError => e
76
+ raise Yoti::DocScan::Error.wrap(e)
77
+ end
67
78
  end
68
79
 
69
80
  #
@@ -79,17 +90,22 @@ module Yoti
79
90
  Validation.assert_is_a(String, session_id, 'session_id')
80
91
  Validation.assert_is_a(String, media_id, 'media_id')
81
92
 
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
+ request = create_request
94
+ .with_http_method('GET')
95
+ .with_endpoint(media_path(session_id, media_id))
96
+ .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
97
+ .build
98
+
99
+ begin
100
+ response = request.execute
101
+
102
+ Yoti::Media.new(
103
+ response.body,
104
+ response.get_fields('content-type')[0]
105
+ )
106
+ rescue Yoti::RequestError => e
107
+ raise Yoti::DocScan::Error.wrap(e)
108
+ end
93
109
  end
94
110
 
95
111
  #
@@ -103,12 +119,17 @@ module Yoti
103
119
  Validation.assert_is_a(String, session_id, 'session_id')
104
120
  Validation.assert_is_a(String, media_id, 'media_id')
105
121
 
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
122
+ request = create_request
123
+ .with_http_method('DELETE')
124
+ .with_endpoint(media_path(session_id, media_id))
125
+ .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
126
+ .build
127
+
128
+ begin
129
+ request.execute
130
+ rescue Yoti::RequestError => e
131
+ raise Yoti::DocScan::Error.wrap(e)
132
+ end
112
133
  end
113
134
 
114
135
  #
@@ -117,13 +138,16 @@ module Yoti
117
138
  # @return [Yoti::DocScan::Support::SupportedDocumentsResponse]
118
139
  #
119
140
  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))
141
+ request = create_request
142
+ .with_http_method('GET')
143
+ .with_endpoint('supported-documents')
144
+ .build
145
+
146
+ begin
147
+ Yoti::DocScan::Support::SupportedDocumentsResponse.new(JSON.parse(request.execute.body))
148
+ rescue Yoti::RequestError => e
149
+ raise Yoti::DocScan::Error.wrap(e)
150
+ end
127
151
  end
128
152
 
129
153
  private
@@ -15,6 +15,8 @@ module Yoti
15
15
  EXCLUDE = 'BLACKLIST'
16
16
  ALWAYS = 'ALWAYS'
17
17
  FALLBACK = 'FALLBACK'
18
+ DESIRED = 'DESIRED'
19
+ IGNORE = 'IGNORE'
18
20
  NEVER = 'NEVER'
19
21
  ZOOM = 'ZOOM'
20
22
  CAMERA = 'CAMERA'
@@ -0,0 +1,81 @@
1
+ require 'json'
2
+
3
+ module Yoti
4
+ module DocScan
5
+ #
6
+ # Raises exceptions related to Doc Scan API requests
7
+ #
8
+ class Error < RequestError
9
+ def initialize(msg = nil, response = nil)
10
+ super(msg, response)
11
+
12
+ @default_message = msg
13
+ end
14
+
15
+ def message
16
+ @message ||= format_message
17
+ end
18
+
19
+ #
20
+ # Wraps an existing error
21
+ #
22
+ # @param [Error] error
23
+ #
24
+ # @return [self]
25
+ #
26
+ def self.wrap(error)
27
+ new(error.message, error.response)
28
+ end
29
+
30
+ private
31
+
32
+ #
33
+ # Formats error message from response.
34
+ #
35
+ # @return [String]
36
+ #
37
+ def format_message
38
+ return @default_message if @response.nil? || @response['Content-Type'] != 'application/json'
39
+
40
+ json = JSON.parse(@response.body)
41
+ format_response(json) || @default_message
42
+ end
43
+
44
+ #
45
+ # Format JSON error response.
46
+ #
47
+ # @param [Hash] json
48
+ #
49
+ # @return [String, nil]
50
+ #
51
+ def format_response(json)
52
+ return nil if json['code'].nil? || json['message'].nil?
53
+
54
+ code_message = "#{json['code']} - #{json['message']}"
55
+
56
+ unless json['errors'].nil?
57
+ property_errors = format_property_errors(json['errors'])
58
+
59
+ return "#{code_message}: #{property_errors.compact.join(', ')}" if property_errors.count.positive?
60
+ end
61
+
62
+ code_message
63
+ end
64
+
65
+ #
66
+ # Format property errors.
67
+ #
68
+ # @param [Array<Hash>] errors
69
+ #
70
+ # @return [Array<String>]
71
+ #
72
+ def format_property_errors(errors)
73
+ errors
74
+ .map do |e|
75
+ "#{e['property']} \"#{e['message']}\"" if e['property'] && e['message']
76
+ end
77
+ .compact
78
+ end
79
+ end
80
+ end
81
+ end
@@ -33,16 +33,22 @@ module Yoti
33
33
  #
34
34
  # @param [String] manual_check
35
35
  # Describes the manual fallback behaviour applied to each Task
36
+ # @param [String, nil] chip_data
37
+ # Describes the chip data requirement for each Task
36
38
  #
37
- def initialize(manual_check)
39
+ def initialize(manual_check, chip_data)
38
40
  Validation.assert_is_a(String, manual_check, 'manual_check')
39
41
  @manual_check = manual_check
42
+
43
+ Validation.assert_is_a(String, chip_data, 'chip_data', true)
44
+ @chip_data = chip_data
40
45
  end
41
46
 
42
47
  def as_json(*_args)
43
48
  {
44
- manual_check: @manual_check
45
- }
49
+ manual_check: @manual_check,
50
+ chip_data: @chip_data
51
+ }.compact
46
52
  end
47
53
  end
48
54
 
@@ -80,11 +86,27 @@ module Yoti
80
86
  self
81
87
  end
82
88
 
89
+ #
90
+ # @return [self]
91
+ #
92
+ def with_chip_data_desired
93
+ @chip_data = Constants::DESIRED
94
+ self
95
+ end
96
+
97
+ #
98
+ # @return [self]
99
+ #
100
+ def with_chip_data_ignore
101
+ @chip_data = Constants::IGNORE
102
+ self
103
+ end
104
+
83
105
  #
84
106
  # @return [RequestedTextExtractionTask]
85
107
  #
86
108
  def build
87
- config = RequestedTextExtractionTaskConfig.new(@manual_check)
109
+ config = RequestedTextExtractionTaskConfig.new(@manual_check, @chip_data)
88
110
  RequestedTextExtractionTask.new(config)
89
111
  end
90
112
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yoti
4
+ module DocScan
5
+ module Session
6
+ module Retrieve
7
+ class DocumentIdPhotoResponse
8
+ # @return [MediaResponse]
9
+ attr_reader :media
10
+
11
+ #
12
+ # @param [Hash] document_id_photo
13
+ #
14
+ def initialize(document_id_photo)
15
+ @media = MediaResponse.new(document_id_photo['media']) unless document_id_photo['media'].nil?
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -17,6 +17,9 @@ module Yoti
17
17
  # @return [DocumentFieldsResponse]
18
18
  attr_reader :document_fields
19
19
 
20
+ # @return [DocumentIdPhotoResponse]
21
+ attr_reader :document_id_photo
22
+
20
23
  #
21
24
  # @param [Hash] resource
22
25
  #
@@ -37,6 +40,8 @@ module Yoti
37
40
  end
38
41
 
39
42
  @document_fields = DocumentFieldsResponse.new(resource['document_fields']) unless resource['document_fields'].nil?
43
+
44
+ @document_id_photo = DocumentIdPhotoResponse.new(resource['document_id_photo']) unless resource['document_id_photo'].nil?
40
45
  end
41
46
 
42
47
  #
@@ -93,36 +93,54 @@ module Yoti
93
93
 
94
94
  #
95
95
  # @param [String] name
96
- # @param [Hash] constraints
96
+ # @param [Array<SourceConstraint>] constraints
97
+ # @param [Bool] accept_self_asserted
97
98
  #
98
- def with_wanted_attribute_by_name(name, constraints: nil)
99
+ def with_wanted_attribute_by_name(name, constraints: nil, accept_self_asserted: nil)
99
100
  attribute_builder = WantedAttribute.builder.with_name(name)
100
101
  constraints&.each do |constraint|
101
102
  attribute_builder.with_constraint constraint
102
103
  end
104
+ attribute_builder.with_accept_self_asserted(accept_self_asserted) unless accept_self_asserted.nil?
103
105
  attribute = attribute_builder.build
104
106
  with_wanted_attribute attribute
105
107
  end
106
108
 
109
+ #
110
+ # @option options [Array<SourceConstraint>] :constraints
111
+ # @option options [Bool] :accept_self_asserted
112
+ #
107
113
  def with_family_name(options = {})
108
114
  with_wanted_attribute_by_name Attribute::FAMILY_NAME, **options
109
115
  end
110
116
 
117
+ #
118
+ # @option options [Array<SourceConstraint>] :constraints
119
+ # @option options [Bool] :accept_self_asserted
120
+ #
111
121
  def with_given_names(options = {})
112
122
  with_wanted_attribute_by_name Attribute::GIVEN_NAMES, **options
113
123
  end
114
124
 
125
+ #
126
+ # @option options [Array<SourceConstraint>] :constraints
127
+ # @option options [Bool] :accept_self_asserted
128
+ #
115
129
  def with_full_name(options = {})
116
130
  with_wanted_attribute_by_name Attribute::FULL_NAME, **options
117
131
  end
118
132
 
133
+ #
134
+ # @option options [Array<SourceConstraint>] :constraints
135
+ # @option options [Bool] :accept_self_asserted
136
+ #
119
137
  def with_date_of_birth(options = {})
120
138
  with_wanted_attribute_by_name Attribute::DATE_OF_BIRTH, **options
121
139
  end
122
140
 
123
141
  #
124
142
  # @param [String] derivation
125
- # @param [Hash] constraints
143
+ # @param [Array<SourceConstraint>] constraints
126
144
  #
127
145
  def with_age_derived_attribute(derivation, constraints: nil)
128
146
  attribute_builder = WantedAttribute.builder
@@ -136,6 +154,8 @@ module Yoti
136
154
 
137
155
  #
138
156
  # @param [Integer] age
157
+ # @option options [Array<SourceConstraint>] :constraints
158
+ # @option options [Bool] :accept_self_asserted
139
159
  #
140
160
  def with_age_over(age, options = {})
141
161
  with_age_derived_attribute(Attribute::AGE_OVER + age.to_s, **options)
@@ -143,41 +163,83 @@ module Yoti
143
163
 
144
164
  #
145
165
  # @param [Integer] age
166
+ # @option options [Array<SourceConstraint>] :constraints
167
+ # @option options [Bool] :accept_self_asserted
146
168
  #
147
169
  def with_age_under(age, options = {})
148
170
  with_age_derived_attribute(Attribute::AGE_UNDER + age.to_s, **options)
149
171
  end
150
172
 
173
+ #
174
+ # @option options [Array<SourceConstraint>] :constraints
175
+ # @option options [Bool] :accept_self_asserted
176
+ #
151
177
  def with_gender(options = {})
152
178
  with_wanted_attribute_by_name Attribute::GENDER, **options
153
179
  end
154
180
 
181
+ #
182
+ # @option options [Array<SourceConstraint>] :constraints
183
+ # @option options [Bool] :accept_self_asserted
184
+ #
155
185
  def with_postal_address(options = {})
156
186
  with_wanted_attribute_by_name(Attribute::POSTAL_ADDRESS, **options)
157
187
  end
158
188
 
189
+ #
190
+ # @option options [Array<SourceConstraint>] :constraints
191
+ # @option options [Bool] :accept_self_asserted
192
+ #
159
193
  def with_structured_postal_address(options = {})
160
194
  with_wanted_attribute_by_name(Attribute::STRUCTURED_POSTAL_ADDRESS, **options)
161
195
  end
162
196
 
197
+ #
198
+ # @option options [Array<SourceConstraint>] :constraints
199
+ # @option options [Bool] :accept_self_asserted
200
+ #
163
201
  def with_nationality(options = {})
164
202
  with_wanted_attribute_by_name(Attribute::NATIONALITY, **options)
165
203
  end
166
204
 
205
+ #
206
+ # @option options [Array<SourceConstraint>] :constraints
207
+ # @option options [Bool] :accept_self_asserted
208
+ #
167
209
  def with_phone_number(options = {})
168
210
  with_wanted_attribute_by_name(Attribute::PHONE_NUMBER, **options)
169
211
  end
170
212
 
213
+ #
214
+ # @option options [Array<SourceConstraint>] :constraints
215
+ # @option options [Bool] :accept_self_asserted
216
+ #
171
217
  def with_selfie(options = {})
172
218
  with_wanted_attribute_by_name(Attribute::SELFIE, **options)
173
219
  end
174
220
 
221
+ #
222
+ # @option options [Array<SourceConstraint>] :constraints
223
+ # @option options [Bool] :accept_self_asserted
224
+ #
175
225
  def with_email(options = {})
176
226
  with_wanted_attribute_by_name(Attribute::EMAIL_ADDRESS, **options)
177
227
  end
178
228
 
179
- def with_document_details
180
- with_wanted_attribute_by_name(Attribute::DOCUMENT_DETAILS)
229
+ #
230
+ # @option options [Array<SourceConstraint>] :constraints
231
+ # @option options [Bool] :accept_self_asserted
232
+ #
233
+ def with_document_details(options = {})
234
+ with_wanted_attribute_by_name(Attribute::DOCUMENT_DETAILS, **options)
235
+ end
236
+
237
+ #
238
+ # @option options [Array<SourceConstraint>] :constraints
239
+ # @option options [Bool] :accept_self_asserted
240
+ #
241
+ def with_document_images(options = {})
242
+ with_wanted_attribute_by_name(Attribute::DOCUMENT_IMAGES, **options)
181
243
  end
182
244
  end
183
245
  end
@@ -7,16 +7,14 @@ module Yoti
7
7
  attr_reader :response
8
8
 
9
9
  def initialize(message, response = nil)
10
- super(append_response_message(message, response))
10
+ super(message)
11
11
  @response = response
12
12
  end
13
13
 
14
- private
14
+ def message
15
+ return super if @response.nil? || @response.body.empty?
15
16
 
16
- def append_response_message(message, response)
17
- return message if response.nil? || response.body.empty?
18
-
19
- "#{message}: #{response.body}"
17
+ "#{super}: #{@response.body}"
20
18
  end
21
19
  end
22
20
 
@@ -1,4 +1,4 @@
1
1
  module Yoti
2
2
  # @return [String] the gem's current version
3
- VERSION = '1.7.1'.freeze
3
+ VERSION = '1.8.0'.freeze
4
4
  end
@@ -18,7 +18,19 @@ Gem::Specification.new do |spec|
18
18
  spec.homepage = 'https://github.com/getyoti/yoti-ruby-sdk'
19
19
  spec.license = 'MIT'
20
20
 
21
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|examples|docs)/|^sonar-project.properties$|^.dependabot/config.yml$|^.travis.yml$}) }
21
+ exclude_patterns = [
22
+ '^(test|spec|features|examples|docs|.github)/',
23
+ '^.gitignore$',
24
+ '^sonar-project.properties$',
25
+ '^.dependabot/config.yml$',
26
+ '^.travis.yml$',
27
+ '^CONTRIBUTING.md$',
28
+ '^Guardfile$',
29
+ '^Rakefile$',
30
+ '^yardstick.yml$',
31
+ '^rubocop.yml$'
32
+ ]
33
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/#{exclude_patterns.join('|')}/) }
22
34
  spec.require_paths = ['lib']
23
35
 
24
36
  spec.required_ruby_version = '>= 2.4'
@@ -28,7 +40,7 @@ Gem::Specification.new do |spec|
28
40
  spec.add_development_dependency 'bundler', '~> 2.0'
29
41
  spec.add_development_dependency 'dotenv', '~> 2.2'
30
42
  spec.add_development_dependency 'generator_spec', '~> 0.9'
31
- spec.add_development_dependency 'rake', '~> 12.0'
43
+ spec.add_development_dependency 'rake', '~> 13.0'
32
44
  spec.add_development_dependency 'rspec', '~> 3.5'
33
45
  spec.add_development_dependency 'simplecov', '~> 0.17.1'
34
46
  spec.add_development_dependency 'webmock', '~> 3.3'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yoti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.8.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-06-17 00:00:00.000000000 Z
11
+ date: 2020-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '12.0'
75
+ version: '13.0'
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: '12.0'
82
+ version: '13.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -160,14 +160,9 @@ executables: []
160
160
  extensions: []
161
161
  extra_rdoc_files: []
162
162
  files:
163
- - ".github/ISSUE_TEMPLATE.md"
164
- - ".gitignore"
165
- - CONTRIBUTING.md
166
163
  - Gemfile
167
- - Guardfile
168
164
  - LICENSE.md
169
165
  - README.md
170
- - Rakefile
171
166
  - lib/generators/yoti/install/install_generator.rb
172
167
  - lib/generators/yoti/install/templates/yoti.rb
173
168
  - lib/yoti.rb
@@ -189,6 +184,7 @@ files:
189
184
  - lib/yoti/data_type/signed_time_stamp.rb
190
185
  - lib/yoti/doc_scan/client.rb
191
186
  - lib/yoti/doc_scan/constants.rb
187
+ - lib/yoti/doc_scan/errors.rb
192
188
  - lib/yoti/doc_scan/session/create/create_session_result.rb
193
189
  - lib/yoti/doc_scan/session/create/document_filter.rb
194
190
  - lib/yoti/doc_scan/session/create/document_restrictions_filter.rb
@@ -209,6 +205,7 @@ files:
209
205
  - lib/yoti/doc_scan/session/retrieve/check_response.rb
210
206
  - lib/yoti/doc_scan/session/retrieve/details_response.rb
211
207
  - lib/yoti/doc_scan/session/retrieve/document_fields_response.rb
208
+ - lib/yoti/doc_scan/session/retrieve/document_id_photo_response.rb
212
209
  - lib/yoti/doc_scan/session/retrieve/face_map_response.rb
213
210
  - lib/yoti/doc_scan/session/retrieve/face_match_check_response.rb
214
211
  - lib/yoti/doc_scan/session/retrieve/frame_response.rb
@@ -266,8 +263,6 @@ files:
266
263
  - lib/yoti/util/log.rb
267
264
  - lib/yoti/util/validation.rb
268
265
  - lib/yoti/version.rb
269
- - rubocop.yml
270
- - yardstick.yml
271
266
  - yoti.gemspec
272
267
  homepage: https://github.com/getyoti/yoti-ruby-sdk
273
268
  licenses:
@@ -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,40 +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
- ## Documentation cache and generated files:
17
- /.yardoc/
18
- /_yardoc/
19
- /doc/
20
- /rdoc/
21
- /yardoc/
22
-
23
- ## Environment normalization:
24
- /.bundle/
25
- /vendor/bundle
26
- /lib/bundler/man/
27
-
28
- # for a library or gem, you might want to ignore these files since the code is
29
- # intended to run in multiple environments; otherwise, check them in:
30
- Gemfile.lock
31
- .ruby-version
32
- .ruby-gemset
33
-
34
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
- .rvmrc
36
-
37
- # Ignore Yardstick measurement files
38
- /measurement
39
- examples/rails/public/*.jpeg
40
- examples/sinatra/public/*.jpeg
@@ -1,98 +0,0 @@
1
- # Contributing
2
-
3
- After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rake spec` to run the tests. To install this gem onto your local machine, run `bundle exec rake install`.
4
-
5
- You can use [Guard][] to automatically run the tests every time a file in the `lib` or `spec` folder changes.
6
-
7
- Run Guard through Bundler with:
8
-
9
- ```shell
10
- bundle exec guard
11
- ```
12
-
13
- [Guard]: https://github.com/guard/guard
14
-
15
- ## Dependencies
16
-
17
- Although this gem supports Ruby 2.0.0, in order to use the latest development dependencies you have to use at least Ruby 2.2.2.
18
-
19
- ## Requirements
20
-
21
- ### Code coverage
22
-
23
- The 100% code coverage requirement must be met before submitting new code.
24
- This can be checked by opening the generated [SimpleCov][] files:
25
-
26
- ```shell
27
- open coverage/index.html
28
- ```
29
-
30
- ### Style guide
31
-
32
- The Ruby style guide is configured in the [rubocop.yml](rubocop.yml) file and can be checked by running:
33
-
34
- ```shell
35
- bundle exec rake rubocop
36
- ```
37
-
38
- ### Documentation
39
-
40
- The documentation uses the [Yard][] format. Please ensure all new classes and methods are fully documented.
41
-
42
- There are a few Rake tasks to handle documentation:
43
-
44
- ```shell
45
- bundle exec rake measurement
46
- ```
47
-
48
- Verifies the documentation with [Yardstick][] and generates the `measurement/report.txt` file, containing tips on how to improve the documentation coverage.
49
-
50
- ```shell
51
- bundle exec rake yard
52
- ```
53
-
54
- Generates [YARD][] documentation in the `./yardoc` folder.
55
-
56
- ### Git
57
-
58
- Commit messages should ideally start with one of the following verbs:
59
-
60
- * Add
61
- * Merge
62
- * Fix
63
- * Remove
64
- * Improve
65
- * Use
66
-
67
- [SimpleCov]: https://github.com/colszowka/simplecov
68
- [Yard]: http://yardoc.org/
69
- [Yardstick]: https://github.com/dkubb/yardstick
70
-
71
- ## Publishing a new release
72
-
73
- * Create a new release on [GitHub](https://github.com/getyoti/yoti-ruby-sdk/releases)
74
- * Build the gem and push it to [RubyGems](https://rubygems.org/gems/yoti)
75
-
76
- ```shell
77
- rake build
78
- gem push pkg/yoti-[version].gem
79
- ```
80
-
81
- ## Submitting a pull request
82
-
83
- 1. [Fork the repository.][fork]
84
- 2. [Create a topic branch.][branch]
85
- 3. Add specs for your unimplemented feature or bug fix.
86
- 4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
87
- 5. Implement your feature or bug fix.
88
- 6. Run `bundle exec rake`. If your specs fail, return to step 5.
89
- 7. Run `open coverage/index.html`. If your changes are not completely covered
90
- by your tests, return to step 3.
91
- 8. If Rubocop warns you about styling errors, correct them based on the guidelines and run `bundle exec rake rubocop` to make sure all offences are gone.
92
- 9. Add documentation for your feature or bug fix.
93
- 10. Commit and push your changes.
94
- 11. [Submit a pull request.][pr]
95
-
96
- [fork]: http://help.github.com/fork-a-repo/
97
- [branch]: http://learn.github.com/p/branching.html
98
- [pr]: http://help.github.com/send-pull-requests/
data/Guardfile DELETED
@@ -1,11 +0,0 @@
1
- guard :rspec, cmd: 'bundle exec rspec -c -f doc' do
2
- # watch /lib/ files
3
- watch(%r{^lib/(.+).rb$}) do |m|
4
- "spec/#{m[1]}_spec.rb"
5
- end
6
-
7
- # watch /spec/ files
8
- watch(%r{^spec/(.+).rb$}) do |m|
9
- "spec/#{m[1]}.rb"
10
- end
11
- end
data/Rakefile DELETED
@@ -1,50 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
- require 'yaml'
4
-
5
- ################################
6
- # Tests #
7
- ################################
8
-
9
- RSpec::Core::RakeTask.new(:test_yoti) do |t|
10
- t.pattern = ['spec/yoti']
11
- end
12
-
13
- RSpec::Core::RakeTask.new(:test_generators) do |t|
14
- t.pattern = ['spec/generators']
15
- end
16
-
17
- RSpec::Core::RakeTask.new(:spec)
18
-
19
- ################################
20
- # Rubocop #
21
- ################################
22
-
23
- require 'rubocop/rake_task'
24
- RuboCop::RakeTask.new(:rubocop) do |t|
25
- t.options = ['--config', 'rubocop.yml']
26
- end
27
-
28
- ################################
29
- # Documentation #
30
- ################################
31
-
32
- require 'yard'
33
- YARD::Rake::YardocTask.new do |t|
34
- t.options = ['--output-dir', './yardoc']
35
- t.stats_options = ['--list-undoc']
36
- end
37
-
38
- yardstick_options = YAML.load_file('yardstick.yml')
39
-
40
- require 'yardstick/rake/measurement'
41
- Yardstick::Rake::Measurement.new(:measurement, yardstick_options) do |measurement|
42
- measurement.output = 'measurement/report.txt'
43
- end
44
-
45
- ################################
46
- # Defaults #
47
- ################################
48
-
49
- task default: %i[spec rubocop]
50
- task test: %i[test_yoti test_generators rubocop]
@@ -1,65 +0,0 @@
1
- AllCops:
2
- DisplayCopNames: true
3
- DisplayStyleGuide: true
4
- TargetRubyVersion: 2.4
5
- Exclude:
6
- - 'examples/rails/config/**/*'
7
- - 'examples/doc_scan/config/**/*'
8
- - 'examples/doc_scan/bin/**/*'
9
- - 'lib/yoti/protobuf/attrpubapi/*'
10
- - 'lib/yoti/protobuf/compubapi/*'
11
- - 'lib/yoti/protobuf/sharepubapi/*'
12
-
13
- Metrics/AbcSize:
14
- Enabled: false
15
- Max: 23
16
- Exclude:
17
- - examples/rails/app/controllers/yoti_controller.rb
18
-
19
- Metrics/BlockLength:
20
- Exclude:
21
- - spec/**/**/*.rb
22
- - yoti.gemspec
23
-
24
- Metrics/CyclomaticComplexity:
25
- Max: 9
26
-
27
- Metrics/ClassLength:
28
- Enabled: false
29
- Max: 115
30
-
31
- Layout/LineLength:
32
- Enabled: false
33
-
34
- Metrics/MethodLength:
35
- Enabled: false
36
- CountComments: false
37
- Max: 19
38
- Exclude:
39
- - spec/yoti/data_type/multi_value_spec.rb
40
-
41
- Style/Documentation:
42
- Enabled: false
43
-
44
- Style/FrozenStringLiteralComment:
45
- Enabled: false
46
-
47
- Style/NumericLiterals:
48
- Enabled: false
49
-
50
- Style/MutableConstant:
51
- Enabled: false
52
-
53
- Naming/MethodName:
54
- Exclude:
55
- - lib/yoti/util/anchor_processor.rb
56
-
57
- Naming/PredicateName:
58
- Exclude:
59
- - lib/yoti/util/age_processor.rb
60
-
61
- Metrics/ParameterLists:
62
- Exclude:
63
- - lib/yoti/doc_scan/session/create/sdk_config.rb
64
- - lib/yoti/doc_scan/session/create/session_specification.rb
65
- - spec/yoti/doc_scan/client_spec.rb
@@ -1,9 +0,0 @@
1
- rules:
2
- ApiTag::Presence:
3
- enabled: false
4
- ApiTag::Inclusion:
5
- enabled: false
6
- ApiTag::PrivateMethod:
7
- enabled: false
8
- ExampleTag:
9
- enabled: false