geoloclog 0.1.3 → 0.1.4
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 +0 -0
- data.tar.gz.sig +0 -0
- data/lib/geoloclog.rb +18 -2
- metadata +2 -2
- 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: 0eba1e5c9ed888755878c5688f4cc5ae1ffc43a7
|
4
|
+
data.tar.gz: 583e593d65aa281a68b6fb096fa8f4610ef7a3c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5717f369e4bce9ba0da253657ceaa98b882ed4fe5e1dc98ef7d02046d648f8355d2e2f9589f11af37405fc469dadeb0041d07cdbb3cf05d45d9e7d1385993581
|
7
|
+
data.tar.gz: 8414e547d5550df06b5929745e973188c0cdd97a5f453f988372088b9c4c350e9716395b799bf1dd3625d0b7ecb71e52e651da0b933309c0e89a19662b525a34
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/geoloclog.rb
CHANGED
@@ -7,12 +7,21 @@ require 'glw'
|
|
7
7
|
require 'dynarex-daily'
|
8
8
|
|
9
9
|
|
10
|
+
# options:
|
11
|
+
#
|
12
|
+
# file: used to store the place names and the coordinates
|
13
|
+
# wait: records can only be added after the given wait time in seconds
|
14
|
+
# labels: Maps the returned place name with a user-defined label (optional)
|
15
|
+
# dbfile: sqlite database file used to store an addresses with a position
|
16
|
+
# timeout: number of seconds to wait before the Geocoder gem
|
17
|
+
# timesout when accessing the Google API
|
18
|
+
|
10
19
|
class GeoLocLog
|
11
20
|
|
12
21
|
def initialize(file='geoloclog.xml', wait: 60, labels: nil, dbfile: 'glw.db',
|
13
22
|
timeout: 10)
|
14
23
|
|
15
|
-
@filename = file
|
24
|
+
@filename, @wait = file, wait
|
16
25
|
|
17
26
|
@labels = labels ? YAML.load(RXFHelper.read(labels).first) : {}
|
18
27
|
|
@@ -31,7 +40,14 @@ class GeoLocLog
|
|
31
40
|
|
32
41
|
def add(lat, lon)
|
33
42
|
|
34
|
-
|
43
|
+
return if location and (Time.now - Time.parse(location.created) < @wait)
|
44
|
+
|
45
|
+
begin
|
46
|
+
h = @glw.locate lat, lon
|
47
|
+
rescue
|
48
|
+
puts 'geoloclog::add warning: ' + ($!).inspect
|
49
|
+
return
|
50
|
+
end
|
35
51
|
|
36
52
|
record = {
|
37
53
|
place: h[:route],
|
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
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
SL1FXwF5xFozplx6l2vkiZwth/kKCNXmuPYccz1ZTGkC9EO+d5w/RZO/av2SG6TI
|
32
32
|
PtgIvir8YvFdtA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-10-
|
34
|
+
date: 2017-10-16 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: glw
|
metadata.gz.sig
CHANGED
Binary file
|