google_timeline 1.0 → 1.0.1

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: dcf2f77b9a4958774ff1d94d72eaadd44ca5e3f7
4
- data.tar.gz: 0d32603fe3584c0ca60f6c66064fcccdfdc34047
3
+ metadata.gz: e4080d5f46c4811933a99d3fed150e3de179fab4
4
+ data.tar.gz: afbdcb2a5d67472f03b321f4fdacc4a9a4d127d6
5
5
  SHA512:
6
- metadata.gz: f4fd78060ec9f043a21a486b7b19f558e7383e00269e314eee2718a5bfd01b87f68c1058fec4c47e996916b7d08e24f8396a12b39820dd970edc1ca0556bfc80
7
- data.tar.gz: 0db42350db3a2090ebf768b6ac1d8a62563196de192a3d4dd522a72fb86d6fdec80aba001e9f21d2143f3ad9f8a528c397f668af174bdd30ab62320a7f6db40f
6
+ metadata.gz: 5ca7486f18d5816fff122992bf28cfedcd4ba7e1af0838e81abe4ccb716931674cd1fa3ca9166e7715ac977295096a899e5b0727b89aee1f2b28a633b67ccadf
7
+ data.tar.gz: 6d0155d8a1b3e45dc6680285fa9f8c3f4098e3ea30c9983f86346f8c1a6d45d886337c4876628230643b84ff046387b745773267322c4e22746a4383cc265f07
@@ -0,0 +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/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in google_timeline.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ google_timeline (1.0)
5
+ nokogiri (~> 1.6)
6
+ polylines (~> 0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ mini_portile2 (2.0.0)
12
+ nokogiri (1.6.7.2)
13
+ mini_portile2 (~> 2.0.0.rc2)
14
+ polylines (0.3.0)
15
+ rake (10.5.0)
16
+ rspec (0.9.4)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ bundler (~> 1.10)
23
+ google_timeline!
24
+ rake (~> 10.0)
25
+ rspec (~> 0)
26
+
27
+ BUNDLED WITH
28
+ 1.11.2
data/LICENSE.txt ADDED
@@ -0,0 +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.
data/README.md ADDED
@@ -0,0 +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
+ => {: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
+ => {: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
+ => {: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 ADDED
@@ -0,0 +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
@@ -0,0 +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", '~> 0'
37
+ end
@@ -1,3 +1,3 @@
1
1
  module GoogleTimeline
2
- VERSION = "1.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_timeline
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Surajit Khan
@@ -87,12 +87,18 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - CODE_OF_CONDUCT.md
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
90
96
  - bin/console
91
97
  - bin/setup
98
+ - google_timeline.gemspec
92
99
  - lib/google_timeline.rb
93
- - lib/google_timeline.rb~
94
100
  - lib/google_timeline/version.rb
95
- homepage: http://www.surajitkhan.in
101
+ homepage: https://github.com/surajit16/google_timeline
96
102
  licenses:
97
103
  - MIT
98
104
  metadata: {}
@@ -1,68 +0,0 @@
1
- require "google_timeline/version"
2
- require 'date'
3
- require 'nokogiri'
4
- require 'polylines'
5
-
6
- module GoogleTimeline
7
- def self.get_timeline_url(file_path,*args)
8
- url = nil
9
- home_location = [[12.899599, 77.650928]]
10
-
11
- if (args.empty?)==false and (args.select{|a| a.is_a?(Hash) and a[:home]}.first).nil? == false
12
- home_location = [args.select{|a| a.is_a?(Hash) and a[:home]}.first[:home]]
13
- end
14
-
15
- url=location_url(Polylines::Encoder.encode_points(home_location))
16
-
17
- value = file_path
18
- key = Date.parse(file_path.split("/").last.split(".").first.gsub("history-", "")) rescue nil
19
-
20
- if key.nil? == false and File.exists?(value)
21
- kml = File.read(value)
22
- doc = Nokogiri::XML(kml)
23
- coordinates = doc.search('//gx:coord').map{|c| c.content.split(" ")[0..1].map{|co| co.to_f}.reverse} rescue []
24
- location_str = Polylines::Encoder.encode_points(coordinates)
25
-
26
- if location_str.length < 1900
27
- url = location_url(location_str)
28
- else
29
- times = doc.search('when').map{|c| DateTime.parse(c.content)} rescue []
30
-
31
- coordinate_time_hash = {}
32
- times.each_with_index do |t, i|
33
- coordinate_time_hash[t] = coordinates[i]
34
- end
35
-
36
- interval = 10*60 #10min
37
- selected_coordinates = []
38
- prev_time = nil
39
- coordinate_time_hash.each do |k,v|
40
- if prev_time.nil?
41
- selected_coordinates << v
42
- prev_time = k
43
- else
44
- if (((k - prev_time) * 24 * 60 * 60).to_i >= interval)
45
- selected_coordinates << v
46
- prev_time = k
47
- end
48
- end
49
- end
50
- location_str = Polylines::Encoder.encode_points(selected_coordinates)
51
- url=location_url(location_str)
52
- end
53
- end
54
- return url
55
- end
56
-
57
- private_class_method :location_url
58
- private_class_method :test
59
- class << self
60
- def location_url(location_str)
61
- "http://maps.googleapis.com/maps/api/staticmap?scale=2&path=enc:#{location_str}&size=600x600&sensor=false"
62
- end
63
-
64
- def test
65
-
66
- end
67
- end
68
- end