finleap 0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 17dc8a19b8ef377e55abb89c000fc77014c4957e4d5c7a2342480a47007962c3
4
+ data.tar.gz: 3a7f96ab1f280f2ff3e56bdc54f8cb5f9500654f7fd264f9ace0803450e9f46c
5
+ SHA512:
6
+ metadata.gz: 0fc70f37a3a5e9a565f04a4a10110a61cfac056eefccaeb325db44c10f2091d8cd9f0594a0ec8c01a401c94677f5e27067a42984899f3ac2eae2ccd73ef37e44
7
+ data.tar.gz: 037d4dbca2e9cf53a60c6f59e092729f67f4a50fb670799a1ecbc55362e903a81a7cc46dcf804caa01568b4ab397f835f99e04b13c1443a2db75c10261cc1752
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .idea
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.6
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in finleap.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
@@ -0,0 +1,36 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ finleap (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.4.4)
10
+ geokit (1.13.1)
11
+ rake (12.3.3)
12
+ rspec (3.10.0)
13
+ rspec-core (~> 3.10.0)
14
+ rspec-expectations (~> 3.10.0)
15
+ rspec-mocks (~> 3.10.0)
16
+ rspec-core (3.10.0)
17
+ rspec-support (~> 3.10.0)
18
+ rspec-expectations (3.10.0)
19
+ diff-lcs (>= 1.2.0, < 2.0)
20
+ rspec-support (~> 3.10.0)
21
+ rspec-mocks (3.10.0)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.10.0)
24
+ rspec-support (3.10.0)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ finleap!
31
+ geokit
32
+ rake (~> 12.0)
33
+ rspec (~> 3.0)
34
+
35
+ BUNDLED WITH
36
+ 2.1.4
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 ahmdelemam
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.
@@ -0,0 +1,40 @@
1
+ # Finleap
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/finleap`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'finleap'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install finleap
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/finleap.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -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,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "finleap"
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(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ require_relative 'lib/finleap/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "finleap"
5
+ spec.version = Finleap::VERSION
6
+ spec.authors = ["ahmdelemam"]
7
+ spec.email = ["ahmdelemam@gmail.com"]
8
+
9
+ spec.summary = %q{finleap gem summary}
10
+ spec.description = %q{finleap gem description}
11
+ spec.homepage = "https://github.com/ahmdelemam/finleap"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.add_development_dependency 'rake'
16
+ spec.add_development_dependency 'rspec'
17
+ spec.add_development_dependency 'geokit'
18
+
19
+ spec.metadata["allowed_push_host"] = 'https://rubygems.org'
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = "https://github.com/ahmdelemam/finleap"
22
+ spec.metadata["changelog_uri"] = "https://github.com/ahmdelemam/finleap"
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+ end
@@ -0,0 +1,50 @@
1
+ {"user_id":3,"name":"Mary Pacocha III","latitude":54.0653745433511,"longitude":15.175624975930294}
2
+ {"user_id":16,"name":"Prof. Antoine Sporer","latitude":51.421974275443155,"longitude":15.027900973331768}
3
+ {"user_id":46,"name":"Nathaniel Dicki","latitude":53.46653195623577,"longitude":12.921807114520567}
4
+ {"user_id":4,"name":"Ernesto Breitenberg","latitude":52.94260786195436,"longitude":13.067312769068188}
5
+ {"user_id":21,"name":"Lynne Wyman Esq.","latitude":50.857002250862,"longitude":12.143492286341603}
6
+ {"user_id":15,"name":"Miss Donnell Ratke","latitude":52.66715146168367,"longitude":11.406289941511867}
7
+ {"user_id":19,"name":"Eldridge Funk DDS","latitude":52.147558277671415,"longitude":13.804602080070971}
8
+ {"user_id":48,"name":"Amb. Margit Becker","latitude":51.43977331981427,"longitude":12.860478835897862}
9
+ {"user_id":30,"name":"Candi Larkin","latitude":51.7136432343531,"longitude":13.53599402401951}
10
+ {"user_id":32,"name":"Dee Boyle","latitude":53.67112816981843,"longitude":12.569695447112338}
11
+ {"user_id":14,"name":"Burt Klein Esq.","latitude":53.1265734799671,"longitude":12.699384236532275}
12
+ {"user_id":9,"name":"Tristan Terry Jr.","latitude":53.403849444828786,"longitude":12.709597161512878}
13
+ {"user_id":44,"name":"Rayna Christiansen","latitude":53.835250578298705,"longitude":15.018285445352724}
14
+ {"user_id":5,"name":"Elias Kub","latitude":51.635830669959944,"longitude":15.138253412932762}
15
+ {"user_id":41,"name":"Janetta Cormier V","latitude":54.13356392673123,"longitude":14.407455117350175}
16
+ {"user_id":37,"name":"Walker Buckridge","latitude":54.14973768712443,"longitude":12.7621505584878}
17
+ {"user_id":6,"name":"Nolan Little","latitude":52.16209823311126,"longitude":13.543372863802071}
18
+ {"user_id":2,"name":"Carita Kohler","latitude":51.86688555137285,"longitude":14.759603422465172}
19
+ {"user_id":12,"name":"Lorette Gleason","latitude":53.41806359158846,"longitude":11.944653037543453}
20
+ {"user_id":24,"name":"Donnie Considine","latitude":51.18369533140573,"longitude":11.486628019912459}
21
+ {"user_id":43,"name":"Jeri Bauch","latitude":51.5762004329147,"longitude":14.662812233841269}
22
+ {"user_id":36,"name":"Kemberly Durgan DC","latitude":52.07953938789886,"longitude":14.480735257348044}
23
+ {"user_id":20,"name":"Max Buckridge Ret.","latitude":51.13272568038659,"longitude":11.933070215369076}
24
+ {"user_id":26,"name":"Dwayne Prohaska","latitude":52.30823850473702,"longitude":11.310504870043921}
25
+ {"user_id":49,"name":"Cole Predovic JD","latitude":52.817435894229774,"longitude":14.280626271845067}
26
+ {"user_id":45,"name":"Jeromy Price","latitude":51.936699922582626,"longitude":15.245332146317246}
27
+ {"user_id":1,"name":"Bennie Treutel","latitude":53.25788396101612,"longitude":11.332745459141405}
28
+ {"user_id":25,"name":"Maggie Trantow","latitude":53.10974927389135,"longitude":13.013782063005134}
29
+ {"user_id":7,"name":"Lauralee Collier","latitude":51.89047935210232,"longitude":11.630685739000857}
30
+ {"user_id":40,"name":"Rafael Streich IV","latitude":52.531792624998715,"longitude":12.177849950380875}
31
+ {"user_id":50,"name":"Felisha Langworth","latitude":54.24026633331586,"longitude":12.797958033380176}
32
+ {"user_id":29,"name":"Arden Kshlerin","latitude":52.61428145536312,"longitude":14.246534306873425}
33
+ {"user_id":23,"name":"Rev. Debora Dare","latitude":51.43798277533446,"longitude":12.183102125985119}
34
+ {"user_id":11,"name":"Willetta Connelly","latitude":51.756007492441945,"longitude":12.42257108878877}
35
+ {"user_id":18,"name":"Denice Bradtke","latitude":50.5776577838935,"longitude":14.98792913626352}
36
+ {"user_id":8,"name":"Dr. Rueben Kuhlman","latitude":53.527228131750654,"longitude":13.815282902417724}
37
+ {"user_id":27,"name":"Malcolm Jones","latitude":54.32104850198377,"longitude":14.99938478600761}
38
+ {"user_id":31,"name":"Rep. Jewel Gusikowski","latitude":53.951124965243615,"longitude":12.885600998846341}
39
+ {"user_id":39,"name":"Margarett Goldner","latitude":50.68274490480047,"longitude":14.202265774473997}
40
+ {"user_id":35,"name":"Blondell Hermiston","latitude":52.62033397021099,"longitude":14.716070229258861}
41
+ {"user_id":34,"name":"Ira Stracke","latitude":54.117915456556794,"longitude":12.685977781267926}
42
+ {"user_id":47,"name":"Daron Roob","latitude":53.00080278005686,"longitude":15.070548784991876}
43
+ {"user_id":42,"name":"Raymundo Schuster","latitude":52.677794195484154,"longitude":12.539436329812464}
44
+ {"user_id":33,"name":"Zofia Lehner","latitude":54.41472812453639,"longitude":14.06433253674736}
45
+ {"user_id":13,"name":"Sen. Floy Vandervort","latitude":51.46928075180481,"longitude":13.090637225614778}
46
+ {"user_id":38,"name":"Antonia Abernathy","latitude":50.54697265592242,"longitude":11.4369455897479}
47
+ {"user_id":28,"name":"Marcellus Upton","latitude":53.86056187581237,"longitude":13.67300348610971}
48
+ {"user_id":17,"name":"Bobby Howell","latitude":51.52445245941158,"longitude":13.556920295129643}
49
+ {"user_id":10,"name":"Dr. Isidra Grant","latitude":51.08144729440453,"longitude":13.560244567008514}
50
+ {"user_id":22,"name":"Robt Osinski","latitude":54.40558241539176,"longitude":11.910683608777205}
@@ -0,0 +1,8 @@
1
+ require "finleap/version"
2
+ require "finleap/customers/data"
3
+ require "finleap/customers/geo"
4
+
5
+ module Finleap
6
+ class Error < StandardError; end
7
+ # Your code goes here...
8
+ end
@@ -0,0 +1,14 @@
1
+ require 'json'
2
+
3
+ module Finleap
4
+ module Customers
5
+ class Data
6
+ def self.all
7
+ IO.foreach('fixtures/finleap-connect-customers.json').map do |row|
8
+ JSON.parse(row)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,22 @@
1
+ require 'geokit'
2
+
3
+ Geokit::default_units = :kms # others :kms, :nms, :meters
4
+
5
+ module Finleap
6
+ module Customers
7
+ class Geo
8
+ BERLIN_OFFICE_LAT = 52.508283
9
+ BERLIN_OFFICE_LONG = 13.329657
10
+
11
+ # distance_range default is 100 km
12
+ def self.in_range(distance_range = 100)
13
+ berlin_office = Geokit::LatLng.new(BERLIN_OFFICE_LAT, BERLIN_OFFICE_LONG)
14
+ Data.all.select do |customer|
15
+ destination = Geokit::LatLng.new(customer['latitude'], customer['longitude'])
16
+ berlin_office.distance_to(destination) <= distance_range
17
+ end.sort_by { |customer| customer['user_id'] }
18
+ end
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,3 @@
1
+ module Finleap
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: finleap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ahmdelemam
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-11-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: geokit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: finleap gem description
56
+ email:
57
+ - ahmdelemam@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - fineleap.gemspec
73
+ - fixtures/finleap-connect-customers.json
74
+ - lib/finleap.rb
75
+ - lib/finleap/customers/data.rb
76
+ - lib/finleap/customers/geo.rb
77
+ - lib/finleap/version.rb
78
+ homepage: https://github.com/ahmdelemam/finleap
79
+ licenses:
80
+ - MIT
81
+ metadata:
82
+ allowed_push_host: https://rubygems.org
83
+ homepage_uri: https://github.com/ahmdelemam/finleap
84
+ source_code_uri: https://github.com/ahmdelemam/finleap
85
+ changelog_uri: https://github.com/ahmdelemam/finleap
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 2.3.0
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubygems_version: 3.0.8
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: finleap gem summary
105
+ test_files: []