selfsdk 0.0.137 → 0.0.138
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/services/auth.rb +5 -2
- data/lib/services/facts.rb +5 -2
- 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: d9cbb2bad8f28cb417c2df600279bed7de2730b4391a735574a953e15da32eb0
|
|
4
|
+
data.tar.gz: caee509d09748376b2185de51e73e4cdc78b1790a2de323f90babcf94b2df1f3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 63b33c646f77f9f07e365e2c33f840eef746b7e7f564833a4598755d36da7f698cb8a01c24158a82de8477e3861a82ce5dea588a4bf2d0ba7ff92addb101601f
|
|
7
|
+
data.tar.gz: d858ae95e76994ac51a2622f141a8b8bd47eeaebca0ed55842ae6fa4bd025debaeb557b51201fd63755da9425341c5c85737b551718b21ad61b4860199d6a40c
|
data/lib/services/auth.rb
CHANGED
|
@@ -39,13 +39,16 @@ module SelfSDK
|
|
|
39
39
|
# @return [String, String] conversation id or encoded body.
|
|
40
40
|
def request(selfid, opts = {}, &block)
|
|
41
41
|
SelfSDK.logger.info "authenticating #{selfid}"
|
|
42
|
-
|
|
42
|
+
rq = opts.fetch(:request, true)
|
|
43
|
+
if rq
|
|
44
|
+
raise "You're not permitting connections from #{selfid}" unless @messaging_service.is_permitted?(selfid)
|
|
45
|
+
end
|
|
43
46
|
|
|
44
47
|
req = SelfSDK::Messages::AuthenticationReq.new(@messaging)
|
|
45
48
|
req.populate(selfid, opts)
|
|
46
49
|
|
|
47
50
|
body = @client.jwt.prepare(req.body)
|
|
48
|
-
return body unless
|
|
51
|
+
return body unless rq
|
|
49
52
|
return req.send_message if opts.fetch(:async, false)
|
|
50
53
|
|
|
51
54
|
# when a block is given the request will always be asynchronous.
|
data/lib/services/facts.rb
CHANGED
|
@@ -41,13 +41,16 @@ module SelfSDK
|
|
|
41
41
|
# @return [Object] SelfSDK:::Messages::FactRequest
|
|
42
42
|
def request(selfid, facts, opts = {}, &block)
|
|
43
43
|
SelfSDK.logger.info "authenticating #{selfid}"
|
|
44
|
-
|
|
44
|
+
rq = opts.fetch(:request, true)
|
|
45
|
+
if rq
|
|
46
|
+
raise "You're not permitting connections from #{selfid}" unless @messaging_service.is_permitted?(selfid)
|
|
47
|
+
end
|
|
45
48
|
|
|
46
49
|
req = SelfSDK::Messages::FactRequest.new(@messaging)
|
|
47
50
|
req.populate(selfid, prepare_facts(facts), opts)
|
|
48
51
|
|
|
49
52
|
body = @client.jwt.prepare(req.body)
|
|
50
|
-
return body unless
|
|
53
|
+
return body unless rq
|
|
51
54
|
|
|
52
55
|
# when a block is given the request will always be asynchronous.
|
|
53
56
|
if block_given?
|