selfsdk 0.0.219 → 0.0.221

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: 390f0ac2c3808caf3c347697209a0cea518844c1fc716412c76377715dff18b7
4
- data.tar.gz: 8507869d086a970157451a51bafc1e3585e3f053c34c75ffcbf8752677f02c9c
3
+ metadata.gz: 69885b3b440a973bc61faf9194f9626ae4e5dda8554ccca8de0855e888c482f7
4
+ data.tar.gz: 0a2a5f115422cf4a97614a263ca77df02da9e9de16797f598930f506d1c57e65
5
5
  SHA512:
6
- metadata.gz: 3f212c0f88eeb44cfca786cb3a04e08748b63e7dba9dc56c356da598963c7f0917d37b70595925eaf31e15c35d1d7dff818caa08a789533cb6cc2a0303391141
7
- data.tar.gz: adb386b6f42bea923763019ddad12310ff7719ff13c6191f6ed06d49a19f1f8aa111c62f1a5a9eff62e06fe13f1f551d1ddfc26830cd8e66b1a61f3cde2692df
6
+ metadata.gz: d5d1128c2379969284e616c0ceced68c92e0fd864757312b9eb3b541d2cf2bf825549e2f4b46ba0da5862c2bc9e3c322ce20bb94aff9d9e438ad86fb064134af
7
+ data.tar.gz: 2cbaf8e81f5b29dc188be633f07c4662094e85c2a56dddd639111d9371bdcd9a7f60f08ae54c9857e1bd4fab0000e6f0ea108aebda7f6271cbdf4e9c1ad6922e
data/lib/messaging.rb CHANGED
@@ -13,12 +13,12 @@ require_relative 'messages/message'
13
13
  module SelfSDK
14
14
  class WebsocketClient
15
15
  ON_DEMAND_CLOSE_CODE=3999
16
- CONNECTION_SUPERCEDED=1011
17
16
 
18
17
  attr_accessor :ws
19
18
 
20
19
  def initialize(url, auto_reconnect, authentication_hook, process_message_hook)
21
20
  @url = url
21
+ @connected = false
22
22
  @reconnection_delay = nil
23
23
  @auto_reconnect = auto_reconnect
24
24
  @authentication_hook = authentication_hook
@@ -30,6 +30,7 @@ module SelfSDK
30
30
  SelfSDK.logger.debug "starting listener"
31
31
  @ws = Faye::WebSocket::Client.new(@url)
32
32
  SelfSDK.logger.debug "initialized"
33
+ @connected = true
33
34
 
34
35
  @ws.on :open do |_event|
35
36
  SelfSDK.logger.debug "websocket connection established"
@@ -37,23 +38,25 @@ module SelfSDK
37
38
  end
38
39
 
39
40
  @ws.on :message do |event|
41
+ return if !@connected
42
+
40
43
  @process_message_hook.call(event)
41
44
  end
42
45
 
43
46
  @ws.on :close do |event|
44
- SelfSDK.logger.debug "connection closed detected : #{event.code} #{event.reason}"
47
+ if @connected
48
+ if ![ON_DEMAND_CLOSE_CODE].include? event.code
49
+ raise StandardError('websocket connection closed') if !@auto_reconnect
45
50
 
46
- if not [ON_DEMAND_CLOSE_CODE, CONNECTION_SUPERCEDED].include? event.code
47
- raise StandardError('websocket connection closed') if !@auto_reconnect
51
+ if !@reconnection_delay.nil?
52
+ SelfSDK.logger.debug "waiting #{@reconnection_delay} before "
53
+ sleep @reconnection_delay
54
+ end
48
55
 
49
- if !@reconnection_delay.nil?
50
- SelfSDK.logger.debug "websocket connection closed (#{event.code}) #{event.reason}"
51
- sleep @reconnection_delay
56
+ @reconnection_delay = 3
52
57
  SelfSDK.logger.debug "reconnecting..."
58
+ start
53
59
  end
54
-
55
- @reconnection_delay = 3
56
- start
57
60
  end
58
61
  end
59
62
  end
@@ -61,6 +64,7 @@ module SelfSDK
61
64
  # Sends a closing message to the websocket client.
62
65
  def close
63
66
  SelfSDK.logger.debug "connection closed by the client"
67
+ @connected = false
64
68
  @ws.close(ON_DEMAND_CLOSE_CODE, "connection closed by the client")
65
69
  end
66
70
 
@@ -8,9 +8,10 @@ module SelfSDK
8
8
  "document_number",
9
9
  "display_name",
10
10
  "email_address",
11
- "phone_number"
11
+ "unverified_phone_number"
12
12
  ],
13
13
  "passport" => [
14
+ "photo",
14
15
  "document_number",
15
16
  "surname",
16
17
  "given_names",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selfsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.219
4
+ version: 0.0.221
5
5
  platform: ruby
6
6
  authors:
7
7
  - Self Group Ltd.
@@ -422,16 +422,16 @@ require_paths:
422
422
  - lib/services
423
423
  required_ruby_version: !ruby/object:Gem::Requirement
424
424
  requirements:
425
- - - ">="
425
+ - - "~>"
426
426
  - !ruby/object:Gem::Version
427
- version: '0'
427
+ version: '3'
428
428
  required_rubygems_version: !ruby/object:Gem::Requirement
429
429
  requirements:
430
430
  - - ">="
431
431
  - !ruby/object:Gem::Version
432
432
  version: '0'
433
433
  requirements: []
434
- rubygems_version: 3.1.6
434
+ rubygems_version: 3.3.7
435
435
  signing_key:
436
436
  specification_version: 4
437
437
  summary: joinself sdk