selfsdk 0.0.224 → 0.0.225
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/lib/messages/fact_response.rb +13 -0
- data/lib/services/chat.rb +16 -5
- data/lib/services/voice.rb +40 -24
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3984e978f7582e2bd3840787766747f29417a08835f7c0c7e8c88791ca6ec4e
|
4
|
+
data.tar.gz: 1b52143809c1551df704cc2b686577fa163aa284b9ac52ec082ccec752ef944c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20d79f18d45c07c0ba2a35faa54db04a85833f541e4276ee6513db5b295d120c4e3d286dc7c81ca409669091cca2f1abf3c989dbba80aef4aab7eace4cf711b7
|
7
|
+
data.tar.gz: f88e9169c678a9914b4d1d730269d8e78d984ec9dbbdcd8a15bbac6c7c2f02a69912ca0eea238aa4b8783c85843717b4cc37f24233f766a95111a236ee40e989
|
@@ -57,9 +57,22 @@ module SelfSDK
|
|
57
57
|
@facts.select{|f| f.name == name}.first
|
58
58
|
end
|
59
59
|
|
60
|
+
|
61
|
+
# Returns an attestation by name
|
62
|
+
#
|
63
|
+
# @param name [String] the name of the fact to retrieve the attestation for
|
64
|
+
# @return [Object, nil] the first attestation of the fact, or nil if no fact is found
|
65
|
+
def attestation(name)
|
66
|
+
f = fact(name)
|
67
|
+
return nil if f.nil?
|
68
|
+
|
69
|
+
f.attestations.first
|
70
|
+
end
|
71
|
+
|
60
72
|
def attestations_for(name)
|
61
73
|
f = fact(name)
|
62
74
|
return [] if f.nil?
|
75
|
+
|
63
76
|
f.attestations
|
64
77
|
end
|
65
78
|
|
data/lib/services/chat.rb
CHANGED
@@ -52,7 +52,7 @@ module SelfSDK
|
|
52
52
|
cm.mark_as_delivered unless opts[:mark_as_delivered] == false
|
53
53
|
cm.mark_as_read if opts[:mark_as_read] == true
|
54
54
|
|
55
|
-
|
55
|
+
call(block, cm)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -104,19 +104,19 @@ module SelfSDK
|
|
104
104
|
def on_invite(&block)
|
105
105
|
@messaging.subscribe :chat_invite do |msg|
|
106
106
|
g = SelfSDK::Chat::Group.new(self, msg.payload)
|
107
|
-
|
107
|
+
call(block, g)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
def on_join(&block)
|
112
112
|
@messaging.subscribe :chat_join do |msg|
|
113
|
-
|
113
|
+
call(block, {iss: msg.payload[:iss], gid: msg.payload[:gid]})
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
117
|
def on_leave(&block)
|
118
118
|
@messaging.subscribe :chat_remove do |msg|
|
119
|
-
|
119
|
+
call(block, {iss: msg.payload[:iss], gid: msg.payload[:gid]})
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -194,7 +194,7 @@ module SelfSDK
|
|
194
194
|
# @yield [request] Invokes the block with a connection response message.
|
195
195
|
def on_connection(&block)
|
196
196
|
@messaging.subscribe :connection_response do |msg|
|
197
|
-
|
197
|
+
call(block, msg)
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
@@ -243,6 +243,17 @@ module SelfSDK
|
|
243
243
|
posterior_members = true if m == @app_id
|
244
244
|
end
|
245
245
|
end
|
246
|
+
|
247
|
+
def call(block, *args)
|
248
|
+
block.call(*args)
|
249
|
+
rescue StandardError => e
|
250
|
+
SelfSDK.logger.error("A StandardError occurred: #{e.message}")
|
251
|
+
SelfSDK.logger.error("Backtrace:\n\t#{e.backtrace.join("\n\t")}")
|
252
|
+
rescue Exception => e
|
253
|
+
SelfSDK.logger.error("An unexpected exception occurred: #{e.message}")
|
254
|
+
SelfSDK.logger.error("Backtrace:\n\t#{e.backtrace.join("\n\t")}")
|
255
|
+
end
|
256
|
+
|
246
257
|
end
|
247
258
|
end
|
248
259
|
end
|
data/lib/services/voice.rb
CHANGED
@@ -29,7 +29,7 @@ module SelfSDK
|
|
29
29
|
# Subscribes to chat.voice.setup messages.
|
30
30
|
def on_setup(&block)
|
31
31
|
@messaging.subscribe :voice_setup do |msg|
|
32
|
-
|
32
|
+
call(block, msg.payload[:iss], msg.payload[:cid], msg.payload[:data])
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -46,17 +46,18 @@ module SelfSDK
|
|
46
46
|
# Subscribes to chat.voice.start messages.
|
47
47
|
def on_start(&block)
|
48
48
|
@messaging.subscribe :voice_start do |msg|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
call(block,
|
50
|
+
msg.payload[:iss],
|
51
|
+
cid: msg.payload[:cid],
|
52
|
+
call_id: msg.payload[:call_id],
|
53
|
+
peer_info: msg.payload[:peer_info],
|
54
|
+
data: msg.payload[:data])
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
57
58
|
# Sends a chat.voice.accept message accepting a specific call.
|
58
59
|
def accept(recipient, cid, call_id, peer_info)
|
59
|
-
payload = {
|
60
|
+
payload = {
|
60
61
|
typ: SelfSDK::Messages::VoiceAccept::MSG_TYPE,
|
61
62
|
cid: cid,
|
62
63
|
call_id: call_id,
|
@@ -68,16 +69,17 @@ module SelfSDK
|
|
68
69
|
# Subscribes to chat.voice.accept messages.
|
69
70
|
def on_accept(&block)
|
70
71
|
@messaging.subscribe :voice_accept do |msg|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
call(block,
|
73
|
+
msg.payload[:iss],
|
74
|
+
cid: msg.payload[:cid],
|
75
|
+
call_id: msg.payload[:call_id],
|
76
|
+
peer_info: msg.payload[:peer_info])
|
75
77
|
end
|
76
78
|
end
|
77
79
|
|
78
80
|
# Sends a chat.voice.accept message finishing the call.
|
79
81
|
def stop(recipient, cid, call_id)
|
80
|
-
payload = {
|
82
|
+
payload = {
|
81
83
|
typ: SelfSDK::Messages::VoiceStop::MSG_TYPE,
|
82
84
|
cid: cid,
|
83
85
|
call_id: call_id,
|
@@ -88,10 +90,11 @@ module SelfSDK
|
|
88
90
|
# Subscribes to chat.voice.stop messages.
|
89
91
|
def on_stop(&block)
|
90
92
|
@messaging.subscribe :voice_stop do |msg|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
93
|
+
call(block,
|
94
|
+
msg.payload[:iss],
|
95
|
+
cid: msg.payload[:cid],
|
96
|
+
call_id: msg.payload[:call_id],
|
97
|
+
peer_info: msg.payload[:peer_info])
|
95
98
|
end
|
96
99
|
end
|
97
100
|
|
@@ -106,10 +109,11 @@ module SelfSDK
|
|
106
109
|
# Subscribes to chat.voice.busy messages.
|
107
110
|
def on_busy(&block)
|
108
111
|
@messaging.subscribe :voice_busy do |msg|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
112
|
+
call(block,
|
113
|
+
msg.payload[:iss],
|
114
|
+
cid: msg.payload[:cid],
|
115
|
+
call_id: msg.payload[:call_id],
|
116
|
+
peer_info: msg.payload[:peer_info])
|
113
117
|
end
|
114
118
|
end
|
115
119
|
|
@@ -124,10 +128,11 @@ module SelfSDK
|
|
124
128
|
# Subscribes to chat.voice.summary messages.
|
125
129
|
def on_summary(&block)
|
126
130
|
@messaging.subscribe :voice_summary do |msg|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
+
call(block,
|
132
|
+
msg.payload[:iss],
|
133
|
+
cid: msg.payload[:cid],
|
134
|
+
call_id: msg.payload[:call_id],
|
135
|
+
peer_info: msg.payload[:peer_info])
|
131
136
|
end
|
132
137
|
end
|
133
138
|
|
@@ -142,6 +147,17 @@ module SelfSDK
|
|
142
147
|
end
|
143
148
|
m
|
144
149
|
end
|
150
|
+
|
151
|
+
def call(block, *args)
|
152
|
+
block.call(*args)
|
153
|
+
rescue StandardError => e
|
154
|
+
SelfSDK.logger.error("A StandardError occurred: #{e.message}")
|
155
|
+
SelfSDK.logger.error("Backtrace:\n\t#{e.backtrace.join("\n\t")}")
|
156
|
+
rescue Exception => e
|
157
|
+
SelfSDK.logger.error("An unexpected exception occurred: #{e.message}")
|
158
|
+
SelfSDK.logger.error("Backtrace:\n\t#{e.backtrace.join("\n\t")}")
|
159
|
+
end
|
160
|
+
|
145
161
|
end
|
146
162
|
end
|
147
163
|
end
|