geolocation_service 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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +32 -0
- data/app/assets/config/geolocation_service_manifest.js +0 -0
- data/app/models/city.rb +14 -0
- data/app/models/country.rb +8 -0
- data/app/models/ip.rb +7 -0
- data/app/models/location.rb +4 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20190914074404_create_ips.rb +13 -0
- data/db/migrate/20190914081740_create_countries.rb +13 -0
- data/db/migrate/20190914090747_create_cities.rb +13 -0
- data/db/migrate/20190914092808_create_locations.rb +12 -0
- data/lib/geolocation_service.rb +13 -0
- data/lib/geolocation_service/contracts/bulk_data_contract.rb +13 -0
- data/lib/geolocation_service/contracts/city_contract.rb +9 -0
- data/lib/geolocation_service/contracts/country_contract.rb +9 -0
- data/lib/geolocation_service/contracts/ip_address_contract.rb +15 -0
- data/lib/geolocation_service/contracts/location_contract.rb +11 -0
- data/lib/geolocation_service/engine.rb +4 -0
- data/lib/geolocation_service/import_result.rb +15 -0
- data/lib/geolocation_service/services/base_service.rb +35 -0
- data/lib/geolocation_service/services/import_bulk_data_service.rb +143 -0
- data/lib/geolocation_service/structs.rb +69 -0
- data/lib/geolocation_service/version.rb +3 -0
- data/lib/tasks/geolocation_service_tasks.rake +4 -0
- metadata +307 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 83121b2e17c3649b2f5f070dda4749a3efd7724f0a33de35ad857b7676df7727
|
4
|
+
data.tar.gz: 97bacb951601c4a2faf7042b3db24381a602aa9d35347142b745b8d46f0544fe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eef1ce0a4df76d0a350e99b0297f7171a2e5b5fb9011798cabe982f33ec3373163239c91c7c12bd5de3c2799e9975c7f43ce0c2bf197d7e5ad9b6f435ee57747
|
7
|
+
data.tar.gz: f8611c216add9ee4ab34dc8eb0c70006f71142ef777517825da5456927d14aa4c07e00276961e81d90be81140edd94ce7ce4ff20125769d39fc3b7a40568aef4
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2019 Jalerson Lima
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# GeolocationService
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'geolocation_service'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install geolocation_service
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'GeolocationService'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task default: :test
|
File without changes
|
data/app/models/city.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
class City < ApplicationRecord
|
2
|
+
self.primary_key = :id
|
3
|
+
|
4
|
+
belongs_to :country, optional: true
|
5
|
+
has_many :locations, dependent: :destroy
|
6
|
+
has_many :ips, through: :locations
|
7
|
+
|
8
|
+
validates :name, presence: true
|
9
|
+
validates :name, uniqueness: {scope: :country, case_sensitive: false}
|
10
|
+
|
11
|
+
scope :search, -> (name:, country:) {
|
12
|
+
where('lower(name) = ? and country_id = ?', name.downcase, country.id)
|
13
|
+
}
|
14
|
+
end
|
data/app/models/ip.rb
ADDED
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateLocations < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :locations do |t|
|
4
|
+
t.decimal :latitude, precision: 10, scale: 6
|
5
|
+
t.decimal :longitude, precision: 10, scale: 6
|
6
|
+
t.references :ip, foreign_key: true
|
7
|
+
t.references :city, foreign_key: true
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "geolocation_service/engine"
|
2
|
+
require 'dry-initializer'
|
3
|
+
require 'dry-validation'
|
4
|
+
require 'dry/monads/result'
|
5
|
+
require 'dry/monads/try'
|
6
|
+
require 'zeitwerk'
|
7
|
+
|
8
|
+
loader = Zeitwerk::Loader.for_gem
|
9
|
+
loader.setup
|
10
|
+
|
11
|
+
module GeolocationService
|
12
|
+
Dry::Validation.load_extensions(:monads)
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module GeolocationService::Contracts
|
2
|
+
class BulkDataContract < Dry::Validation::Contract
|
3
|
+
params do
|
4
|
+
required(:file_path).filled(:string)
|
5
|
+
|
6
|
+
optional(:contracts).maybe(:filled?, :hash?)
|
7
|
+
end
|
8
|
+
|
9
|
+
rule(:file_path) do
|
10
|
+
key.failure('File not found') unless File.exist?(value)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module GeolocationService::Contracts
|
2
|
+
class IpAddressContract < Dry::Validation::Contract
|
3
|
+
params do
|
4
|
+
required(:address).filled(:string)
|
5
|
+
|
6
|
+
optional(:mystery_value).maybe(:filled?, :str?)
|
7
|
+
end
|
8
|
+
|
9
|
+
rule(:address) do
|
10
|
+
unless /^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$/.match?(value)
|
11
|
+
key.failure('Invalid IP address')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module GeolocationService::Contracts
|
2
|
+
class LocationContract < Dry::Validation::Contract
|
3
|
+
params do
|
4
|
+
required(:ip_id).filled(:int?)
|
5
|
+
|
6
|
+
optional(:latitude).maybe(:filled?, :decimal?)
|
7
|
+
optional(:longitude).maybe(:filled?, :decimal?)
|
8
|
+
optional(:city_id).maybe(:filled?, :int?)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module GeolocationService
|
2
|
+
class ImportResult
|
3
|
+
attr_reader :imported_records, :invalid_records, :time_consumed
|
4
|
+
|
5
|
+
def initialize(imported_records:, invalid_records:, time_consumed:)
|
6
|
+
@imported_records = imported_records
|
7
|
+
@invalid_records = invalid_records
|
8
|
+
@time_consumed = time_consumed
|
9
|
+
end
|
10
|
+
|
11
|
+
def imported_records_of(type)
|
12
|
+
@imported_records[type]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module GeolocationService::Services
|
2
|
+
class BaseService
|
3
|
+
extend Dry::Initializer
|
4
|
+
extend Dry::Monads::Try::Mixin
|
5
|
+
include Dry::Monads::Result::Mixin
|
6
|
+
|
7
|
+
def self.call(**args)
|
8
|
+
validate(contract, args).bind do |contract|
|
9
|
+
Try() do
|
10
|
+
self.new(**contract.to_h).call
|
11
|
+
end.to_result
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.validate(contract, args)
|
16
|
+
raise ArgumentError.new("missing contract or args") if contract.nil? || args.nil?
|
17
|
+
|
18
|
+
contract.call(args.to_h).to_monad
|
19
|
+
rescue => e
|
20
|
+
Dry::Monads::Failure(e)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.contract
|
24
|
+
unless defined?(self::Contract)
|
25
|
+
raise NotImplementedError.new("#{self.class.name} - doesnt have Contract")
|
26
|
+
end
|
27
|
+
|
28
|
+
self::Contract.new
|
29
|
+
end
|
30
|
+
|
31
|
+
def call
|
32
|
+
raise NotImplementedError
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module GeolocationService::Services
|
4
|
+
class ImportBulkDataService < BaseService
|
5
|
+
option :file_path
|
6
|
+
option :contracts, default: proc { DEFAULT_CONTRACTS }
|
7
|
+
|
8
|
+
Contract = GeolocationService::Contracts::BulkDataContract
|
9
|
+
Structs = GeolocationService::Structs
|
10
|
+
|
11
|
+
DEFAULT_CONTRACTS = {
|
12
|
+
ip: GeolocationService::Contracts::IpAddressContract.new,
|
13
|
+
location: GeolocationService::Contracts::LocationContract.new,
|
14
|
+
city: GeolocationService::Contracts::CityContract.new,
|
15
|
+
country: GeolocationService::Contracts::CountryContract.new
|
16
|
+
}.freeze
|
17
|
+
|
18
|
+
def call
|
19
|
+
start_time = Time.zone.now
|
20
|
+
load_existing_records
|
21
|
+
load_new_records
|
22
|
+
|
23
|
+
CSV.foreach(file_path, headers: :first_row) do |row|
|
24
|
+
ip = build_or_find_ip(row)
|
25
|
+
if ip.nil?
|
26
|
+
@invalid_records += 1
|
27
|
+
next
|
28
|
+
end
|
29
|
+
|
30
|
+
city = find_record(:city, row['city']&.downcase)
|
31
|
+
if city.nil?
|
32
|
+
country = find_or_build_country(row)
|
33
|
+
city = build_city(row, country)
|
34
|
+
end
|
35
|
+
|
36
|
+
build_location(row, ip, city)
|
37
|
+
end
|
38
|
+
|
39
|
+
bulk_save(@new_records[:ip].values, GeolocationService::Structs::IpStruct)
|
40
|
+
bulk_save(@new_records[:country].values, GeolocationService::Structs::CountryStruct)
|
41
|
+
bulk_save(@new_records[:city].values, GeolocationService::Structs::CityStruct)
|
42
|
+
bulk_save(@new_records[:location], GeolocationService::Structs::LocationStruct)
|
43
|
+
|
44
|
+
GeolocationService::ImportResult.new(
|
45
|
+
imported_records: {
|
46
|
+
ip: @ip_count,
|
47
|
+
city: @city_count,
|
48
|
+
country: @country_count,
|
49
|
+
location: @new_records[:location].count
|
50
|
+
},
|
51
|
+
invalid_records: @invalid_records,
|
52
|
+
time_consumed: (Time.zone.now - start_time)
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def build_or_find_ip(row)
|
59
|
+
return if row['ip_address'].blank?
|
60
|
+
|
61
|
+
existing_ip = find_record(:ip, row['ip_address'])
|
62
|
+
return existing_ip if existing_ip.present?
|
63
|
+
|
64
|
+
if validate(:ip, address: row['ip_address'], mystery_value: row['mystery_value']).success?
|
65
|
+
new_ip = Structs::IpStruct.new(@ip_count, row['ip_address'], row['mystery_value'])
|
66
|
+
@new_records[:ip][row['ip_address']] = new_ip
|
67
|
+
@ip_count += 1
|
68
|
+
return new_ip
|
69
|
+
end
|
70
|
+
|
71
|
+
nil
|
72
|
+
end
|
73
|
+
|
74
|
+
def build_city(row, country)
|
75
|
+
return if row['city'].blank?
|
76
|
+
|
77
|
+
if validate(:city, name: row['city'], country_code: country[:id]).success?
|
78
|
+
new_city = Structs::CityStruct.new(@city_count, row['city'], country[:id])
|
79
|
+
@new_records[:city][row['city'].downcase] = new_city
|
80
|
+
@city_count += 1
|
81
|
+
return new_city
|
82
|
+
end
|
83
|
+
|
84
|
+
nil
|
85
|
+
end
|
86
|
+
|
87
|
+
def find_or_build_country(row)
|
88
|
+
return if row['country_code'].blank?
|
89
|
+
|
90
|
+
existing_country = find_record(:country, row['country_code'])
|
91
|
+
return existing_country if existing_country.present?
|
92
|
+
|
93
|
+
if validate(:country, name: row['country'], code: row['country_code']).success?
|
94
|
+
new_country = Structs::CountryStruct.new(@country_count, row['country_code'], row['country'])
|
95
|
+
@new_records[:country][row['country_code']] = new_country
|
96
|
+
@country_count += 1
|
97
|
+
return new_country
|
98
|
+
end
|
99
|
+
|
100
|
+
nil
|
101
|
+
end
|
102
|
+
|
103
|
+
def build_location(row, ip, city)
|
104
|
+
if validate(:location, latitude: row['latitude']&.to_d, longitude: row['longitude']&.to_d, ip_id: ip&.id,
|
105
|
+
city_id: city&.id).success?
|
106
|
+
@new_records[:location] << Structs::LocationStruct.new(ip.id, row['latitude']&.to_d, row['longitude']&.to_d,
|
107
|
+
city&.id)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def load_existing_records
|
112
|
+
@existing_records = {
|
113
|
+
ip: Hash[Ip.all.collect { |ip| [ip.address, ip] }],
|
114
|
+
city: Hash[City.all.collect { |city| [city.name.downcase, city] }],
|
115
|
+
country: Hash[Country.all.collect { |country| [country.code.downcase, country] }]
|
116
|
+
}
|
117
|
+
end
|
118
|
+
|
119
|
+
def load_new_records
|
120
|
+
@ip_count = 0
|
121
|
+
@city_count = 0
|
122
|
+
@country_count = 0
|
123
|
+
@invalid_records = 0
|
124
|
+
@new_records = {ip: {}, location: [], city: {}, country: {}}
|
125
|
+
end
|
126
|
+
|
127
|
+
def find_record(type, key)
|
128
|
+
return if key.nil?
|
129
|
+
|
130
|
+
@existing_records[type][key] || @new_records[type][key]
|
131
|
+
end
|
132
|
+
|
133
|
+
def validate(type, **args)
|
134
|
+
contracts[type].call(args)
|
135
|
+
end
|
136
|
+
|
137
|
+
def bulk_save(all_records, struct, chunk: 1000)
|
138
|
+
all_records.each_slice(chunk) do |records|
|
139
|
+
ActiveRecord::Base.connection.execute(struct.insert_sql(records))
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module GeolocationService::Structs
|
2
|
+
IpStruct = Struct.new(:id, :address, :mystery_value) do
|
3
|
+
def to_sql(created_at)
|
4
|
+
if mystery_value.blank?
|
5
|
+
"(#{id}, '#{address}', NULL, '#{created_at}', '#{created_at}')"
|
6
|
+
else
|
7
|
+
"(#{id}, '#{address}', '#{mystery_value}', '#{created_at}', '#{created_at}')"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.insert_sql(ips)
|
12
|
+
created_at = DateTime.now.to_s(:db)
|
13
|
+
records = ips.map { |ip| ip.to_sql(created_at) }
|
14
|
+
|
15
|
+
"INSERT INTO ips (id, address, mystery_value, created_at, updated_at) VALUES #{records.join(', ')}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
CityStruct = Struct.new(:id, :name, :country_id) do
|
20
|
+
def to_sql(created_at)
|
21
|
+
if country_id.blank?
|
22
|
+
"(#{id}, \"#{name}\", NULL, '#{created_at}', '#{created_at}')"
|
23
|
+
else
|
24
|
+
"(#{id}, \"#{name}\", '#{country_id}', '#{created_at}', '#{created_at}')"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.insert_sql(cities)
|
29
|
+
created_at = DateTime.now.to_s(:db)
|
30
|
+
records = cities.map { |city| city.to_sql(created_at) }
|
31
|
+
|
32
|
+
"INSERT INTO cities (id, name, country_id, created_at, updated_at) VALUES #{records.join(', ')}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
CountryStruct = Struct.new(:id, :code, :name) do
|
37
|
+
def to_sql(created_at)
|
38
|
+
if name.blank?
|
39
|
+
"(#{id}, '#{code}', NULL, '#{created_at}', '#{created_at}')"
|
40
|
+
else
|
41
|
+
"(#{id}, '#{code}', \"#{name}\", '#{created_at}', '#{created_at}')"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.insert_sql(countries)
|
46
|
+
created_at = DateTime.now.to_s(:db)
|
47
|
+
records = countries.map { |country| country.to_sql(created_at) }
|
48
|
+
|
49
|
+
"INSERT INTO countries (id, code, name, created_at, updated_at) VALUES #{records.join(', ')}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
LocationStruct = Struct.new(:ip_id, :latitude, :longitude, :city_id) do
|
54
|
+
def to_sql(created_at)
|
55
|
+
sql = [ ip_id, latitude, longitude, city_id ]
|
56
|
+
.map { |v| v.presence || 'NULL' }
|
57
|
+
.join(', ')
|
58
|
+
|
59
|
+
"(#{sql}, '#{created_at}', '#{created_at}')"
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.insert_sql(locations)
|
63
|
+
created_at = DateTime.now.to_s(:db)
|
64
|
+
records = locations.map { |location| location.to_sql(created_at) }
|
65
|
+
|
66
|
+
"INSERT INTO locations (ip_id, latitude, longitude, city_id, created_at, updated_at) VALUES #{records.join(', ')}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
metadata
ADDED
@@ -0,0 +1,307 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: geolocation_service
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jalerson Lima
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.2.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.2.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 11.0.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 11.0.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mysql2
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.5.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.8.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.8.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: factory_bot_rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 5.0.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 5.0.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: faker
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.3.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.3.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: shoulda-matchers
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 4.1.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 4.1.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.74.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.74.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.35.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.35.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-performance
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.4.1
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.4.1
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 2.3.2
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 2.3.2
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: overcommit
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.49.1
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.49.1
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: dry-initializer
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 3.0.1
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 3.0.1
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: dry-monads
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 1.3.1
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 1.3.1
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: dry-transaction
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: 0.13.0
|
216
|
+
type: :runtime
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: 0.13.0
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: dry-validation
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - "~>"
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 1.3.0
|
230
|
+
type: :runtime
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - "~>"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 1.3.0
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: zeitwerk
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '1.3'
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "~>"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '1.3'
|
251
|
+
description: Geolocation importer service
|
252
|
+
email:
|
253
|
+
- jalerson@gmail.com
|
254
|
+
executables: []
|
255
|
+
extensions: []
|
256
|
+
extra_rdoc_files: []
|
257
|
+
files:
|
258
|
+
- MIT-LICENSE
|
259
|
+
- README.md
|
260
|
+
- Rakefile
|
261
|
+
- app/assets/config/geolocation_service_manifest.js
|
262
|
+
- app/models/city.rb
|
263
|
+
- app/models/country.rb
|
264
|
+
- app/models/ip.rb
|
265
|
+
- app/models/location.rb
|
266
|
+
- config/routes.rb
|
267
|
+
- db/migrate/20190914074404_create_ips.rb
|
268
|
+
- db/migrate/20190914081740_create_countries.rb
|
269
|
+
- db/migrate/20190914090747_create_cities.rb
|
270
|
+
- db/migrate/20190914092808_create_locations.rb
|
271
|
+
- lib/geolocation_service.rb
|
272
|
+
- lib/geolocation_service/contracts/bulk_data_contract.rb
|
273
|
+
- lib/geolocation_service/contracts/city_contract.rb
|
274
|
+
- lib/geolocation_service/contracts/country_contract.rb
|
275
|
+
- lib/geolocation_service/contracts/ip_address_contract.rb
|
276
|
+
- lib/geolocation_service/contracts/location_contract.rb
|
277
|
+
- lib/geolocation_service/engine.rb
|
278
|
+
- lib/geolocation_service/import_result.rb
|
279
|
+
- lib/geolocation_service/services/base_service.rb
|
280
|
+
- lib/geolocation_service/services/import_bulk_data_service.rb
|
281
|
+
- lib/geolocation_service/structs.rb
|
282
|
+
- lib/geolocation_service/version.rb
|
283
|
+
- lib/tasks/geolocation_service_tasks.rake
|
284
|
+
homepage: https://www.github.com/jalerson/geolocation_service
|
285
|
+
licenses:
|
286
|
+
- MIT
|
287
|
+
metadata: {}
|
288
|
+
post_install_message:
|
289
|
+
rdoc_options: []
|
290
|
+
require_paths:
|
291
|
+
- lib
|
292
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
293
|
+
requirements:
|
294
|
+
- - ">="
|
295
|
+
- !ruby/object:Gem::Version
|
296
|
+
version: '0'
|
297
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
298
|
+
requirements:
|
299
|
+
- - ">="
|
300
|
+
- !ruby/object:Gem::Version
|
301
|
+
version: '0'
|
302
|
+
requirements: []
|
303
|
+
rubygems_version: 3.0.1
|
304
|
+
signing_key:
|
305
|
+
specification_version: 4
|
306
|
+
summary: FindHotel coding challenge
|
307
|
+
test_files: []
|