geoloclog 0.1.3 → 0.1.4

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: a586de3920538214791766d722da777579762021
4
- data.tar.gz: 790d541498c298b9f19dc6d9cf62e008a6d5d65e
3
+ metadata.gz: 0eba1e5c9ed888755878c5688f4cc5ae1ffc43a7
4
+ data.tar.gz: 583e593d65aa281a68b6fb096fa8f4610ef7a3c7
5
5
  SHA512:
6
- metadata.gz: c10d26d17f790d772f4281c5f5180cd5be11ff7ff4628de2284c3db22cddc27282f5cb811fea47b1ffffdaada709bb88f1bc47ad83f3a23a14752fd6719c6251
7
- data.tar.gz: b5a5f931daa6b8abc14a4ace218552aeeee6ed9282bfeafe649ac2d8639bf10ff4be4a6b8c9dce7c56a988186bbecb122651e204d0fff7c9dc9d8ced3b6c36ad
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
- h = @glw.locate lat, lon
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.3
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-15 00:00:00.000000000 Z
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