google_timeline 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69c627ec56797c6124b1ca3ec12c54019e3049a9
4
- data.tar.gz: 2f063c57a1f62c3a5fb1d3bc0d16f120dabcf837
3
+ metadata.gz: 782d4b32ce624dea5f862ad465b88fc4a04884a1
4
+ data.tar.gz: a1b0ca519b8d4a90763672c3b900a9f119158dea
5
5
  SHA512:
6
- metadata.gz: 10c6284610f01b77e8bf8da8ce0d1818341e226db2078f0b293a89aa510161e222dc809754e326faa5967d942c5aca366fbae22d4bc98bcf56772cbdd64eae4a
7
- data.tar.gz: 98aa8c46503e3f846079ecce47eaf4223ff432d7a7d060c2f33534f9aa08d4b9dc335e2ef22435cf40f7582b78eda53fa29dd586ed9ef0fc38825d064e4a74ee
6
+ metadata.gz: 1aaee26ded99e6bd2c9dbc5670459b6744a4bdd2d6ff7a6c633907ee8f8699f84530a6cc0ffd6a6fe21905c4f503851dcad9d8afa6bb7294a1ee366abfcede80
7
+ data.tar.gz: f3bba0b7da70a93141a2f563341a1461041443d3cbc5089525bc964219f53d23a283ca56a318cbb228eb5e21495ca3987e82d274bacef381e07800cf1c491515
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,13 +1,13 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in google_timeline.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in google_timeline.gemspec
4
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,41 +1,41 @@
1
- PATH
2
- remote: .
3
- specs:
4
- google_timeline (1.0.2)
5
- nokogiri (~> 1.6)
6
- polylines (~> 0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- diff-lcs (1.2.5)
12
- mini_portile2 (2.0.0)
13
- nokogiri (1.6.7.2)
14
- mini_portile2 (~> 2.0.0.rc2)
15
- polylines (0.3.0)
16
- rake (10.5.0)
17
- rspec (3.4.0)
18
- rspec-core (~> 3.4.0)
19
- rspec-expectations (~> 3.4.0)
20
- rspec-mocks (~> 3.4.0)
21
- rspec-core (3.4.4)
22
- rspec-support (~> 3.4.0)
23
- rspec-expectations (3.4.0)
24
- diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.4.0)
26
- rspec-mocks (3.4.1)
27
- diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.4.0)
29
- rspec-support (3.4.1)
30
-
31
- PLATFORMS
32
- ruby
33
-
34
- DEPENDENCIES
35
- bundler (~> 1.10)
36
- google_timeline!
37
- rake (~> 10.0)
38
- rspec (~> 3.0)
39
-
40
- BUNDLED WITH
41
- 1.11.2
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ google_timeline (1.0.2)
5
+ nokogiri (~> 1.6)
6
+ polylines (~> 0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.2.5)
12
+ mini_portile2 (2.0.0)
13
+ nokogiri (1.6.7.2)
14
+ mini_portile2 (~> 2.0.0.rc2)
15
+ polylines (0.3.0)
16
+ rake (10.5.0)
17
+ rspec (3.4.0)
18
+ rspec-core (~> 3.4.0)
19
+ rspec-expectations (~> 3.4.0)
20
+ rspec-mocks (~> 3.4.0)
21
+ rspec-core (3.4.4)
22
+ rspec-support (~> 3.4.0)
23
+ rspec-expectations (3.4.0)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.4.0)
26
+ rspec-mocks (3.4.1)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.4.0)
29
+ rspec-support (3.4.1)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ bundler (~> 1.10)
36
+ google_timeline!
37
+ rake (~> 10.0)
38
+ rspec (~> 3.0)
39
+
40
+ BUNDLED WITH
41
+ 1.11.2
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Surajit Khan
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Surajit Khan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,59 +1,59 @@
1
- # GoogleTimeline (beta release)
2
-
3
- Welcome to Map Timeline (Google) integration!
4
-
5
-
6
- ## Installation
7
-
8
- Add this line to your application's Gemfile:
9
-
10
- ```ruby
11
- gem 'google_timeline'
12
- ```
13
-
14
- And then execute:
15
-
16
- $ bundle
17
-
18
- Or install it yourself as:
19
-
20
- $ gem install google_timeline
21
-
22
- ## Usage
23
-
24
- ```ruby
25
- GoogleTimeline.get_timeline("/home/surajit/Downloads/history-2016-04-03.kml")
26
- ```
27
- => {:date=>#<Date: 2016-04-03 ((2457482j,0s,0n),+0s,2299161j)>, :url=>"http://maps.googleapis.com/maps/api/staticmap?scale=2&path=enc:}lvmA{f}xMVYi@GGAAAf@n@i@o@IDCKIC@?A?f@LLBFDaAYKCRFCAybCWn[vjEmXbbJk_CjhFhR`UjbGfwJrhN~cIjtJfoO~tI|{KxuIvdMz|E~~Sz[jzC~~JfpQ`zCznPljHdzSziJpyPliL|oLgfAfcJxtCnfI????tIjhDvI|wO~tC|hMsR`nAksAzhNyoAh`Im@G_@rzLweKnyMgaJb{IxvE~`G|wHztChCsq@imFy]ayEohBaDarHnwBirC??aWbS`WcS||BwvA`jLgyLhAyzGtpCaaVjSakMumDcmMbk@cxMshCa{MxuAcrIc|@avF}nD}fDamIgpFmxJe~NszEucRczBosHgsEyxQelEg_EEj@fAeFmLybCeqB_dFk{BqvNcpGqiHwlEygEa{Fg_LezHoiKswL}zGt_Bc|FfjCahSmbBmkI_|DbK&size=600x600&sensor=false"}
28
-
29
- or
30
- ```ruby
31
- GoogleTimeline.get_timeline("/home/surajit/Downloads/history-2016-04-03.kml", {:distance=>true})
32
- ```
33
- => {:date=>#<Date: 2016-04-03 ((2457482j,0s,0n),+0s,2299161j)>, :url=>"http://maps.googleapis.com/maps/api/staticmap?scale=2&path=enc:}lvmA{f}xMVYi@GGAAAf@n@i@o@IDCKIC@?A?f@LLBFDaAYKCRFCAybCWn[vjEmXbbJk_CjhFhR`UjbGfwJrhN~cIjtJfoO~tI|{KxuIvdMz|E~~Sz[jzC~~JfpQ`zCznPljHdzSziJpyPliL|oLgfAfcJxtCnfI????tIjhDvI|wO~tC|hMsR`nAksAzhNyoAh`Im@G_@rzLweKnyMgaJb{IxvE~`G|wHztChCsq@imFy]ayEohBaDarHnwBirC??aWbS`WcS||BwvA`jLgyLhAyzGtpCaaVjSakMumDcmMbk@cxMshCa{MxuAcrIc|@avF}nD}fDamIgpFmxJe~NszEucRczBosHgsEyxQelEg_EEj@fAeFmLybCeqB_dFk{BqvNcpGqiHwlEygEa{Fg_LezHoiKswL}zGt_Bc|FfjCahSmbBmkI_|DbK&size=600x600&sensor=false", :distance=>{:value=>520181.2852676145, :unit=>"meter"}}
34
-
35
- or
36
- ```ruby
37
- GoogleTimeline.get_timeline("/home/surajit/Downloads/history-2016-04-03.kml", {:distance=>true}, {:home_coordinate=>[0,0]})
38
- ```
39
- => {:date=>#<Date: 2016-04-03 ((2457482j,0s,0n),+0s,2299161j)>, :url=>"http://maps.googleapis.com/maps/api/staticmap?scale=2&path=enc:}lvmA{f}xMVYi@GGAAAf@n@i@o@IDCKIC@?A?f@LLBFDaAYKCRFCAybCWn[vjEmXbbJk_CjhFhR`UjbGfwJrhN~cIjtJfoO~tI|{KxuIvdMz|E~~Sz[jzC~~JfpQ`zCznPljHdzSziJpyPliL|oLgfAfcJxtCnfI????tIjhDvI|wO~tC|hMsR`nAksAzhNyoAh`Im@G_@rzLweKnyMgaJb{IxvE~`G|wHztChCsq@imFy]ayEohBaDarHnwBirC??aWbS`WcS||BwvA`jLgyLhAyzGtpCaaVjSakMumDcmMbk@cxMshCa{MxuAcrIc|@avF}nD}fDamIgpFmxJe~NszEucRczBosHgsEyxQelEg_EEj@fAeFmLybCeqB_dFk{BqvNcpGqiHwlEygEa{Fg_LezHoiKswL}zGt_Bc|FfjCahSmbBmkI_|DbK&size=600x600&sensor=false", :distance=>{:value=>520181.2852676145, :unit=>"meter"}}
40
-
41
- distance and home_coordinate are optional.
42
- distance: To measure the travel distance which will return value in meter
43
- home_coordinate: to mention the home coordinate
44
-
45
-
46
- ## Development
47
-
48
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
49
-
50
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
-
52
- ## Contributing
53
-
54
- Bug reports and pull requests are welcome on GitHub at https://github.com/surajit16/google_timeline.
55
-
56
-
57
- ## License
58
-
59
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
1
+ # GoogleTimeline (beta release)
2
+
3
+ Welcome to Map Timeline (Google) integration!
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'google_timeline'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install google_timeline
21
+
22
+ ## Usage
23
+
24
+ ```ruby
25
+ GoogleTimeline.get_timeline("/home/surajit/Downloads/history-2016-04-03.kml")
26
+ ```
27
+ => {:date=>#<Date: 2016-04-03 ((2457482j,0s,0n),+0s,2299161j)>, :url=>"http://maps.googleapis.com/maps/api/staticmap?scale=2&path=enc:}lvmA{f}xMVYi@GGAAAf@n@i@o@IDCKIC@?A?f@LLBFDaAYKCRFCAybCWn[vjEmXbbJk_CjhFhR`UjbGfwJrhN~cIjtJfoO~tI|{KxuIvdMz|E~~Sz[jzC~~JfpQ`zCznPljHdzSziJpyPliL|oLgfAfcJxtCnfI????tIjhDvI|wO~tC|hMsR`nAksAzhNyoAh`Im@G_@rzLweKnyMgaJb{IxvE~`G|wHztChCsq@imFy]ayEohBaDarHnwBirC??aWbS`WcS||BwvA`jLgyLhAyzGtpCaaVjSakMumDcmMbk@cxMshCa{MxuAcrIc|@avF}nD}fDamIgpFmxJe~NszEucRczBosHgsEyxQelEg_EEj@fAeFmLybCeqB_dFk{BqvNcpGqiHwlEygEa{Fg_LezHoiKswL}zGt_Bc|FfjCahSmbBmkI_|DbK&size=600x600&sensor=false"}
28
+
29
+ or
30
+ ```ruby
31
+ GoogleTimeline.get_timeline("/home/surajit/Downloads/history-2016-04-03.kml", {:distance=>true})
32
+ ```
33
+ => {:date=>#<Date: 2016-04-03 ((2457482j,0s,0n),+0s,2299161j)>, :url=>"http://maps.googleapis.com/maps/api/staticmap?scale=2&path=enc:}lvmA{f}xMVYi@GGAAAf@n@i@o@IDCKIC@?A?f@LLBFDaAYKCRFCAybCWn[vjEmXbbJk_CjhFhR`UjbGfwJrhN~cIjtJfoO~tI|{KxuIvdMz|E~~Sz[jzC~~JfpQ`zCznPljHdzSziJpyPliL|oLgfAfcJxtCnfI????tIjhDvI|wO~tC|hMsR`nAksAzhNyoAh`Im@G_@rzLweKnyMgaJb{IxvE~`G|wHztChCsq@imFy]ayEohBaDarHnwBirC??aWbS`WcS||BwvA`jLgyLhAyzGtpCaaVjSakMumDcmMbk@cxMshCa{MxuAcrIc|@avF}nD}fDamIgpFmxJe~NszEucRczBosHgsEyxQelEg_EEj@fAeFmLybCeqB_dFk{BqvNcpGqiHwlEygEa{Fg_LezHoiKswL}zGt_Bc|FfjCahSmbBmkI_|DbK&size=600x600&sensor=false", :distance=>{:value=>520181.2852676145, :unit=>"meter"}}
34
+
35
+ or
36
+ ```ruby
37
+ GoogleTimeline.get_timeline("/home/surajit/Downloads/history-2016-04-03.kml", {:distance=>true}, {:home_coordinate=>[0,0]})
38
+ ```
39
+ => {:date=>#<Date: 2016-04-03 ((2457482j,0s,0n),+0s,2299161j)>, :url=>"http://maps.googleapis.com/maps/api/staticmap?scale=2&path=enc:}lvmA{f}xMVYi@GGAAAf@n@i@o@IDCKIC@?A?f@LLBFDaAYKCRFCAybCWn[vjEmXbbJk_CjhFhR`UjbGfwJrhN~cIjtJfoO~tI|{KxuIvdMz|E~~Sz[jzC~~JfpQ`zCznPljHdzSziJpyPliL|oLgfAfcJxtCnfI????tIjhDvI|wO~tC|hMsR`nAksAzhNyoAh`Im@G_@rzLweKnyMgaJb{IxvE~`G|wHztChCsq@imFy]ayEohBaDarHnwBirC??aWbS`WcS||BwvA`jLgyLhAyzGtpCaaVjSakMumDcmMbk@cxMshCa{MxuAcrIc|@avF}nD}fDamIgpFmxJe~NszEucRczBosHgsEyxQelEg_EEj@fAeFmLybCeqB_dFk{BqvNcpGqiHwlEygEa{Fg_LezHoiKswL}zGt_Bc|FfjCahSmbBmkI_|DbK&size=600x600&sensor=false", :distance=>{:value=>520181.2852676145, :unit=>"meter"}}
40
+
41
+ distance and home_coordinate are optional.
42
+ distance: To measure the travel distance which will return value in meter
43
+ home_coordinate: to mention the home coordinate
44
+
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
49
+
50
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
+
52
+ ## Contributing
53
+
54
+ Bug reports and pull requests are welcome on GitHub at https://github.com/surajit16/google_timeline.
55
+
56
+
57
+ ## License
58
+
59
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "google_timeline"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "google_timeline"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup CHANGED
@@ -1,7 +1,7 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -1,37 +1,37 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'google_timeline/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "google_timeline"
8
- spec.version = GoogleTimeline::VERSION
9
- spec.authors = ["Surajit Khan"]
10
- spec.email = ["surajit16@gmail.com"]
11
-
12
- spec.summary = %q{Integrate Map-Timeline (Google)}
13
- spec.description = %q{Integrate Map Timeline (Google)}
14
- spec.homepage = "https://github.com/surajit16/google_timeline"
15
- spec.license = "MIT"
16
-
17
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
- # delete this section to allow pushing this gem to any host.
19
- # if spec.respond_to?(:metadata)
20
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
- # else
22
- # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
- # end
24
-
25
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.files += Dir['lib/*'] + Dir['lib/google_timeline/*'] + Dir['bin/*']
27
- spec.bindir = "exe"
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
- spec.require_paths = ["lib"]
30
-
31
- spec.add_dependency 'polylines', '~> 0'
32
- spec.add_dependency 'nokogiri', '~> 1.6'
33
-
34
- spec.add_development_dependency "bundler", "~> 1.10"
35
- spec.add_development_dependency "rake", "~> 10.0"
36
- spec.add_development_dependency "rspec", '~> 3.0'
37
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'google_timeline/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "google_timeline"
8
+ spec.version = GoogleTimeline::VERSION
9
+ spec.authors = ["Surajit Khan"]
10
+ spec.email = ["surajit16@gmail.com"]
11
+
12
+ spec.summary = %q{Integrate Map-Timeline (Google)}
13
+ spec.description = %q{Integrate Map Timeline (Google)}
14
+ spec.homepage = "https://github.com/surajit16/google_timeline"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ # end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.files += Dir['lib/*'] + Dir['lib/google_timeline/*'] + Dir['bin/*']
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency 'polylines', '~> 0'
32
+ spec.add_dependency 'nokogiri', '~> 1.6'
33
+
34
+ spec.add_development_dependency "bundler", "~> 1.10"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rspec", '~> 3.0'
37
+ end
@@ -1,106 +1,121 @@
1
- class GoogleMapTimeline
2
- attr_accessor :home_coordinate
3
- attr_accessor :file_path
4
-
5
- def initialize(file_path, home_coordinate)
6
- self.file_path = file_path
7
- self.home_coordinate = home_coordinate
8
- end
9
-
10
- def get_timeline_url(args)
11
- op_hash = {}
12
- url=default_map
13
- coordinates = []
14
- value = self.file_path
15
- key = Date.parse(value.split("/").last.split(".").first.gsub("history-", "")) rescue nil
16
- op_hash[:date] = key
17
-
18
- if key.nil? == false and File.exists?(value)
19
- kml = File.read(value)
20
- doc = Nokogiri::XML(kml)
21
- coordinates = doc.search('//gx:coord').map{|c| c.content.split(" ")[0..1].map{|co| co.to_f}.reverse} rescue []
22
- location_str = polylines_encoding(coordinates)
23
-
24
- if location_str.length < 1900
25
- url = location_url(location_str)
26
- else
27
- times = doc.search('when').map{|c| DateTime.parse(c.content)} rescue []
28
-
29
- coordinate_time_hash = {}
30
- times.each_with_index do |t, i|
31
- coordinate_time_hash[t] = coordinates[i]
32
- end
33
-
34
- interval = 10*60 #10min
35
- selected_coordinates = []
36
- prev_time = nil
37
- coordinate_time_hash.each do |k,v|
38
- if prev_time.nil?
39
- selected_coordinates << v
40
- prev_time = k
41
- else
42
- if (((k - prev_time) * 24 * 60 * 60).to_i >= interval)
43
- selected_coordinates << v
44
- prev_time = k
45
- end
46
- end
47
- end
48
- location_str = polylines_encoding(selected_coordinates)
49
- url=location_url(location_str)
50
- end
51
- end
52
- op_hash[:url] = url
53
-
54
- if (args.empty?)==false and (args.select{|a| a.is_a?(Hash) and a[:distance]==true}.first).nil? == false
55
- distance = {:value => overall_distance(coordinates), :unit=>"meter"}
56
- op_hash[:distance] = distance
57
- end
58
- return op_hash
59
- end
60
-
61
- private
62
- def location_url(location_str)
63
- "http://maps.googleapis.com/maps/api/staticmap?scale=2&path=enc:#{location_str}&size=600x600&sensor=false"
64
- end
65
-
66
- def polylines_encoding(str)
67
- Polylines::Encoder.encode_points(str)
68
- end
69
-
70
- def default_map
71
- location_url(polylines_encoding(self.home_coordinate))
72
- end
73
-
74
- def overall_distance(coordinates)
75
- total_distance = 0
76
- for i in 0..(coordinates.count - 1)
77
- coo = coordinates[i]
78
- if i==0
79
- loc1 = coo
80
- else
81
- loc2 = coo
82
- total_distance += distance(loc1,loc2)
83
- loc1 = loc2
84
- end
85
- end
86
- return total_distance
87
- end
88
-
89
- def distance(loc1, loc2)
90
- rad_per_deg = Math::PI/180 # PI / 180
91
- rkm = 6371 # Earth radius in kilometers
92
- rm = rkm * 1000 # Radius in meters
93
-
94
- dlat_rad = (loc2[0]-loc1[0]) * rad_per_deg # Delta, converted to rad
95
- dlon_rad = (loc2[1]-loc1[1]) * rad_per_deg
96
-
97
- lat1_rad, lon1_rad = loc1.map {|i| i * rad_per_deg }
98
- lat2_rad, lon2_rad = loc2.map {|i| i * rad_per_deg }
99
-
100
- a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2
101
- c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))
102
-
103
- rm * c # Delta in meters
104
- end
105
-
106
- end
1
+ class GoogleMapTimeline
2
+ attr_accessor :home_coordinate
3
+ attr_accessor :file_path
4
+
5
+ def initialize(file_path, home_coordinate)
6
+ self.file_path = file_path
7
+ self.home_coordinate = home_coordinate
8
+ end
9
+
10
+ def get_timeline_url(args)
11
+ op_hash = {}
12
+ url=default_map
13
+ coordinates = []
14
+ value = self.file_path
15
+ key = Date.parse(value.split("/").last.split(".").first.gsub("history-", "")) rescue nil
16
+ op_hash[:date] = key
17
+
18
+ if key.nil? == false and File.exists?(value)
19
+ kml = File.read(value)
20
+ doc = Nokogiri::XML(kml)
21
+ coordinates = doc.search('//gx:coord').map{|c| c.content.split(" ")[0..1].map{|co| co.to_f}.reverse} rescue []
22
+ location_str = polylines_encoding(coordinates)
23
+
24
+ puts "=========================================================="
25
+ puts location_str.length
26
+ if location_str.length < 1900
27
+ url = location_url(location_str)
28
+ else
29
+ new_location_str = location_str.gsub("?", "")
30
+ puts new_location_str.length
31
+ if new_location_str.length < 1900
32
+ url = location_url(new_location_str)
33
+ else
34
+
35
+ coordinate_time_hash = {}
36
+ doc.search('Placemark').each do |node|
37
+ cords = node.search('.//gx:coord').map{|c| c.content.split(" ")[0..1].map{|co| co.to_f}.reverse}
38
+ start_time = DateTime.parse(node.search('TimeSpan').search('begin').first.content)
39
+ end_time = DateTime.parse(node.search('TimeSpan').search('end').first.content)
40
+ time_diff = ((end_time - start_time)* 24 * 60 * 60).to_i
41
+ cords.each_with_index do |cord, i|
42
+ coordinate_time_hash[(start_time + (i*(time_diff/cords.length)))] = cord
43
+ end
44
+ end
45
+
46
+ interval = 10*60 #10min
47
+ selected_coordinates = []
48
+ prev_time = nil
49
+ coordinate_time_hash.each do |k,v|
50
+ if prev_time.nil?
51
+ selected_coordinates << v
52
+ prev_time = k
53
+ else
54
+ if (((k - prev_time) * 24 * 60 * 60).to_i >= interval)
55
+ selected_coordinates << v
56
+ prev_time = k
57
+ end
58
+ end
59
+ end
60
+ location_str = polylines_encoding(selected_coordinates)
61
+ puts location_str.length
62
+ puts "=========================================================="
63
+ url=location_url(location_str)
64
+ end
65
+ end
66
+ end
67
+ op_hash[:url] = url
68
+
69
+ if (args.empty?)==false and (args.select{|a| a.is_a?(Hash) and a[:distance]==true}.first).nil? == false
70
+ distance = {:value => overall_distance(coordinates), :unit=>"meter"}
71
+ op_hash[:distance] = distance
72
+ end
73
+ return op_hash
74
+ end
75
+
76
+ private
77
+ def location_url(location_str)
78
+ "http://maps.googleapis.com/maps/api/staticmap?scale=2&path=enc:#{location_str}&size=600x600&sensor=false"
79
+ end
80
+
81
+ def polylines_encoding(str)
82
+ Polylines::Encoder.encode_points(str)
83
+ end
84
+
85
+ def default_map
86
+ location_url(polylines_encoding(self.home_coordinate))
87
+ end
88
+
89
+ def overall_distance(coordinates)
90
+ total_distance = 0
91
+ for i in 0..(coordinates.count - 1)
92
+ coo = coordinates[i]
93
+ if i==0
94
+ loc1 = coo
95
+ else
96
+ loc2 = coo
97
+ total_distance += distance(loc1,loc2)
98
+ loc1 = loc2
99
+ end
100
+ end
101
+ return total_distance
102
+ end
103
+
104
+ def distance(loc1, loc2)
105
+ rad_per_deg = Math::PI/180 # PI / 180
106
+ rkm = 6371 # Earth radius in kilometers
107
+ rm = rkm * 1000 # Radius in meters
108
+
109
+ dlat_rad = (loc2[0]-loc1[0]) * rad_per_deg # Delta, converted to rad
110
+ dlon_rad = (loc2[1]-loc1[1]) * rad_per_deg
111
+
112
+ lat1_rad, lon1_rad = loc1.map {|i| i * rad_per_deg }
113
+ lat2_rad, lon2_rad = loc2.map {|i| i * rad_per_deg }
114
+
115
+ a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2
116
+ c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))
117
+
118
+ rm * c # Delta in meters
119
+ end
120
+
121
+ end
@@ -1,3 +1,3 @@
1
- module GoogleTimeline
2
- VERSION = "1.0.2"
3
- end
1
+ module GoogleTimeline
2
+ VERSION = "1.0.3"
3
+ end
@@ -1,16 +1,16 @@
1
- require "google_timeline/version"
2
- require "google_timeline/google_map_timeline"
3
- require 'date'
4
- require 'nokogiri'
5
- require 'polylines'
6
-
7
- module GoogleTimeline
8
- def self.get_timeline(file_path,*args)
9
- home_coordinate = [[22.6520393, 88.407874]]
10
- if (args.empty?)==false and (args.select{|a| a.is_a?(Hash) and a[:home_coordinate]}.first).nil? == false
11
- home_coordinate = [args.select{|a| a.is_a?(Hash) and a[:home_coordinate]}.first[:home_coordinate]]
12
- end
13
- google_timeline = GoogleMapTimeline.new(file_path,home_coordinate)
14
- google_timeline.get_timeline_url(args)
15
- end
16
- end
1
+ require "google_timeline/version"
2
+ require "google_timeline/google_map_timeline"
3
+ require 'date'
4
+ require 'nokogiri'
5
+ require 'polylines'
6
+
7
+ module GoogleTimeline
8
+ def self.get_timeline(file_path,*args)
9
+ home_coordinate = [[22.6520393, 88.407874]]
10
+ if (args.empty?)==false and (args.select{|a| a.is_a?(Hash) and a[:home_coordinate]}.first).nil? == false
11
+ home_coordinate = [args.select{|a| a.is_a?(Hash) and a[:home_coordinate]}.first[:home_coordinate]]
12
+ end
13
+ google_timeline = GoogleMapTimeline.new(file_path,home_coordinate)
14
+ google_timeline.get_timeline_url(args)
15
+ end
16
+ 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: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Surajit Khan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-15 00:00:00.000000000 Z
11
+ date: 2016-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: polylines
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.4.8
122
+ rubygems_version: 2.4.5
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Integrate Map-Timeline (Google)