sps_messenger_pusher 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8f8aaaff100522a61cca7675ebf164ca2e67fbdb
4
+ data.tar.gz: c751265a40b5211aab521378decddd5e936ecadd
5
+ SHA512:
6
+ metadata.gz: eb87f61152fb7cd636b5ad9c5fea83911ae493510ad50cf36a62c6b6d0fd7c0d95a28fa613a3edccb89e94568e38044b032fa63f66be8651a1b66dd8ec5137b4
7
+ data.tar.gz: 115385b3c3eaa430b831defcd23cf077890a80035534d2a9190a5b70f87940bfa8e99938ad01fa8d8d61419a6209d3277565889d42092e261bc169fa237211c9
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ �����@�7%t/g��x����T`#P�y�+`�^���z_N�.�(�s@�bS�@!-,� ���8�p�#M!��u?�!����:] ���~WA�' �C�����9��
2
+ �G�Kk6#%@UM����.��i�ʼT��vE⪭�����0y���{�O e���_�i�_=C2����e��0+
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ # file: sps_messenger_pusher.rb
5
+
6
+ # description: The intent is to publish SPS messages at a regular interval for someone to be kept up to date with information they are interested in.
7
+ #
8
+ # Messages could include:
9
+ #
10
+ # * weather info
11
+ # * reminders (e.g. upcoming events or appointsments, to-do list)
12
+ # * unread important email
13
+ # * local news headlines
14
+ # * price of Bitcoin
15
+ # * latest RSS headlines etc.
16
+
17
+ require 'sps-sub'
18
+ require 'rss_to_dynarex'
19
+
20
+
21
+ class SPSMessengerPusher < SPSSub
22
+
23
+ def initialize(port: '59000', host: nil, feed: nil )
24
+
25
+ super(port: port, host: host)
26
+ @feed = feed
27
+ fetch_feed()
28
+
29
+ end
30
+
31
+ def start(interval: 8)
32
+
33
+ @interval = interval
34
+ Thread.new { subscribe() }
35
+
36
+ play_messages()
37
+
38
+ end
39
+
40
+ private
41
+
42
+ def fetch_feed()
43
+
44
+ rtd = RSStoDynarex.new @feed
45
+ @messages = rtd.to_dynarex.all.map(&:title)
46
+
47
+ end
48
+
49
+ def play_messages()
50
+
51
+ @status = :play
52
+
53
+ @messages.cycle.each do |message|
54
+
55
+ notice('messenger: ' + message)
56
+ sleep @interval
57
+ break if @status == :stop
58
+
59
+ end
60
+
61
+ end
62
+
63
+ def subscribe(topic: 'messenger/status')
64
+
65
+ super(topic: topic) do |msg, topic|
66
+
67
+ case msg.to_sym
68
+
69
+ when :update
70
+
71
+ fetch_feed()
72
+
73
+ when :stop
74
+
75
+ @status = :stop
76
+
77
+ when :play
78
+
79
+ play_messages
80
+
81
+ end
82
+
83
+ end
84
+
85
+ end
86
+
87
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sps_messenger_pusher
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwMjAyMjM1MTMyWhcN
15
+ MTkwMjAyMjM1MTMyWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDSJOSB
17
+ 4AXQ/OuQpknAgH4rd+ObI7uJFq8LpyNXqYBSdSr58VrIddFWW/wvTHnHuFQzSHvS
18
+ 5WZv644cdxoGWN48H7xZCSJg+gWforwCMwQkwVDHA/BCkGMPNB2kFv0ee0HTenVk
19
+ RzlwXU+jVhS3WP3inoOKlIUarKt4FzZ5pST8oHIY7a/niFA8C9wcnh9wvYZ6kd8l
20
+ 68zXyN9lP8bF4olWkhZaxENSqe4ae6nmIyBFwJZXPj6UnWYprkKT0UyPsjyhosW5
21
+ +ooco21dCRWE2yFqXVXlwgBA/jc+OlubvJSnJGu+Hw4g7wzEahybaCLG+dqlHmrW
22
+ NR6vZDPjJVj+/zoJAgMBAAGjgYowgYcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
23
+ HQYDVR0OBBYEFP810mxoY7YgHDDpwRuLHmVPAIpbMCYGA1UdEQQfMB2BG2dlbW1h
24
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTAmBgNVHRIEHzAdgRtnZW1tYXN0ZXJAamFt
25
+ ZXNyb2JlcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBAHGiVTXlJL5j8ahvQifn
26
+ yTH855oQrxxurZ5OZUOCIDIwUUI4a+fb8qAn6K7esxMldN3gLkju7dQhnRdoryHc
27
+ 4yio4jklCjM69pUkZRk8JW12NNP0mgMEYNvj7XLYcM2Ewd3g2XDkiE0zYxLR6Bav
28
+ D7T3DAU8taIMfwYu3Zna9UXj1LOT8CFuhfIfVqto4sRFKPZOLyUuLAATtKT2nE5N
29
+ U5V6Hw7p5q8/pkhtx/ejne4B1z3bWD+F9aokAI8DWf4qJXIBNrfRtrrbdCVR3Fb6
30
+ P4BX2yM0HsoRJqaqXJfXUN4YYCQKZRS7CLYRYBKZSALM3o8wivVVFu4uNGG87JrS
31
+ jdM=
32
+ -----END CERTIFICATE-----
33
+ date: 2018-02-02 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: sps-sub
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.3'
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 0.3.6
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - "~>"
50
+ - !ruby/object:Gem::Version
51
+ version: '0.3'
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.3.6
55
+ - !ruby/object:Gem::Dependency
56
+ name: rss_to_dynarex
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.1'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.1.7
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '0.1'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.1.7
75
+ description:
76
+ email: james@jamesrobertson.eu
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - lib/sps_messenger_pusher.rb
82
+ homepage: https://github.com/jrobertson/sps_messenger_pusher
83
+ licenses:
84
+ - MIT
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.6.13
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Publishes SPS messages at regular intervals primarily for viewing by a human.
106
+ test_files: []
metadata.gz.sig ADDED
Binary file