myweatherfeed 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -1
- data/lib/myweatherfeed.rb +19 -52
- data.tar.gz.sig +0 -0
- metadata +25 -24
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 840f0e10722199fbc0bba53cd8d38c787b3e9faf
|
4
|
+
data.tar.gz: 6ed9e2deb45f7851a7b8502da2eb2bb854ec0c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51d506f77066a7f9832ce1f661d9d28f86b78b6c7b5415c15e9d85d6a25a155b69732a04190aa02d57cd5f37eee0e319cd3c8361c0ee422b3c745615c883d5d6
|
7
|
+
data.tar.gz: ceb29849c7af735fba380ca11e312518a8117fde2a884fb61034bac19307298b93cce0b2370a38dde9b445143a2d49f91c929f2f9999ecb420420386b3140d39
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
=��~+͍G�Y�0�CC�'�ݩT�n��q9p��ĩ���_���F�KDN;�"wH�& օ��ঔק����)�[u�C�VpŘך�����Z�nM<�h�w]�2,�H3�#~b��+dg�: Q?n�< D����su؆p���r�i�b@���Db�����P{
|
2
|
+
��������4��ٲ�d�}���&������q�|:�$�Y)��Y�G.uhzd
|
data/lib/myweatherfeed.rb
CHANGED
@@ -2,69 +2,36 @@
|
|
2
2
|
|
3
3
|
# file: myweatherfeed.rb
|
4
4
|
|
5
|
-
require '
|
5
|
+
require 'sps-pub'
|
6
6
|
require 'myweatherforecast'
|
7
7
|
|
8
8
|
|
9
|
-
class MyWeatherFeed
|
10
|
-
|
11
|
-
def initialize(filepath='', location: nil, api_key: nil, \
|
12
|
-
url_base: '', dx_xslt: '', rss_xslt: '', refreshrate: nil)
|
13
|
-
|
14
|
-
super(filepath, url_base: url_base, dx_xslt: dx_xslt, rss_xslt: rss_xslt)
|
9
|
+
class MyWeatherFeed
|
10
|
+
|
15
11
|
|
16
|
-
|
17
|
-
|
18
|
-
@coordinates = w.coordinates
|
19
|
-
|
20
|
-
self.title = 'My weather feed for ' + \
|
21
|
-
(location || @w.coordinates.join(', '))
|
22
|
-
self.description = 'Weather data fetched from forecast.io'
|
23
|
-
|
24
|
-
# set the time last updated in the hidden scratch file if refreshrate set
|
25
|
-
|
26
|
-
@datafile = File.join(@filepath, '.myweatherfeed')
|
27
|
-
@refreshrate = refreshrate.to_i
|
28
|
-
|
29
|
-
if refreshrate then
|
30
|
-
|
31
|
-
@h = File.exists?(@datafile) ? Kvx.new(File.read(@datafile)).to_h : {nextrefresh: Time.now.to_s, notice: ''}
|
12
|
+
def initialize(location: nil, api_key: nil, sps_host: 'sps', \
|
13
|
+
sps_port: 59000, feed_url: '')
|
32
14
|
|
33
|
-
|
15
|
+
@w = MyWeatherForecast.new location, api_key: api_key
|
16
|
+
|
17
|
+
@sps = SPSPub.new(address: sps_host, port: sps_port)
|
18
|
+
|
19
|
+
title = 'My weather feed for ' + \
|
20
|
+
(location.is_a?(Array) ? location.join(', ') :location)
|
21
|
+
description = 'Weather data fetched from forecast.io'
|
22
|
+
|
34
23
|
|
35
24
|
end
|
36
25
|
|
37
|
-
def
|
38
|
-
loop { self.update; sleep(@refreshrate * 60) }
|
39
|
-
end
|
40
|
-
|
41
|
-
def update()
|
26
|
+
def initialize_feed()
|
42
27
|
|
43
|
-
|
44
|
-
|
45
|
-
w = MyWeatherForecast.new @coordinates, api_key: @api_key
|
46
|
-
notice = w.now.to_s
|
47
|
-
|
48
|
-
return if notice == @h[:notice]
|
49
|
-
|
50
|
-
self.add notice, id: Time.now.strftime('%H%M')
|
51
|
-
on_change(w.now)
|
28
|
+
@sps.notice 'notice/weather/title: ' + @title
|
29
|
+
@sps.notice 'notice/weather/profile: ' + @description
|
52
30
|
|
53
|
-
if @refreshrate then
|
54
|
-
|
55
|
-
@h = {nextrefresh: (Time.now + @refreshrate * 60).to_s, notice: notice}
|
56
|
-
File.write @datafile, Kvx.new(@h)
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
31
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
def on_change(now)
|
65
|
-
|
66
|
-
yield(now)
|
67
|
-
|
32
|
+
|
33
|
+
def update()
|
34
|
+
@sps.notice 'notice/weather: ' + @w.now.to_s
|
68
35
|
end
|
69
36
|
|
70
37
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myweatherfeed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,26 +12,26 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE2MTExNjE4NDY1OFoXDTE3MTExNjE4NDY1OFowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
ggEBALb7WrPsFs/Yy65yMw/xMtSraN2AJLOECB8cvLdLqJ8/yKciUgV2DrFWy37t
|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34
|
-
date:
|
34
|
+
date: 2016-11-16 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: myweatherforecast
|
@@ -54,25 +54,25 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.5.2
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: sps-pub
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
62
|
+
version: '0.4'
|
63
63
|
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.
|
65
|
+
version: 0.4.3
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
70
|
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '0.
|
72
|
+
version: '0.4'
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.4.3
|
76
76
|
description:
|
77
77
|
email: james@r0bertson.co.uk
|
78
78
|
executables: []
|
@@ -100,8 +100,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.5.1
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
|
-
summary: Generates an RSS feed
|
106
|
+
summary: Generates an RSS feed (when used in conjunction with the mns_subscriber services)
|
107
|
+
for the weather data using the myweatherforecast gem
|
107
108
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|