trustid_sdk 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 301c57a0d10d984e3596a83163bac369d92daee4cc785a90553c0f6d958f3be7
4
- data.tar.gz: 87e4f7fa237313d37ecc7b640239bebfe9353355e4e3f7e5cd338364637baf07
3
+ metadata.gz: 859be1d591ba0d789cde0a331e0f91d0aa31482cf65b6533485177b831ce57fd
4
+ data.tar.gz: '0987f36c03253670c9d1e71c2197a4cdae34db043888a7d40fe365e849996483'
5
5
  SHA512:
6
- metadata.gz: '09df2387ca97b8753e74c36fe72fddd3cb929bd1e02114e89151cb278e68471157e03d506d72c7ec4b23329c9446f2045f84117067ee5c7f81f6c6de7b22de4b'
7
- data.tar.gz: c493a5aea56b14f9d85dfd30b6f11e8026bc82f976e524824977263e42da19fc738e224fb1dd92ee352b9ba825f95a7fa9e2245ded1e003041a2895c2982285e
6
+ metadata.gz: 63681452a6f1c9aef4a3931b090527cba3445f016d901ef6e4985d1def9c69cadbc274e2601c656b4b5feeaff04ea3c609949cd0459238ca023704b4ca512938
7
+ data.tar.gz: 53306ffe7ae8eb2214c370689754e476e01972e0b4a9c8c827b2092e9c75ffb97b016e553c8025caa8c1c89e2951d8433693e7c4426f56eee00b82b974fc94f1
data/README.md CHANGED
@@ -35,9 +35,9 @@ end
35
35
 
36
36
  ### Device ID
37
37
 
38
- `device_id` can be a string or a proc (or any object that responds to `call`). When it is a proc, it is invoked each time the SDK needs the device ID (e.g. for requests and reports), and the returned value is used.
38
+ `device_id` can be a string or a proc (or any object that responds to `call`). When it is a proc, it is invoked **once when the client is created** (at login), and that value is used for the lifetime of the client. The device ID is then static for all requests made with that client.
39
39
 
40
- This is particularly useful for **parallel usage**: if you run multiple clients or workers, each needs a distinct device ID and session. If you reuse the same device ID, the next login for that device invalidates the previous session. Setting `device_id` to a proc that returns a new value per client (e.g. `-> { "prefix-#{SecureRandom.uuid}" }`) ensures each logical “device” gets a unique ID and its own session.
40
+ This is particularly useful for **parallel usage**: if you run multiple clients or workers, each needs a distinct device ID and session. If you reuse the same device ID, the next login for that device invalidates the previous session. Setting `device_id` to a proc that returns a new value per client (e.g. `-> { "prefix-#{SecureRandom.uuid}" }`) ensures each client gets a unique ID and its own session, while keeping the same device ID for every request within that process.
41
41
 
42
42
  ```ruby
43
43
  require 'securerandom'
@@ -2,20 +2,16 @@
2
2
 
3
3
  module TrustID
4
4
  class Client
5
- attr_reader :server_url
5
+ attr_reader :device_id, :server_url
6
6
  attr_accessor :session_id
7
7
 
8
8
  def initialize
9
9
  config = TrustID.config
10
- @device_id = config.device_id
10
+ raw = config.device_id
11
+ @device_id = raw.respond_to?(:call) ? raw.call : raw
11
12
  @server_url = config.server_url
12
13
  TrustID.client = self
13
14
  Services::Authentication.new(config.username, config.password).login
14
15
  end
15
-
16
- def device_id
17
- value = @device_id
18
- value.respond_to?(:call) ? value.call : value
19
- end
20
16
  end
21
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TrustID
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trustid_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomislav Simnett