smile-identity-core 2.2.0 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +8 -10
- data/.rubocop.yml +40 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +9 -8
- data/lib/smile-identity-core/aml_check.rb +2 -6
- data/lib/smile-identity-core/business_verification.rb +2 -6
- data/lib/smile-identity-core/constants/env.rb +12 -0
- data/lib/smile-identity-core/id_api.rb +2 -7
- data/lib/smile-identity-core/utilities.rb +2 -7
- data/lib/smile-identity-core/version.rb +1 -1
- data/lib/smile-identity-core/web_api.rb +22 -19
- data/smile-identity-core.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab854f61f188586b70f98ef4a0766575e308343bae0fc5e73b2c748c876ce83e
|
4
|
+
data.tar.gz: e8c2f3ac08e780dff638e8754aab74567ddccc84ac97d68e95d2fb5fa596c97e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f98bb6732acb0ac767590b6c15beb41c32cf411dc95b9d18a3a4af1cc92a672717442398d049efffbfd000f84c83ab9e71d2403342cda79cf4f504a5900fdd4
|
7
|
+
data.tar.gz: 102f5e6e96c23e3407600591697eaf0f0bc26cf55bd37061eff5555544a07452927988f9001227a60874a2ec3107b9b47a38c75591cd5698852df2b9f1ed9d4d
|
data/.github/workflows/test.yml
CHANGED
@@ -14,23 +14,21 @@ jobs:
|
|
14
14
|
matrix:
|
15
15
|
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
16
16
|
# See https://www.ruby-lang.org/en/downloads/ for latest stable releases.
|
17
|
-
ruby: ['2.6', '2.7', '3.0', '3.1']
|
17
|
+
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2']
|
18
18
|
steps:
|
19
|
-
- uses: actions/checkout@
|
19
|
+
- uses: actions/checkout@v4
|
20
20
|
- uses: ruby/setup-ruby@v1
|
21
21
|
with:
|
22
22
|
ruby-version: ${{ matrix.ruby }}
|
23
|
-
bundler-cache: true
|
23
|
+
bundler-cache: true
|
24
24
|
- run: bundle exec rake
|
25
25
|
lint:
|
26
26
|
runs-on: ubuntu-latest
|
27
27
|
steps:
|
28
|
-
- uses: actions/checkout@
|
29
|
-
-
|
30
|
-
uses: ruby/setup-ruby@v1
|
28
|
+
- uses: actions/checkout@v4
|
29
|
+
- uses: ruby/setup-ruby@v1
|
31
30
|
with:
|
32
|
-
ruby-version: 3.
|
33
|
-
bundler-cache: true
|
34
|
-
# NOTE: || true should be removed as soon as all offenses are fixed.
|
31
|
+
ruby-version: 3.2
|
32
|
+
bundler-cache: true
|
35
33
|
- name: Run RuboCop
|
36
|
-
run: bundle exec rubocop --parallel
|
34
|
+
run: bundle exec rubocop --parallel
|
data/.rubocop.yml
CHANGED
@@ -3,4 +3,43 @@ require:
|
|
3
3
|
- rubocop-rspec
|
4
4
|
|
5
5
|
AllCops:
|
6
|
-
TargetRubyVersion: 2.5
|
6
|
+
TargetRubyVersion: 2.5
|
7
|
+
|
8
|
+
Metrics/AbcSize:
|
9
|
+
Max: 30
|
10
|
+
|
11
|
+
Metrics/ClassLength:
|
12
|
+
Max: 500
|
13
|
+
|
14
|
+
Metrics/CyclomaticComplexity:
|
15
|
+
Max: 15
|
16
|
+
|
17
|
+
Metrics/MethodLength:
|
18
|
+
Max: 50
|
19
|
+
|
20
|
+
Metrics/PerceivedComplexity:
|
21
|
+
Max: 15
|
22
|
+
|
23
|
+
Naming/FileName:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
RSpec/ExampleLength:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
RSpec/FilePath:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
RSpec/InstanceVariable:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
RSpec/MultipleExpectations:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
RSpec/MultipleMemoizedHelpers:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
RSpec/NestedGroups:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
RSpec/RepeatedExampleGroupDescription:
|
45
|
+
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.2
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [2.2.2] - 2023-10-05
|
10
|
+
### Changed
|
11
|
+
- Lint project. Enforce rubocop rules via github action
|
12
|
+
|
13
|
+
## Added
|
14
|
+
Support Ruby 3.2
|
15
|
+
|
16
|
+
## [2.2.1] - 2023-08-31
|
17
|
+
### Changed
|
18
|
+
- Don't validate the presence of `id_type` and `id_number` for Document Verification jobs
|
19
|
+
|
9
20
|
## [2.2.0] - 2023-04-05
|
10
21
|
### Added
|
11
22
|
- Adds support for AML check
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smile-identity-core (2.2.
|
4
|
+
smile-identity-core (2.2.2)
|
5
5
|
rubyzip (~> 1.2, >= 1.2.3)
|
6
6
|
typhoeus (~> 1.0, >= 1.0.1)
|
7
7
|
|
@@ -10,7 +10,7 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
12
|
diff-lcs (1.3)
|
13
|
-
docile (1.
|
13
|
+
docile (1.4.0)
|
14
14
|
ethon (0.16.0)
|
15
15
|
ffi (>= 1.15.0)
|
16
16
|
ffi (1.15.5)
|
@@ -53,11 +53,12 @@ GEM
|
|
53
53
|
rubocop (~> 1.33)
|
54
54
|
ruby-progressbar (1.11.0)
|
55
55
|
rubyzip (1.3.0)
|
56
|
-
simplecov (0.
|
57
|
-
docile (~> 1.1
|
58
|
-
|
59
|
-
|
60
|
-
simplecov-html (0.
|
56
|
+
simplecov (0.22.0)
|
57
|
+
docile (~> 1.1)
|
58
|
+
simplecov-html (~> 0.11)
|
59
|
+
simplecov_json_formatter (~> 0.1)
|
60
|
+
simplecov-html (0.12.3)
|
61
|
+
simplecov_json_formatter (0.1.4)
|
61
62
|
typhoeus (1.4.0)
|
62
63
|
ethon (>= 0.9.0)
|
63
64
|
unicode-display_width (2.3.0)
|
@@ -72,7 +73,7 @@ DEPENDENCIES
|
|
72
73
|
rubocop (~> 1.37.1)
|
73
74
|
rubocop-rake (~> 0.6.0)
|
74
75
|
rubocop-rspec (~> 2.14.1)
|
75
|
-
simplecov (~> 0.
|
76
|
+
simplecov (~> 0.18)
|
76
77
|
smile-identity-core!
|
77
78
|
|
78
79
|
BUNDLED WITH
|
@@ -18,14 +18,10 @@ module SmileIdentityCore
|
|
18
18
|
# @param [String] :api_key your API key from the Smile Identity portal
|
19
19
|
# @param [String] :sid_server Use 0 for the sandbox server, use 1 for production server
|
20
20
|
def initialize(partner_id, api_key, sid_server)
|
21
|
-
@partner_id = partner_id.to_s
|
22
21
|
@api_key = api_key
|
22
|
+
@partner_id = partner_id.to_s
|
23
23
|
@sid_server = sid_server
|
24
|
-
@url =
|
25
|
-
SmileIdentityCore::ENV::SID_SERVER_MAPPING[sid_server.to_s]
|
26
|
-
else
|
27
|
-
sid_server
|
28
|
-
end
|
24
|
+
@url = SmileIdentityCore::ENV.determine_url(sid_server)
|
29
25
|
end
|
30
26
|
|
31
27
|
# Submit AML
|
@@ -24,14 +24,10 @@ module SmileIdentityCore
|
|
24
24
|
# @param [String] :api_key your API key from the Smile Identity portal
|
25
25
|
# @param [String] :sid_server Use 0 for the sandbox server, use 1 for production server
|
26
26
|
def initialize(partner_id, api_key, sid_server)
|
27
|
-
@partner_id = partner_id.to_s
|
28
27
|
@api_key = api_key
|
28
|
+
@partner_id = partner_id.to_s
|
29
29
|
@sid_server = sid_server
|
30
|
-
@url =
|
31
|
-
SmileIdentityCore::ENV::SID_SERVER_MAPPING[sid_server.to_s]
|
32
|
-
else
|
33
|
-
sid_server
|
34
|
-
end
|
30
|
+
@url = SmileIdentityCore::ENV.determine_url(sid_server)
|
35
31
|
end
|
36
32
|
|
37
33
|
# Submit business verification
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module SmileIdentityCore
|
4
|
+
# The ENV module contains constants and utility methods for mapping
|
5
|
+
# managing aliases to Smile Identity servers.
|
4
6
|
module ENV
|
5
7
|
SID_SERVER_MAPPING = {
|
6
8
|
'0' => 'https://testapi.smileidentity.com/v1',
|
@@ -9,5 +11,15 @@ module SmileIdentityCore
|
|
9
11
|
|
10
12
|
TEST = '0'
|
11
13
|
LIVE = '1'
|
14
|
+
|
15
|
+
module_function
|
16
|
+
|
17
|
+
def determine_url(sid_server)
|
18
|
+
if sid_server.to_s !~ URI::DEFAULT_PARSER.make_regexp
|
19
|
+
SID_SERVER_MAPPING[sid_server.to_s] || sid_server
|
20
|
+
else
|
21
|
+
sid_server
|
22
|
+
end
|
23
|
+
end
|
12
24
|
end
|
13
25
|
end
|
@@ -10,14 +10,9 @@ module SmileIdentityCore
|
|
10
10
|
REQUIRED_ID_INFO_FIELD = %i[country id_type id_number].freeze
|
11
11
|
|
12
12
|
def initialize(partner_id, api_key, sid_server)
|
13
|
-
@partner_id = partner_id.to_s
|
14
13
|
@api_key = api_key
|
15
|
-
|
16
|
-
@url =
|
17
|
-
SmileIdentityCore::ENV::SID_SERVER_MAPPING[sid_server.to_s]
|
18
|
-
else
|
19
|
-
sid_server
|
20
|
-
end
|
14
|
+
@partner_id = partner_id.to_s
|
15
|
+
@url = SmileIdentityCore::ENV.determine_url(sid_server)
|
21
16
|
end
|
22
17
|
|
23
18
|
def submit_job(partner_params, id_info, options = {})
|
@@ -4,14 +4,9 @@ module SmileIdentityCore
|
|
4
4
|
# A utility class to query job status
|
5
5
|
class Utilities
|
6
6
|
def initialize(partner_id, api_key, sid_server)
|
7
|
-
@partner_id = partner_id.to_s
|
8
7
|
@api_key = api_key
|
9
|
-
|
10
|
-
@url =
|
11
|
-
SmileIdentityCore::ENV::SID_SERVER_MAPPING[sid_server.to_s]
|
12
|
-
else
|
13
|
-
sid_server
|
14
|
-
end
|
8
|
+
@partner_id = partner_id.to_s
|
9
|
+
@url = SmileIdentityCore::ENV.determine_url(sid_server)
|
15
10
|
|
16
11
|
@signature_connection = SmileIdentityCore::Signature.new(@partner_id, @api_key)
|
17
12
|
end
|
@@ -12,15 +12,11 @@ module SmileIdentityCore
|
|
12
12
|
# Allows Identity verifications of ids with images
|
13
13
|
class WebApi
|
14
14
|
def initialize(partner_id, default_callback, api_key, sid_server)
|
15
|
-
@partner_id = partner_id.to_s
|
16
|
-
@callback_url = default_callback
|
17
15
|
@api_key = api_key
|
16
|
+
@callback_url = default_callback
|
17
|
+
@partner_id = partner_id.to_s
|
18
18
|
@sid_server = sid_server
|
19
|
-
@url =
|
20
|
-
SmileIdentityCore::ENV::SID_SERVER_MAPPING[sid_server.to_s]
|
21
|
-
else
|
22
|
-
sid_server
|
23
|
-
end
|
19
|
+
@url = SmileIdentityCore::ENV.determine_url(sid_server)
|
24
20
|
end
|
25
21
|
|
26
22
|
def submit_job(partner_params, images, id_info, options)
|
@@ -75,7 +71,7 @@ module SmileIdentityCore
|
|
75
71
|
raise ArgumentError, 'Image details needs to be an array' unless images.is_a?(Array)
|
76
72
|
|
77
73
|
# all job types require atleast a selfie
|
78
|
-
if images.
|
74
|
+
if images.empty? || images.none? { |h| (h[:image_type_id]).zero? || h[:image_type_id] == 2 }
|
79
75
|
raise ArgumentError, 'You need to send through at least one selfie image'
|
80
76
|
end
|
81
77
|
|
@@ -91,8 +87,15 @@ module SmileIdentityCore
|
|
91
87
|
# if it's a boolean
|
92
88
|
updated_id_info[:entered] = id_info[:entered].to_s if !updated_id_info[:entered].nil? == updated_id_info[:entered]
|
93
89
|
|
94
|
-
|
95
|
-
|
90
|
+
is_jt6 = @partner_params[:job_type].to_i == JobType::DOCUMENT_VERIFICATION
|
91
|
+
keys = if is_jt6
|
92
|
+
%i[country]
|
93
|
+
else
|
94
|
+
%i[country id_type id_number]
|
95
|
+
end
|
96
|
+
|
97
|
+
if updated_id_info[:entered] == 'true' || is_jt6
|
98
|
+
keys.each do |key|
|
96
99
|
raise ArgumentError, "Please make sure that #{key} is included in the id_info" if id_info[key].to_s.empty?
|
97
100
|
end
|
98
101
|
end
|
@@ -130,12 +133,12 @@ module SmileIdentityCore
|
|
130
133
|
|
131
134
|
def request_web_token(request_params)
|
132
135
|
request_params = request_params
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
136
|
+
.merge(SmileIdentityCore::Signature.new(@partner_id, @api_key).generate_signature(Time.now.to_s))
|
137
|
+
.merge(
|
138
|
+
{ partner_id: @partner_id,
|
139
|
+
source_sdk: SmileIdentityCore::SOURCE_SDK,
|
140
|
+
source_sdk_version: SmileIdentityCore::VERSION }
|
141
|
+
)
|
139
142
|
url = "#{@url}/token"
|
140
143
|
|
141
144
|
response = Typhoeus.post(
|
@@ -154,9 +157,9 @@ module SmileIdentityCore
|
|
154
157
|
end
|
155
158
|
|
156
159
|
def validate_return_data
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
+
return unless (!@callback_url || @callback_url.empty?) && !@options[:return_job_status]
|
161
|
+
|
162
|
+
raise ArgumentError, 'Please choose to either get your response via the callback or job status query'
|
160
163
|
end
|
161
164
|
|
162
165
|
def validate_enroll_with_id
|
data/smile-identity-core.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'rubocop', '~> 1.37.1'
|
38
38
|
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
39
39
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.14.1'
|
40
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
40
|
+
spec.add_development_dependency 'simplecov', '~> 0.18'
|
41
41
|
|
42
42
|
spec.add_dependency 'rubyzip', '~> 1.2', '>= 1.2.3'
|
43
43
|
spec.add_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smile-identity-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Smile Identity
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04
|
11
|
+
date: 2023-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: '0.18'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: '0.18'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubyzip
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,7 +201,7 @@ metadata:
|
|
201
201
|
source_code_uri: https://github.com/smileidentity/smile-identity-core-ruby
|
202
202
|
documentation_uri: https://docs.smileidentity.com
|
203
203
|
changelog_uri: https://github.com/smileidentity/smile-identity-core-ruby/blob/master/CHANGELOG.md
|
204
|
-
post_install_message:
|
204
|
+
post_install_message:
|
205
205
|
rdoc_options: []
|
206
206
|
require_paths:
|
207
207
|
- lib
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
version: '0'
|
218
218
|
requirements: []
|
219
219
|
rubygems_version: 3.4.10
|
220
|
-
signing_key:
|
220
|
+
signing_key:
|
221
221
|
specification_version: 4
|
222
222
|
summary: The Smile Identity Web API allows the user to access\ most of the features
|
223
223
|
of the Smile Identity system through direct server to server queries.
|