mns_subscriber 0.4.7 → 0.6.0
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mns_subscriber.rb +34 -6
- metadata +53 -49
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 55df9bad963044ed01313c1c749b43e8ae3d746a9107dbb3bb9c9ff938837f91
|
4
|
+
data.tar.gz: 706bda2bdeba756c74e945f0b73f810de3c7cadef841f48692e80ca17a53dc8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ddd48242e49bc872922772f622c4f3f33e32718a8b4e09b880506a9f1b8be3c074428620757e8fa32b2af6db32123846b896019050b80fa412e6e448f784bc5
|
7
|
+
data.tar.gz: 79b6e558a22ba819116dffac11a1c873a8d5982730f2f0f2159cde9cecd109e673e4c300d4386c4f435f07104215007f5bbc1c405bdaa8713e37b7dda550647f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mns_subscriber.rb
CHANGED
@@ -12,7 +12,10 @@ require 'recordx_sqlite'
|
|
12
12
|
class MNSSubscriber < SPSSub
|
13
13
|
|
14
14
|
def initialize(host: 'sps', port: 59000, dir: '.', options: {},
|
15
|
-
timeline: nil)
|
15
|
+
timeline: nil, log: nil)
|
16
|
+
|
17
|
+
@log = log
|
18
|
+
log.info 'mns_subscriber/initialize: active' if log
|
16
19
|
|
17
20
|
# note: a valid url_base must be provided
|
18
21
|
|
@@ -24,7 +27,7 @@ class MNSSubscriber < SPSSub
|
|
24
27
|
target_xslt: '/xsl/page.xsl'
|
25
28
|
}.merge(options)
|
26
29
|
|
27
|
-
super(host: host, port: port)
|
30
|
+
super(host: host, port: port, log: log)
|
28
31
|
@filepath, @timeline = dir, timeline
|
29
32
|
|
30
33
|
@index = nil
|
@@ -38,6 +41,8 @@ class MNSSubscriber < SPSSub
|
|
38
41
|
private
|
39
42
|
|
40
43
|
def ontopic(topic, msg)
|
44
|
+
|
45
|
+
@log.info 'mns_subscriber/ontopic: topic: ' + topic.inspect if @topic
|
41
46
|
|
42
47
|
a = topic.split('/')
|
43
48
|
puts "%s: %s %s" % [topic, Time.now.to_s, msg.inspect]
|
@@ -57,6 +62,10 @@ class MNSSubscriber < SPSSub
|
|
57
62
|
|
58
63
|
update_attributes(:title, subtopic=a[-2], title=msg)
|
59
64
|
|
65
|
+
when :image
|
66
|
+
|
67
|
+
update_attributes(:image, subtopic=a[-2], title=msg)
|
68
|
+
|
60
69
|
when :delete
|
61
70
|
|
62
71
|
delete_notice(subtopic=a[-2], msg)
|
@@ -72,26 +81,45 @@ class MNSSubscriber < SPSSub
|
|
72
81
|
|
73
82
|
def add_notice(topic, raw_msg, raw_id=Time.now)
|
74
83
|
|
84
|
+
@log.info 'mns_subscriber/add_notice: active' if @log
|
75
85
|
topic_dir = File.join(@filepath, topic)
|
76
86
|
notices = DailyNotices.new topic_dir, @options.merge(identifier: topic,
|
77
|
-
|
87
|
+
title: topic.capitalize + ' daily notices', log: @log)
|
78
88
|
|
79
89
|
id = (raw_id || Time.now).to_i
|
80
90
|
|
81
91
|
# strip out any JSON from the end of the message
|
82
92
|
msg, raw_json = raw_msg.split(/(?=\{.*)/)
|
83
93
|
|
94
|
+
mtlite = MTLite.new(msg)
|
95
|
+
|
96
|
+
desc = if mtlite.to_html(para: false) =~ /<\w+/ then
|
97
|
+
mtlite.to_html(para: true, ignore_domainlabel:true)
|
98
|
+
else
|
99
|
+
mtlite.to_s
|
100
|
+
end
|
101
|
+
|
102
|
+
title = mtlite.to_s.lines.first.chomp
|
103
|
+
title = title[0..136] + ' ...' if title.length > 140
|
104
|
+
|
84
105
|
h = {
|
85
|
-
|
106
|
+
title: title,
|
107
|
+
description: desc,
|
86
108
|
topic: topic
|
87
109
|
}
|
110
|
+
|
88
111
|
return_status = notices.add(item: h, id: id.to_s)
|
89
112
|
|
90
113
|
return if return_status == :duplicate
|
91
114
|
|
92
115
|
rxnotices = RecordxSqlite.new(File.join(topic_dir, 'notices.db'),
|
93
116
|
table: {notices: {id: 0, message: ''}})
|
94
|
-
|
117
|
+
|
118
|
+
begin
|
119
|
+
rxnotices.create id: id.to_s, message: msg
|
120
|
+
rescue
|
121
|
+
puts 'warning: rxnotices.create -> ' + ($!).inspect
|
122
|
+
end
|
95
123
|
|
96
124
|
if raw_json then
|
97
125
|
|
@@ -154,4 +182,4 @@ class MNSSubscriber < SPSSub
|
|
154
182
|
|
155
183
|
end
|
156
184
|
|
157
|
-
end
|
185
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mns_subscriber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,49 +10,53 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwMjI0MTMzNzMzWhcN
|
15
|
+
MjIwMjI0MTMzNzMzWjA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ypvoCZh
|
30
|
+
JAmmUktsIKuKmgkJ6h1hhuJf6g90++v4iVvBHt53nhN8NaGYe4Oc2OwXTfxHam0X
|
31
|
+
JfCSR+Aw2QfaQvZKi8inGHgLmM61ABpIGTZ8lwzR6fizANDF6EQ7vNixJMSZExzP
|
32
|
+
s1BgeI/oTI1Y7UNeUtwWA8NkQ1bczUBH4FDUab4QRIbBYhXz+Hs8ddtugTzcmRwf
|
33
|
+
W0wI6iCh95fKaCbmSS5MY3dYMexH07A1XFGyHWOogCEWWYZ4ho+a44Fm0Uotp5ky
|
34
|
+
TjsXYJbdzlsAVQKfCSIfCi3T/k4bp/2wc342j/WYjkKLN4aZID+E9P/VX1Nc0m/s
|
35
|
+
yOAycOYzp7fxmPl3/HV5D0YOJwuy1XslA50GQJwq12A5vMyUGUCHuxH/zKZcM/zr
|
36
|
+
0QZaKiVqq5ZeGvni0eQSavhQ
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: mtlite
|
38
42
|
requirement: !ruby/object:Gem::Requirement
|
39
43
|
requirements:
|
40
|
-
- - "~>"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '0.3'
|
43
44
|
- - ">="
|
44
45
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
46
|
+
version: 0.4.0
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.4'
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
49
53
|
requirements:
|
50
|
-
- - "~>"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '0.3'
|
53
54
|
- - ">="
|
54
55
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.
|
56
|
+
version: 0.4.0
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.4'
|
56
60
|
- !ruby/object:Gem::Dependency
|
57
61
|
name: sps-sub
|
58
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,7 +66,7 @@ dependencies:
|
|
62
66
|
version: '0.3'
|
63
67
|
- - ">="
|
64
68
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.3.
|
69
|
+
version: 0.3.7
|
66
70
|
type: :runtime
|
67
71
|
prerelease: false
|
68
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -72,47 +76,47 @@ dependencies:
|
|
72
76
|
version: '0.3'
|
73
77
|
- - ">="
|
74
78
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.3.
|
79
|
+
version: 0.3.7
|
76
80
|
- !ruby/object:Gem::Dependency
|
77
81
|
name: daily_notices
|
78
82
|
requirement: !ruby/object:Gem::Requirement
|
79
83
|
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.6'
|
83
84
|
- - ">="
|
84
85
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.
|
86
|
+
version: 0.7.0
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.7'
|
86
90
|
type: :runtime
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
93
|
requirements:
|
90
|
-
- - "~>"
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: '0.6'
|
93
94
|
- - ">="
|
94
95
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.
|
96
|
+
version: 0.7.0
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0.7'
|
96
100
|
- !ruby/object:Gem::Dependency
|
97
101
|
name: recordx_sqlite
|
98
102
|
requirement: !ruby/object:Gem::Requirement
|
99
103
|
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0.2'
|
103
104
|
- - ">="
|
104
105
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.
|
106
|
+
version: 0.3.0
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.3'
|
106
110
|
type: :runtime
|
107
111
|
prerelease: false
|
108
112
|
version_requirements: !ruby/object:Gem::Requirement
|
109
113
|
requirements:
|
110
|
-
- - "~>"
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '0.2'
|
113
114
|
- - ">="
|
114
115
|
- !ruby/object:Gem::Version
|
115
|
-
version: 0.
|
116
|
+
version: 0.3.0
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0.3'
|
116
120
|
description:
|
117
121
|
email: james@jamesrobertson.eu
|
118
122
|
executables: []
|
@@ -140,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
144
|
version: '0'
|
141
145
|
requirements: []
|
142
146
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.7.10
|
144
148
|
signing_key:
|
145
149
|
specification_version: 4
|
146
150
|
summary: Creates microblog posts from different identities by subscribing to the SPS
|
metadata.gz.sig
CHANGED
Binary file
|