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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0eba1e5c9ed888755878c5688f4cc5ae1ffc43a7
4
- data.tar.gz: 583e593d65aa281a68b6fb096fa8f4610ef7a3c7
3
+ metadata.gz: c863e900f4c40c83818ad4bcfd9116ce5dd81192
4
+ data.tar.gz: c179722110deff71ce02cf20f25c5ee11d38b621
5
5
  SHA512:
6
- metadata.gz: 5717f369e4bce9ba0da253657ceaa98b882ed4fe5e1dc98ef7d02046d648f8355d2e2f9589f11af37405fc469dadeb0041d07cdbb3cf05d45d9e7d1385993581
7
- data.tar.gz: 8414e547d5550df06b5929745e973188c0cdd97a5f453f988372088b9c4c350e9716395b799bf1dd3625d0b7ecb71e52e651da0b933309c0e89a19662b525a34
6
+ metadata.gz: be25c5513312a66b12fe3a1f1a5ddca1ff73535bb9a5a26fc201865bcb59e35e9dfb2f6920b1431bcceb44f8e4b75fecac540e42fb06c73b9d2fc0bc31ae1035
7
+ data.tar.gz: 4292080dc662e3ac94eb3c2ffcf0df4d8127abd348a42e332d26fffcbb13ef4e5b5b2271f420a5b4f99e769d2154975ad21d8d6d9509e32d43fd90aef9ebf5d1
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- timeout: 10)
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
- @dx.create record
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoloclog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file