geoloclog 0.1.4 → 0.1.5
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/geoloclog.rb +19 -3
- metadata +1 -1
- 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: c863e900f4c40c83818ad4bcfd9116ce5dd81192
|
4
|
+
data.tar.gz: c179722110deff71ce02cf20f25c5ee11d38b621
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be25c5513312a66b12fe3a1f1a5ddca1ff73535bb9a5a26fc201865bcb59e35e9dfb2f6920b1431bcceb44f8e4b75fecac540e42fb06c73b9d2fc0bc31ae1035
|
7
|
+
data.tar.gz: 4292080dc662e3ac94eb3c2ffcf0df4d8127abd348a42e332d26fffcbb13ef4e5b5b2271f420a5b4f99e769d2154975ad21d8d6d9509e32d43fd90aef9ebf5d1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/geoloclog.rb
CHANGED
@@ -17,11 +17,13 @@ require 'dynarex-daily'
|
|
17
17
|
# timesout when accessing the Google API
|
18
18
|
|
19
19
|
class GeoLocLog
|
20
|
+
|
21
|
+
attr_reader :labels
|
20
22
|
|
21
23
|
def initialize(file='geoloclog.xml', wait: 60, labels: nil, dbfile: 'glw.db',
|
22
|
-
|
24
|
+
timeout: 10, placehold: true)
|
23
25
|
|
24
|
-
@filename, @wait = file, wait
|
26
|
+
@filename, @wait, @placehold = file, wait, placehold
|
25
27
|
|
26
28
|
@labels = labels ? YAML.load(RXFHelper.read(labels).first) : {}
|
27
29
|
|
@@ -41,6 +43,8 @@ class GeoLocLog
|
|
41
43
|
def add(lat, lon)
|
42
44
|
|
43
45
|
return if location and (Time.now - Time.parse(location.created) < @wait)
|
46
|
+
|
47
|
+
|
44
48
|
|
45
49
|
begin
|
46
50
|
h = @glw.locate lat, lon
|
@@ -58,7 +62,19 @@ class GeoLocLog
|
|
58
62
|
coords: [lat, lon].join(', ')
|
59
63
|
}
|
60
64
|
|
61
|
-
|
65
|
+
|
66
|
+
if location and @placehold and location.place == record[:place] then
|
67
|
+
|
68
|
+
# find the most recent record and update it
|
69
|
+
|
70
|
+
location.address = record[:address]
|
71
|
+
location.lastseen = record[:lastseen]
|
72
|
+
location.coords = record[:coords]
|
73
|
+
|
74
|
+
else
|
75
|
+
@dx.create record
|
76
|
+
end
|
77
|
+
|
62
78
|
@dx.save @filename
|
63
79
|
|
64
80
|
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|