pubcontrol 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/pubcontrol.rb +2 -0
- data/lib/pubcontrolclient.rb +16 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f090ee8b6fea8ce3141240d269550dddd1e1ad44ac852523548ac4350eea37e1
|
4
|
+
data.tar.gz: 7846f51731e82a8bf5553777202f0ec4e6a67457b04c07bc684ed46e2b7d0403
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ec5f93e56eedf2f7b18af0e5fbd3fd6d4d770470c83b90c1637a0b48ddbf9c823e26c8b708a4c9d953acadea5b0dd2be6322656a5518f9a817386e44880ff46
|
7
|
+
data.tar.gz: db16ff82c0e643042b5262449f20d43ce3ed731677853344d83e46b041267a13195d39878bf6ea09a135d15fab5b4b325efd86e220391b102cec46d166eea0e9
|
data/lib/pubcontrol.rb
CHANGED
data/lib/pubcontrolclient.rb
CHANGED
@@ -34,6 +34,7 @@ class PubControlClient
|
|
34
34
|
@auth_basic_pass = nil
|
35
35
|
@auth_jwt_claim = nil
|
36
36
|
@auth_jwt_key = nil
|
37
|
+
@auth_bearer_key = nil
|
37
38
|
@http = Net::HTTP::Persistent.new @object_id.to_s
|
38
39
|
@http.open_timeout = 10
|
39
40
|
@http.read_timeout = 10
|
@@ -57,6 +58,14 @@ class PubControlClient
|
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
61
|
+
# Call this method and pass a key to use bearer authenticate
|
62
|
+
# with the configured endpoint
|
63
|
+
def set_auth_bearer(key)
|
64
|
+
@lock.synchronize do
|
65
|
+
@auth_bearer_key = key
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
60
69
|
# The synchronous publish method for publishing the specified item to the
|
61
70
|
# specified channels on the configured endpoint.
|
62
71
|
def publish(channels, item)
|
@@ -131,7 +140,10 @@ class PubControlClient
|
|
131
140
|
# data to the endpoint. This method accepts the URI endpoint, authorization
|
132
141
|
# header, and a list of items to publish.
|
133
142
|
def pubcall(uri, auth_header, items)
|
134
|
-
|
143
|
+
if uri.to_s[-1] != '/'
|
144
|
+
uri = uri.to_s + '/'
|
145
|
+
end
|
146
|
+
uri = URI(uri + 'publish/')
|
135
147
|
content = Hash.new
|
136
148
|
content['items'] = items
|
137
149
|
request = Net::HTTP::Post.new(uri.request_uri)
|
@@ -143,7 +155,7 @@ class PubControlClient
|
|
143
155
|
response = make_http_request(uri, request)
|
144
156
|
if !response.kind_of? Net::HTTPSuccess
|
145
157
|
raise 'failed to publish: ' + response.class.to_s + ' ' +
|
146
|
-
response.message
|
158
|
+
response.message + ' ' + response.body.dump
|
147
159
|
end
|
148
160
|
end
|
149
161
|
|
@@ -235,6 +247,8 @@ class PubControlClient
|
|
235
247
|
claim = @auth_jwt_claim
|
236
248
|
end
|
237
249
|
return 'Bearer ' + JWT.encode(claim, @auth_jwt_key)
|
250
|
+
elsif !@auth_bearer_key.nil?
|
251
|
+
return 'Bearer ' + @auth_bearer_key
|
238
252
|
else
|
239
253
|
return nil
|
240
254
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubcontrol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Bokarius
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: algorithms
|
@@ -82,8 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
|
-
|
86
|
-
rubygems_version: 2.4.5
|
85
|
+
rubygems_version: 3.0.3.1
|
87
86
|
signing_key:
|
88
87
|
specification_version: 4
|
89
88
|
summary: Ruby EPCP library
|