smile-identity-core 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/smile-identity-core/id_api.rb +26 -24
- data/lib/smile-identity-core/version.rb +1 -6
- data/lib/smile-identity-core/web_api.rb +8 -18
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e90f488e56f0f23468d8ce70a6190d7f343b6f626f3383e5909b0f2bede5e89
|
4
|
+
data.tar.gz: 2b53062431bd66ac011e1fde789c16fe501b565297b33324101153aa550da364
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89338028a53553ddf63d7b004437b9305e6fc301578e7646888b6bf89557be2bbd5def9fce62cce7bbbc094c5e7bdc255a2ef9bf25f5a9732a06a7aa95ac3f44
|
7
|
+
data.tar.gz: efb84f0d05c9ce9df6b47126389cdc8dfa4245909b14fc396537b350e71b41c2e134a38462968432fffc85cff9c9a5347799d1eca07fb7c49253c5006deed9b1
|
data/Gemfile.lock
CHANGED
@@ -81,17 +81,9 @@ module SmileIdentityCore
|
|
81
81
|
)
|
82
82
|
|
83
83
|
request.on_complete do |response|
|
84
|
-
if response.success?
|
85
|
-
|
86
|
-
|
87
|
-
raise "#{response.code.to_s}: #{response.body}"
|
88
|
-
elsif response.code == 0
|
89
|
-
# Could not get an http response, something's wrong.
|
90
|
-
raise "#{response.code.to_s}: #{response.body}"
|
91
|
-
else
|
92
|
-
# Received a non-successful http response.
|
93
|
-
raise "#{response.code.to_s}: #{response.body}"
|
94
|
-
end
|
84
|
+
return response.body if response.success?
|
85
|
+
|
86
|
+
raise "#{response.code}: #{response.body}"
|
95
87
|
end
|
96
88
|
request.run
|
97
89
|
end
|
@@ -105,20 +97,30 @@ module SmileIdentityCore
|
|
105
97
|
.to_json
|
106
98
|
end
|
107
99
|
|
100
|
+
def signature_generator
|
101
|
+
SmileIdentityCore::Signature.new(@partner_id, @api_key)
|
102
|
+
end
|
103
|
+
|
104
|
+
def signature(timestamp: Time.now.to_s)
|
105
|
+
signature = signature_generator.generate_signature(timestamp)[:signature]
|
106
|
+
{
|
107
|
+
signature: signature,
|
108
|
+
timestamp: timestamp
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
def sec_key(timestamp: Time.now.to_s)
|
113
|
+
sec_key = signature_generator.generate_sec_key(timestamp)[:sec_key]
|
114
|
+
{
|
115
|
+
sec_key: sec_key,
|
116
|
+
timestamp: timestamp
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
108
120
|
def request_security(use_new_signature: true)
|
109
|
-
if use_new_signature
|
110
|
-
|
111
|
-
|
112
|
-
signature: SmileIdentityCore::Signature.new(@partner_id, @api_key).generate_signature(@timestamp)[:signature],
|
113
|
-
timestamp: @timestamp,
|
114
|
-
}
|
115
|
-
else
|
116
|
-
@timestamp = Time.now.to_i
|
117
|
-
{
|
118
|
-
sec_key: SmileIdentityCore::Signature.new(@partner_id, @api_key).generate_sec_key(@timestamp)[:sec_key],
|
119
|
-
timestamp: @timestamp,
|
120
|
-
}
|
121
|
-
end
|
121
|
+
return signature if use_new_signature
|
122
|
+
|
123
|
+
sec_key
|
122
124
|
end
|
123
125
|
end
|
124
126
|
end
|
@@ -267,16 +267,9 @@ module SmileIdentityCore
|
|
267
267
|
|
268
268
|
file_upload_response = upload_file(prep_upload_response['upload_url'], info_json, prep_upload_response['smile_job_id'])
|
269
269
|
return file_upload_response
|
270
|
-
|
271
|
-
elsif response.timed_out?
|
272
|
-
raise "#{response.code}: #{response.body}"
|
273
|
-
elsif response.code == 0
|
274
|
-
# Could not get an http response, something's wrong.
|
275
|
-
raise "#{response.code}: #{response.body}"
|
276
|
-
else
|
277
|
-
# Received a non-successful http response.
|
278
|
-
raise "#{response.code}: #{response.body}"
|
279
270
|
end
|
271
|
+
|
272
|
+
raise "#{response.code}: #{response.body}"
|
280
273
|
end
|
281
274
|
request.run
|
282
275
|
end
|
@@ -284,7 +277,11 @@ module SmileIdentityCore
|
|
284
277
|
def configure_info_json(server_information)
|
285
278
|
info = {
|
286
279
|
"package_information": {
|
287
|
-
"apiVersion":
|
280
|
+
"apiVersion": {
|
281
|
+
"buildNumber": 0,
|
282
|
+
"majorVersion": 2,
|
283
|
+
"minorVersion": 0
|
284
|
+
},
|
288
285
|
"language": "ruby"
|
289
286
|
},
|
290
287
|
"misc_information": request_security(use_new_signature: @use_new_signature).merge(
|
@@ -375,15 +372,8 @@ module SmileIdentityCore
|
|
375
372
|
else
|
376
373
|
return {success: true, smile_job_id: smile_job_id}.to_json
|
377
374
|
end
|
378
|
-
elsif response.timed_out?
|
379
|
-
raise " #{response.code.to_s}: #{response.body}"
|
380
|
-
elsif response.code == 0
|
381
|
-
# Could not get an http response, something's wrong.
|
382
|
-
raise " #{response.code.to_s}: #{response.body}"
|
383
|
-
else
|
384
|
-
# Received a non-successful http response.
|
385
|
-
raise " #{response.code.to_s}: #{response.body}"
|
386
375
|
end
|
376
|
+
raise " #{response.code}: #{response.body}"
|
387
377
|
end
|
388
378
|
request.run
|
389
379
|
|
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: 1.2.
|
4
|
+
version: 1.2.1
|
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: 2021-
|
11
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -138,7 +138,7 @@ metadata:
|
|
138
138
|
source_code_uri: https://github.com/smileidentity/smile-identity-core-ruby
|
139
139
|
documentation_uri: https://docs.smileidentity.com
|
140
140
|
changelog_uri: https://github.com/smileidentity/smile-identity-core/blob/master/CHANGELOG.md
|
141
|
-
post_install_message:
|
141
|
+
post_install_message:
|
142
142
|
rdoc_options: []
|
143
143
|
require_paths:
|
144
144
|
- lib
|
@@ -153,8 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
157
|
-
signing_key:
|
156
|
+
rubygems_version: 3.2.3
|
157
|
+
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: The Smile Identity Web API allows the user to access most of the features
|
160
160
|
of the Smile Identity system through direct server to server queries.
|