google_timeline 2.0.0 → 2.1.0

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: 54f6cdc010818ebf8a5e5cc72948620f370e1391
4
- data.tar.gz: 090dd0d34cf22ff284379f56fbdb4838b6ae4669
3
+ metadata.gz: 544e2424574d2316af29b04e923bd5c2d4e5db00
4
+ data.tar.gz: ee22f128d7e5abe4a46a85936055ef93f4b9121a
5
5
  SHA512:
6
- metadata.gz: 974d4eac4f8513eeba648159e1455bd30630e2ee2e7a8ee1ce1d1a5f4e21d4f8852c57d38714a974aae465dfd4bbc5bd059eed9a235f702f8e4c12be5df546b9
7
- data.tar.gz: 4932721a3af4b8b8cf7547659525979d1b3a06890bd0c7c1d0384bd05586b8b0d7ec47d3d41128cb2bff6f0a1f72e3e4cd31157be4d5faf3f2f881ffebba252f
6
+ metadata.gz: cd4f77e1caf5091535fb1473e253aef3ca4aaaf440ab6554ab314c53a6f4d38f27d870273e15986b2261b467468b2d49421ab4a0e2c56cafd63137bfd139188f
7
+ data.tar.gz: dcc29c29aea18d262c62d0bdf4d56690a78584b5974e44983dbc29363918ccd00eea255ef2cad3f0fe463660809933df2eb2d0397591d0929007b8c67cbc91b2
@@ -18,21 +18,20 @@ class GoogleMapTimeline
18
18
  if key.nil? == false and File.exists?(value)
19
19
  kml = File.read(value)
20
20
  doc = Nokogiri::XML(kml)
21
- # Google supports 4 decimal point only -- Need to check with google support
22
- # coordinates = doc.search('LineString/coordinates').map{|c| c.content.split(" ")}.flatten.map{|co| co.split(",")[0..1].reverse.map{|co1| co1.to_f}} rescue []
23
- coordinates = doc.search('coordinates').map{|c| c.content.split(" ")}.flatten.map{|co| co.split(",")[0..1].reverse.map{|co1| co1.to_f.round(4)}} rescue []
24
- location_str = polylines_encoding(coordinates)
21
+ coordinates = doc.search('coordinates').map{|c| c.content.split(" ")}.flatten.map{|co| co.split(",")[0..1].reverse.map{|co1| co1.to_f}} rescue []
22
+ if coordinates.is_a?(Array)
23
+ location_str = polylines_encoding(coordinates)
25
24
 
26
-
27
- if location_str.length > 1900
28
- coordinates_dup = coordinates.dup
29
- while location_str.length > 1900 do
30
- coordinates_dup = coordinates_dup.values_at(* coordinates_dup.each_index.select {|i| i.even?})
31
- location_str = polylines_encoding(coordinates_dup)
25
+ if location_str.length > 1900
26
+ coordinates_dup = coordinates.dup
27
+ while location_str.length > 1900 do
28
+ coordinates_dup = coordinates_dup.values_at(* coordinates_dup.each_index.select {|i| i.even?})
29
+ location_str = polylines_encoding(coordinates_dup)
30
+ end
32
31
  end
32
+ url = location_url(location_str)
33
33
  end
34
- url = location_url(location_str)
35
-
34
+
36
35
  end
37
36
  op_hash[:url] = url
38
37
 
@@ -49,7 +48,7 @@ class GoogleMapTimeline
49
48
  end
50
49
 
51
50
  def polylines_encoding(str)
52
- Polylines::Encoder.encode_points(str)
51
+ Polylines::Encoder.encode_points(str).gsub("\\", '%5c')
53
52
  end
54
53
 
55
54
  def default_map
@@ -1,3 +1,3 @@
1
1
  module GoogleTimeline
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_timeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Surajit Khan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-04 00:00:00.000000000 Z
11
+ date: 2018-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: polylines