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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9614cb861ac00a8133527a647e8d6c6dcc91b00aca6c7fe643e32ddc986b3f7d
4
- data.tar.gz: f1ac7dcb3413c1f08ac16c909e0f466091519dae0412519a1161cd0179143040
3
+ metadata.gz: 0e90f488e56f0f23468d8ce70a6190d7f343b6f626f3383e5909b0f2bede5e89
4
+ data.tar.gz: 2b53062431bd66ac011e1fde789c16fe501b565297b33324101153aa550da364
5
5
  SHA512:
6
- metadata.gz: db1d5e0344e58bb11728af749ef1b37f051add89fdda7797347d0771d091b3221482d90beed6f566d082d4120c9c2d45d63e0dea828202ff9c087d58c498094e
7
- data.tar.gz: f524bd93102a7ac6621314a950b5fba0b06a62437f1ad4328e26c092192ffa74ccc9ce5919d1806e126a5d2d9305b9ad204e913da13cf02f1c31079d5775dc70
6
+ metadata.gz: 89338028a53553ddf63d7b004437b9305e6fc301578e7646888b6bf89557be2bbd5def9fce62cce7bbbc094c5e7bdc255a2ef9bf25f5a9732a06a7aa95ac3f44
7
+ data.tar.gz: efb84f0d05c9ce9df6b47126389cdc8dfa4245909b14fc396537b350e71b41c2e134a38462968432fffc85cff9c9a5347799d1eca07fb7c49253c5006deed9b1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smile-identity-core (1.2.0)
4
+ smile-identity-core (1.2.1)
5
5
  rubyzip (~> 1.2, >= 1.2.3)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -81,17 +81,9 @@ module SmileIdentityCore
81
81
  )
82
82
 
83
83
  request.on_complete do |response|
84
- if response.success?
85
- return response.body
86
- elsif response.timed_out?
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
- @timestamp = Time.now.to_s
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
@@ -1,8 +1,3 @@
1
1
  module SmileIdentityCore
2
- VERSION = "1.2.0"
3
-
4
- def self.version_as_hash
5
- major, minor, patch = *VERSION.split('.')
6
- { majorVersion: major, minorVersion: minor, buildNumber: patch }
7
- end
2
+ VERSION = "1.2.1"
8
3
  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": SmileIdentityCore.version_as_hash,
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.0
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-10-13 00:00:00.000000000 Z
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.0.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.