smile-identity-core 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/smile-identity-core/version.rb +1 -1
- data/lib/smile-identity-core/web_api.rb +27 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 433c708dc96d30936d66a28a8722bb0947390d154c0d2ace346ce8381b237fe6
|
4
|
+
data.tar.gz: 84f5459883048c3ee08eb9ee38d6e890d910e4d3a133b39d35eb932603140d70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: badf204f3108464b9e9eaef9884b38f446a7bb26a7f6b72e39e90b6a7a64c474bcc14f22f637cbdeecb6533c487a340ccdfe6d18558b90c10857c8cdbe90c112
|
7
|
+
data.tar.gz: dc5e0266ec8007cd88b41d35164cbb3fa71fc299207779817678f8a75663ecd455ea536a6ee13a0d94cfdfc67ca93f3eaae2feed223dd4059bedcf025d8abb92
|
data/CHANGELOG.md
CHANGED
@@ -4,3 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
## [0.1.0] - 2019-07-19
|
5
5
|
### Added
|
6
6
|
The first release version of Web Api.
|
7
|
+
|
8
|
+
## [0.1.1] - 2019-07-23
|
9
|
+
### Updated
|
10
|
+
Some package configurations were added.
|
11
|
+
|
12
|
+
## [0.2.0] - 2019-08-14
|
13
|
+
### Added
|
14
|
+
Removed two parameters: optional_callback and return_job_status in the submit_job function in favour of an options hash.
|
15
|
+
Introduced return_history and image_links
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ The official Smile Identity gem exposes two classes namely, the Web API and Auth
|
|
4
4
|
|
5
5
|
The Web API allows you as the Partner to validate a user’s identity against the relevant Identity Authorities/Third Party databases that Smile Identity has access to using ID information provided by your customer/user (including photo for compare).
|
6
6
|
|
7
|
-
The
|
7
|
+
The Signature class allows you as the Partner to generate a sec key to interact with our servers.
|
8
8
|
|
9
9
|
## Documentation
|
10
10
|
|
@@ -27,16 +27,16 @@ module SmileIdentityCore
|
|
27
27
|
|
28
28
|
end
|
29
29
|
|
30
|
-
def submit_job(partner_params, images, id_info,
|
30
|
+
def submit_job(partner_params, images, id_info, options)
|
31
31
|
self.partner_params = partner_params
|
32
32
|
self.images = images
|
33
33
|
@timestamp = Time.now.to_i
|
34
34
|
|
35
35
|
self.id_info = id_info
|
36
|
-
self.
|
36
|
+
self.options = options
|
37
37
|
|
38
|
-
if
|
39
|
-
@callback_url = optional_callback
|
38
|
+
if options[:optional_callback] && options[:optional_callback].length > 0
|
39
|
+
@callback_url = options[:optional_callback]
|
40
40
|
end
|
41
41
|
|
42
42
|
if partner_params[:job_type].to_i == 1
|
@@ -95,22 +95,21 @@ module SmileIdentityCore
|
|
95
95
|
@id_info = id_info
|
96
96
|
end
|
97
97
|
|
98
|
-
def
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
raise ArgumentError.new('return_job_status needs to be a boolean')
|
98
|
+
def options=(options)
|
99
|
+
updated_options = {}
|
100
|
+
[:optional_callback, :return_job_status, :return_image_links, :return_history].map do |key|
|
101
|
+
if key != :optional_callback
|
102
|
+
updated_options[key] = check_boolean(key, options[key])
|
103
|
+
end
|
105
104
|
end
|
106
105
|
|
107
|
-
@
|
106
|
+
@options = updated_options
|
108
107
|
end
|
109
108
|
|
110
109
|
private
|
111
110
|
|
112
111
|
def validate_return_data
|
113
|
-
if @callback_url.empty? && !@return_job_status
|
112
|
+
if (!@callback_url || @callback_url.empty?) && !@options[:return_job_status]
|
114
113
|
raise ArgumentError.new("Please choose to either get your response via the callback or job status query")
|
115
114
|
end
|
116
115
|
end
|
@@ -121,6 +120,18 @@ module SmileIdentityCore
|
|
121
120
|
end
|
122
121
|
end
|
123
122
|
|
123
|
+
def check_boolean(key, bool)
|
124
|
+
if (!bool)
|
125
|
+
bool = false;
|
126
|
+
end
|
127
|
+
|
128
|
+
if !!bool != bool
|
129
|
+
raise ArgumentError.new("#{key} needs to be a boolean")
|
130
|
+
end
|
131
|
+
|
132
|
+
return bool
|
133
|
+
end
|
134
|
+
|
124
135
|
def determine_sec_key
|
125
136
|
hash_signature = Digest::SHA256.hexdigest([@partner_id.to_i, @timestamp].join(":"))
|
126
137
|
public_key = OpenSSL::PKey::RSA.new(Base64.decode64(@api_key))
|
@@ -264,7 +275,7 @@ module SmileIdentityCore
|
|
264
275
|
|
265
276
|
request.on_complete do |response|
|
266
277
|
if response.success?
|
267
|
-
if @return_job_status
|
278
|
+
if @options[:return_job_status]
|
268
279
|
return query_job_status
|
269
280
|
else
|
270
281
|
return
|
@@ -294,7 +305,8 @@ module SmileIdentityCore
|
|
294
305
|
user_id: @partner_params[:user_id],
|
295
306
|
job_id: @partner_params[:job_id],
|
296
307
|
partner_id: @partner_id,
|
297
|
-
image_links:
|
308
|
+
image_links: @options[:return_image_links],
|
309
|
+
history: @options[:return_history]
|
298
310
|
}.to_json
|
299
311
|
|
300
312
|
url = "#{@url}/job_status"
|
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: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ridhwana
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|