rad_core_rails 0.5.0 → 0.7.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 +4 -4
- data/.gitignore +17 -15
- data/.rubocop.yml +4 -0
- data/Gemfile +13 -6
- data/README.md +104 -44
- data/Rakefile +11 -6
- data/lib/generators/rad_core_rails/templates/migration.rb.tt +17 -0
- data/lib/generators/rad_core_rails/zip_codes_migration_generator.rb +18 -0
- data/lib/rad_core_rails.rb +18 -14
- data/lib/rad_core_rails/query_generator.rb +277 -167
- data/lib/rad_core_rails/railtie.rb +7 -0
- data/lib/rad_core_rails/version.rb +5 -5
- data/lib/rad_core_rails/zip_code.rb +54 -0
- data/lib/rad_core_rails/zip_importer.rb +43 -0
- data/lib/resources/us_zip_codes.json +102 -0
- data/lib/tasks/rad_core_rails.rake +14 -0
- data/rad_core_rails.gemspec +44 -39
- metadata +69 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c80461bc2b08411eb1989bbda0e49d9cb47e73fbcd3b959c569742dd75f3342
|
4
|
+
data.tar.gz: 7df243406dd934723cf34c117475b3384a0bd237486d390236ea0e9215671234
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e2f659480bbf9fe6b5eedbeb4a8c007c7877ee572709334a63441bbaeefd6f28488712010532eb7edb086028ad62714568b222a95f293ad387416917b05b098
|
7
|
+
data.tar.gz: 9e3071cd56281bb7f2dcbd22a1c5ff0d106803233f6e537ea5c5f600ae0432bf18edfd99ea136a80aea6290114b6eefb76afbd7e7ba031c03ed104b041575ad0
|
data/.gitignore
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
/.idea/
|
2
|
-
/.bundle/
|
3
|
-
/.yardoc
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
10
|
-
Gemfile.lock
|
11
|
-
bin
|
12
|
-
*.gem
|
13
|
-
.rspec_status
|
14
|
-
.ruby-gemset
|
15
|
-
.ruby-version
|
1
|
+
/.idea/
|
2
|
+
/.bundle/
|
3
|
+
/.yardoc
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
Gemfile.lock
|
11
|
+
/bin/
|
12
|
+
*.gem
|
13
|
+
.rspec_status
|
14
|
+
.ruby-gemset
|
15
|
+
.ruby-version
|
16
|
+
/.byebug_history
|
17
|
+
.robocop.yml
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in new_gem.gemspec
|
6
|
-
gemspec
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in new_gem.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :test do
|
9
|
+
gem 'byebug'
|
10
|
+
gem 'pg'
|
11
|
+
gem 'database_cleaner-active_record'
|
12
|
+
gem "factory_bot_rails"
|
13
|
+
end
|
data/README.md
CHANGED
@@ -1,44 +1,104 @@
|
|
1
|
-
# RadCoreRails
|
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/rad_core_rails`. 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 'rad_core_rails'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle install
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install rad_core_rails
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
1
|
+
# RadCoreRails
|
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/rad_core_rails`. 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 'rad_core_rails'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rad_core_rails
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
For basic functionality just include `RadCoreRails` to your `ActiveRecord` model.
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
class Job < ActiveRecord::Base
|
29
|
+
include RadCoreRails
|
30
|
+
...
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
For using Zip Codes by Radius filter follow the steps below:
|
35
|
+
|
36
|
+
Step 1 - generate migration:
|
37
|
+
|
38
|
+
```shell script
|
39
|
+
rails generate rad_core_rails:zip_codes_migration
|
40
|
+
```
|
41
|
+
|
42
|
+
Step 2 - migrate DB:
|
43
|
+
|
44
|
+
```shell script
|
45
|
+
rails db:migrate
|
46
|
+
```
|
47
|
+
|
48
|
+
Step 3 - import all US zip-codes to your DB:
|
49
|
+
> this gem has built in JSON file with all US zip-codes
|
50
|
+
|
51
|
+
```shell script
|
52
|
+
rails rad_core_rails:import_zip_codes
|
53
|
+
```
|
54
|
+
|
55
|
+
Step 4 - add new filter to `filter_manifest` method like on example:
|
56
|
+
|
57
|
+
> OLD Syntax
|
58
|
+
```ruby
|
59
|
+
class Job < ActiveRecord::Base
|
60
|
+
include RadCoreRails
|
61
|
+
|
62
|
+
def self.filter_manifest
|
63
|
+
{
|
64
|
+
zip_codes: ->(filter) { generate_zip_codes_clauses('addresses.zip', filter) }
|
65
|
+
}.with_indifferent_access
|
66
|
+
end
|
67
|
+
end
|
68
|
+
```
|
69
|
+
|
70
|
+
> NEW Syntax starting from v0.7.0
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
class Job < ActiveRecord::Base
|
74
|
+
include RadCoreRails
|
75
|
+
|
76
|
+
filterable zip_codes: [:zip_codes, 'addresses.zip']
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
Step 5 - filter params example
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
{ key: 'zip_codes', option: '15', values: ['85001'] }
|
84
|
+
```
|
85
|
+
|
86
|
+
|
87
|
+
## Development
|
88
|
+
|
89
|
+
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.
|
90
|
+
|
91
|
+
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).
|
92
|
+
|
93
|
+
## Contributing
|
94
|
+
|
95
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rad_core_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rad_core_rails/blob/master/CODE_OF_CONDUCT.md).
|
96
|
+
|
97
|
+
|
98
|
+
## License
|
99
|
+
|
100
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
101
|
+
|
102
|
+
## Code of Conduct
|
103
|
+
|
104
|
+
Everyone interacting in the RadCoreRails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rad_core_rails/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require './support/active_record_rake_tasks'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task :default => :spec
|
8
|
+
|
9
|
+
# Stub the :environment task for tasks like db:migrate & db:seed. Since this is a Gem we've explicitly required all
|
10
|
+
# dependent files in the needed places and we don't have to load the entire environment.
|
11
|
+
task :environment
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
create_table :zip_codes do |t|
|
4
|
+
t.string :city
|
5
|
+
t.string :state
|
6
|
+
t.string :zip
|
7
|
+
t.decimal :latitude, precision: 10, scale: 6
|
8
|
+
t.decimal :longitude, precision: 10, scale: 6
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :zip_codes, :zip, unique: true
|
14
|
+
add_index :zip_codes, :latitude, unique: true
|
15
|
+
add_index :zip_codes, :longitude, unique: true
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "rails/generators/active_record"
|
2
|
+
|
3
|
+
module RadCoreRails
|
4
|
+
module Generators
|
5
|
+
class ZipCodesMigrationGenerator < Rails::Generators::Base
|
6
|
+
include ActiveRecord::Generators::Migration
|
7
|
+
source_root File.join(__dir__, "templates")
|
8
|
+
|
9
|
+
def copy_migration
|
10
|
+
migration_template "migration.rb", "db/migrate/create_zip_codes.rb", migration_version: migration_version
|
11
|
+
end
|
12
|
+
|
13
|
+
def migration_version
|
14
|
+
"[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/rad_core_rails.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
-
|
2
|
-
require "
|
3
|
-
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
# Need some refactoring: https://ankane.org/gem-patterns
|
2
|
+
require "active_record"
|
3
|
+
|
4
|
+
require "rad_core_rails/railtie" if defined?(Rails)
|
5
|
+
require "rad_core_rails/version"
|
6
|
+
require "rad_core_rails/query_generator"
|
7
|
+
require "rad_core_rails/search_terms"
|
8
|
+
require "rad_core_rails/sortable"
|
9
|
+
|
10
|
+
module RadCoreRails
|
11
|
+
autoload :ZipCode, 'rad_core_rails/zip_code'
|
12
|
+
|
13
|
+
def self.included(receiver)
|
14
|
+
receiver.send :include, Sortable, SearchTerms, QueryGenerator
|
15
|
+
end
|
16
|
+
|
17
|
+
class Error < StandardError; end
|
18
|
+
end
|
@@ -1,167 +1,277 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RadCoreRails
|
4
|
-
module QueryGenerator
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
class_methods do
|
8
|
-
attr_reader :searchable_columns
|
9
|
-
|
10
|
-
def searchable(columns = [])
|
11
|
-
@searchable_columns = handle_columns(columns)
|
12
|
-
end
|
13
|
-
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
#
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
[
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
end
|
165
|
-
|
166
|
-
|
167
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RadCoreRails
|
4
|
+
module QueryGenerator
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
class_methods do
|
8
|
+
attr_reader :searchable_columns
|
9
|
+
|
10
|
+
def searchable(columns = [])
|
11
|
+
@searchable_columns = handle_columns(columns)
|
12
|
+
end
|
13
|
+
|
14
|
+
def filterable(filters_data = [])
|
15
|
+
@filter_manifest = handle_filterable(filters_data)
|
16
|
+
end
|
17
|
+
|
18
|
+
def joins_clause
|
19
|
+
<<-SQL
|
20
|
+
SQL
|
21
|
+
end
|
22
|
+
|
23
|
+
def filter_manifest
|
24
|
+
@filter_manifest || {}.with_indifferent_access
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_filters(search, filters)
|
28
|
+
query = []
|
29
|
+
args = []
|
30
|
+
clause, arguments = generate_search_clause(search)
|
31
|
+
query << clause
|
32
|
+
arguments.each do |arg|
|
33
|
+
args << arg
|
34
|
+
end
|
35
|
+
filters.map do |filter|
|
36
|
+
begin
|
37
|
+
clause, arguments = filter_manifest[filter[:key]].call(filter)
|
38
|
+
query << clause
|
39
|
+
arguments.each do |arg|
|
40
|
+
args << arg
|
41
|
+
end
|
42
|
+
rescue NoMethodError
|
43
|
+
raise NoMethodError.new("Filter with the name `#{filter[:key]}` doesn't exist.")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
[query.reject(&:blank?).join(' AND '), args]
|
47
|
+
end
|
48
|
+
|
49
|
+
# def generate_search_clause(search)
|
50
|
+
# and_args = []
|
51
|
+
# or_args = []
|
52
|
+
# if search.present? && searchable_columns.is_a?(Array)
|
53
|
+
# # search_term_size = search.split(' ').length
|
54
|
+
# and_terms = search.split(' ').select { |term| !term.include?('+') }
|
55
|
+
# or_terms = search.split(' ').select { |term| term.include?('+') }
|
56
|
+
# and_columns = []
|
57
|
+
# or_columns = []
|
58
|
+
# # just_ors = search_term_size == or_term_size
|
59
|
+
# # operand = just_ors ? 'OR' : 'AND'
|
60
|
+
# # search_terms = just_ors == true ? search.split(' ') : search.split(' ').select { |term| !term.include?('+') }
|
61
|
+
# and_terms.each do |term|
|
62
|
+
# columns = []
|
63
|
+
# and_terms.each do |col|
|
64
|
+
# and_columns.push("(LOWER(#{col}) ILIKE ?)")
|
65
|
+
# and_args.push '%' + term.downcase.strip + '%'
|
66
|
+
# end
|
67
|
+
# or_terms.each do |col|
|
68
|
+
# columns.push("(LOWER(#{col}) ILIKE ?)")
|
69
|
+
# or_args.push '%' + term[1, term.length].downcase.strip + '%'
|
70
|
+
# end
|
71
|
+
# clause = if or_columns.empty?
|
72
|
+
# '(' + and_columns.join(' OR ') + ')'
|
73
|
+
# else
|
74
|
+
# '(' + '(' + and_columns.join(' OR ') + ')' + 'AND' + '(' + or_columns.join(' OR ') + ')' + ')'
|
75
|
+
# end
|
76
|
+
# end
|
77
|
+
# [clause, and_args + or_args]
|
78
|
+
# else
|
79
|
+
# ['', []]
|
80
|
+
# end
|
81
|
+
# end
|
82
|
+
|
83
|
+
# @searchable_columns, is an array of column names that you can compare to your terms.
|
84
|
+
#
|
85
|
+
def generate_search_clause(search)
|
86
|
+
if search.present? && searchable_columns.is_a?(Array)
|
87
|
+
# holds all of the sql from sanitized_and_terms
|
88
|
+
and_args = []
|
89
|
+
# holds all the table columns sql for all the AND terms
|
90
|
+
and_clause = []
|
91
|
+
# holds all of the sql from sanitized_or_terms
|
92
|
+
or_args = []
|
93
|
+
# holds all the table columns sql for all the OR terms
|
94
|
+
or_clause = []
|
95
|
+
# extract and terms, remove casing, and add ILIKE '%' comparisions
|
96
|
+
sanitized_and_terms = search.split(' ')
|
97
|
+
.reject { |term| term.include?('+') }
|
98
|
+
.map { |term| '%' + term.downcase.strip + '%' }
|
99
|
+
# extract or terms, remove casing, and add ILIKE '%' comparisions
|
100
|
+
sanitized_or_terms = search.split(' ')
|
101
|
+
.select { |term| term.include?('+') }
|
102
|
+
.map { |term| '%' + term[1, term.length].downcase.strip + '%' }
|
103
|
+
# loop through sanitized_and_terms to find all possible columns.
|
104
|
+
sanitized_and_terms.each do |sanitized_term|
|
105
|
+
columns = []
|
106
|
+
# all possible columns where this should be searched
|
107
|
+
searchable_columns.each do |col|
|
108
|
+
columns.push("(LOWER(#{col}) ILIKE ?)")
|
109
|
+
and_args.push sanitized_term
|
110
|
+
end
|
111
|
+
and_clause.push '(' + columns.join(' OR ') + ')'
|
112
|
+
end
|
113
|
+
# loop through sanitized_or_terms to find all possible columns.
|
114
|
+
sanitized_or_terms.each do |sanitized_term|
|
115
|
+
columns = []
|
116
|
+
# all possible columns where this should be searched
|
117
|
+
searchable_columns.each do |col|
|
118
|
+
columns.push("(LOWER(#{col}) ILIKE ?)")
|
119
|
+
or_args.push sanitized_term
|
120
|
+
end
|
121
|
+
or_clause.push '(' + columns.join(' OR ') + ')'
|
122
|
+
end
|
123
|
+
if or_clause.empty? && and_clause.empty?
|
124
|
+
['', []]
|
125
|
+
elsif or_clause.empty?
|
126
|
+
['(' + and_clause.join(' AND ') + ')', and_args]
|
127
|
+
elsif and_clause.empty?
|
128
|
+
['(' + or_clause.join(' OR ') + ')', or_args]
|
129
|
+
else
|
130
|
+
['((' + and_clause.join(' AND ') + ') AND (' + or_clause.join(' OR ') + '))', and_args + or_args]
|
131
|
+
end
|
132
|
+
else
|
133
|
+
['', []]
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# Generate Boolean clause
|
138
|
+
def generate_boolean_clause(column_name, filter)
|
139
|
+
str = "#{column_name} = ?"
|
140
|
+
args = []
|
141
|
+
args << filter[:values][0]
|
142
|
+
|
143
|
+
[str, args]
|
144
|
+
end
|
145
|
+
|
146
|
+
def generate_model_clause(column_name, filter, optional_exclusion_clause = nil)
|
147
|
+
str = if optional_exclusion_clause.present? && filter[:option] == '!='
|
148
|
+
optional_exclusion_clause
|
149
|
+
else
|
150
|
+
# probably should fix this.
|
151
|
+
# somtimes we arent sending a filter option, so just default it to =
|
152
|
+
"(#{column_name} #{filter[:option] || '='} ANY(ARRAY[?]))"
|
153
|
+
end
|
154
|
+
args = [filter[:values]]
|
155
|
+
|
156
|
+
[str, args]
|
157
|
+
end
|
158
|
+
|
159
|
+
def generate_zip_codes_clause(column_name, filter)
|
160
|
+
str = "(#{column_name} = ANY(#{zip_code_class.distance_query}))"
|
161
|
+
args = zip_code_class.distance_args(filter)
|
162
|
+
|
163
|
+
[str, args]
|
164
|
+
end
|
165
|
+
|
166
|
+
def generate_array_clause(column_name, filter)
|
167
|
+
str = "(#{column_name} && ARRAY[?])"
|
168
|
+
args = [filter[:values]]
|
169
|
+
|
170
|
+
[str, args]
|
171
|
+
end
|
172
|
+
|
173
|
+
def generate_reference_link_clause(link_out_type, filter)
|
174
|
+
str = "(reference_links.link_out_type = '#{link_out_type}' AND reference_links.link_out_id = ANY(?))"
|
175
|
+
args = [filter[:values]]
|
176
|
+
|
177
|
+
[str, args]
|
178
|
+
end
|
179
|
+
|
180
|
+
def generate_jsonb_array_clause(unique_filter_key, column_name, filter)
|
181
|
+
str = "(#{column_name} ?| ARRAY[:#{unique_filter_key}])"
|
182
|
+
args = [{ "#{unique_filter_key}": filter[:values] }]
|
183
|
+
|
184
|
+
[str, args]
|
185
|
+
end
|
186
|
+
|
187
|
+
def generate_number_clause(column_name, filter)
|
188
|
+
option = filter[:option]
|
189
|
+
values = filter[:values]
|
190
|
+
str = ''
|
191
|
+
args = []
|
192
|
+
|
193
|
+
case option
|
194
|
+
when '='
|
195
|
+
str = "#{column_name} = ?"
|
196
|
+
args << values[0]
|
197
|
+
when '>'
|
198
|
+
str = "#{column_name} > ?"
|
199
|
+
args << values[0]
|
200
|
+
when '<'
|
201
|
+
str = "#{column_name} < ?"
|
202
|
+
args << values[0]
|
203
|
+
when '..'
|
204
|
+
str = "(#{column_name} BETWEEN ? AND ?)"
|
205
|
+
args << values[0]
|
206
|
+
args << values[1]
|
207
|
+
end
|
208
|
+
[str, args]
|
209
|
+
end
|
210
|
+
|
211
|
+
def generate_date_clause(column_name, filter)
|
212
|
+
option = filter[:option]
|
213
|
+
values = filter[:values]
|
214
|
+
str = ''
|
215
|
+
args = []
|
216
|
+
|
217
|
+
case option
|
218
|
+
when '='
|
219
|
+
str = "#{column_name}::date = ?::date"
|
220
|
+
args << values[0]
|
221
|
+
when '>'
|
222
|
+
str = "#{column_name}::date > ?::date"
|
223
|
+
args << values[0]
|
224
|
+
when '<'
|
225
|
+
str = "#{column_name}::date < ?::date"
|
226
|
+
args << values[0]
|
227
|
+
when '..'
|
228
|
+
str = "(#{column_name}::date BETWEEN ?::date AND ?::date)"
|
229
|
+
args << values[0]
|
230
|
+
args << values[1]
|
231
|
+
end
|
232
|
+
[str, args]
|
233
|
+
end
|
234
|
+
|
235
|
+
def sort_direction(direction)
|
236
|
+
direction == 'asc' ? 'ASC' : 'DESC'
|
237
|
+
end
|
238
|
+
|
239
|
+
private
|
240
|
+
|
241
|
+
def handle_columns(columns)
|
242
|
+
return self.columns.select { |c| c.type == :string }.map { |c| "#{table_name}.#{c.name}" } if columns.empty?
|
243
|
+
|
244
|
+
columns.map do |c|
|
245
|
+
splitted_c = c.split('.')
|
246
|
+
|
247
|
+
if splitted_c.size == 1 && splitted_c.first != table_name
|
248
|
+
"#{table_name}.#{c}"
|
249
|
+
else
|
250
|
+
c
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def handle_filterable(filters_data)
|
256
|
+
return nil if filters_data.empty?
|
257
|
+
@zip_code_class = filters_data.delete(:zip_code_class)
|
258
|
+
|
259
|
+
result = {}
|
260
|
+
|
261
|
+
filters_data.each do |filter_data|
|
262
|
+
filter_type, filter_column = filter_data.last
|
263
|
+
result[filter_data.first] = lambda { |filter|
|
264
|
+
public_send("generate_#{filter_type}_clause", filter_column, filter)
|
265
|
+
}
|
266
|
+
end
|
267
|
+
|
268
|
+
result.with_indifferent_access
|
269
|
+
end
|
270
|
+
|
271
|
+
def zip_code_class
|
272
|
+
return RadCoreRails::ZipCode unless @zip_code_class
|
273
|
+
@zip_code_class.to_s.constantize
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RadCoreRails
|
4
|
-
VERSION = '0.
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RadCoreRails
|
4
|
+
VERSION = '0.7.0'
|
5
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module RadCoreRails
|
2
|
+
class ZipCode < ActiveRecord::Base
|
3
|
+
self.table_name = 'zip_codes'
|
4
|
+
|
5
|
+
validates_presence_of :city, :state, :zip, :latitude, :longitude
|
6
|
+
|
7
|
+
class << self
|
8
|
+
# Query for returning a one latitude for given zip-code
|
9
|
+
def lat_sub_query
|
10
|
+
<<-SQL
|
11
|
+
SELECT zip_codes.latitude
|
12
|
+
FROM zip_codes
|
13
|
+
WHERE zip = ?
|
14
|
+
LIMIT 1
|
15
|
+
SQL
|
16
|
+
end
|
17
|
+
|
18
|
+
# Query for returning a one longitude value for given zip-code
|
19
|
+
def lng_sub_query
|
20
|
+
<<-SQL
|
21
|
+
SELECT zip_codes.longitude
|
22
|
+
FROM zip_codes
|
23
|
+
WHERE zip = ?
|
24
|
+
LIMIT 1
|
25
|
+
SQL
|
26
|
+
end
|
27
|
+
|
28
|
+
# Query for returning an array of zip codes around the zip-code sent to this function with a given radius in miles.
|
29
|
+
def distance_query
|
30
|
+
<<-SQL
|
31
|
+
WITH t AS (SELECT
|
32
|
+
zip, (
|
33
|
+
3959 * acos (
|
34
|
+
cos(RADIANS((#{lat_sub_query})))
|
35
|
+
* cos(RADIANS(zip_codes.latitude))
|
36
|
+
* cos(RADIANS(zip_codes.longitude) - RADIANS((#{lng_sub_query})))
|
37
|
+
+ sin(RADIANS((#{lat_sub_query})))
|
38
|
+
* sin(RADIANS(zip_codes.latitude))
|
39
|
+
)
|
40
|
+
) AS distance
|
41
|
+
FROM zip_codes) SELECT t.zip FROM t WHERE t.distance < ?
|
42
|
+
SQL
|
43
|
+
end
|
44
|
+
|
45
|
+
# Query arguments for the `distance_query` based on passed filter params.
|
46
|
+
def distance_args(filter)
|
47
|
+
zip_value = filter[:values].try(:first) || ''
|
48
|
+
distance_miles = filter[:option] || 0
|
49
|
+
|
50
|
+
[zip_value, zip_value, zip_value, distance_miles]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "rad_core_rails/zip_code"
|
2
|
+
|
3
|
+
module RadCoreRails
|
4
|
+
class ZipImporter
|
5
|
+
attr_reader :file_path, :zip_codes_data
|
6
|
+
|
7
|
+
def initialize(file_path)
|
8
|
+
@file_path = file_path
|
9
|
+
end
|
10
|
+
|
11
|
+
def call
|
12
|
+
puts "Parsing file..."
|
13
|
+
parse_data
|
14
|
+
puts "Parsing completed."
|
15
|
+
|
16
|
+
puts "Importing data..."
|
17
|
+
import_data!
|
18
|
+
puts "Successfully imported!"
|
19
|
+
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def import_data!
|
26
|
+
zip_codes_data.each do |zip_code_data|
|
27
|
+
fields = zip_code_data["fields"]
|
28
|
+
|
29
|
+
RadCoreRails::ZipCode.find_or_create_by!(
|
30
|
+
city: fields["city"].to_s,
|
31
|
+
state: fields["state"].to_s,
|
32
|
+
zip: fields["zip"].to_s,
|
33
|
+
latitude: fields["latitude"].to_s,
|
34
|
+
longitude: fields["longitude"].to_s
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def parse_data
|
40
|
+
@zip_codes_data = JSON.parse(IO.read(file_path))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"datasetid": "us-zip-code-latitude-and-longitude",
|
4
|
+
"recordid": "9656735f9d9c7b64eae1f3f19c263b9598e057de",
|
5
|
+
"fields":
|
6
|
+
{
|
7
|
+
"city": "Eudora",
|
8
|
+
"zip": "66025",
|
9
|
+
"dst": 1,
|
10
|
+
"geopoint": [
|
11
|
+
38.917032, -95.06455
|
12
|
+
],
|
13
|
+
"longitude": -95.06455,
|
14
|
+
"state": "KS",
|
15
|
+
"latitude": 38.917032,
|
16
|
+
"timezone": -6
|
17
|
+
},
|
18
|
+
"geometry":
|
19
|
+
{
|
20
|
+
"type": "Point",
|
21
|
+
"coordinates": [
|
22
|
+
-95.06455, 38.917032
|
23
|
+
]
|
24
|
+
},
|
25
|
+
"record_timestamp": "2018-02-09T18:33:38.603+02:00"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"datasetid": "us-zip-code-latitude-and-longitude",
|
29
|
+
"recordid": "d4fd79372fc6ba5d7205ff4a430b0dcbe0c7dbbd",
|
30
|
+
"fields":
|
31
|
+
{
|
32
|
+
"city": "Savanna",
|
33
|
+
"zip": "74565",
|
34
|
+
"dst": 1,
|
35
|
+
"geopoint": [
|
36
|
+
34.831398, -95.83967
|
37
|
+
],
|
38
|
+
"longitude": -95.83967,
|
39
|
+
"state": "OK",
|
40
|
+
"latitude": 34.831398,
|
41
|
+
"timezone": -6
|
42
|
+
},
|
43
|
+
"geometry":
|
44
|
+
{
|
45
|
+
"type": "Point",
|
46
|
+
"coordinates": [
|
47
|
+
-95.83967, 34.831398
|
48
|
+
]
|
49
|
+
},
|
50
|
+
"record_timestamp": "2018-02-09T18:33:38.603+02:00"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"datasetid": "us-zip-code-latitude-and-longitude",
|
54
|
+
"recordid": "66439c8a6e1286118738eae874a5b0d1ef4dd249",
|
55
|
+
"fields":
|
56
|
+
{
|
57
|
+
"city": "Beckville",
|
58
|
+
"zip": "75631",
|
59
|
+
"dst": 1,
|
60
|
+
"geopoint": [
|
61
|
+
32.237924, -94.46427
|
62
|
+
],
|
63
|
+
"longitude": -94.46427,
|
64
|
+
"state": "TX",
|
65
|
+
"latitude": 32.237924,
|
66
|
+
"timezone": -6
|
67
|
+
},
|
68
|
+
"geometry":
|
69
|
+
{
|
70
|
+
"type": "Point",
|
71
|
+
"coordinates": [
|
72
|
+
-94.46427, 32.237924
|
73
|
+
]
|
74
|
+
},
|
75
|
+
"record_timestamp": "2018-02-09T18:33:38.603+02:00"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"datasetid": "us-zip-code-latitude-and-longitude",
|
79
|
+
"recordid": "0721c46587455339063b0b8e58766ddddfc2d83a",
|
80
|
+
"fields":
|
81
|
+
{
|
82
|
+
"city": "Rancho Santa Fe",
|
83
|
+
"zip": "92067",
|
84
|
+
"dst": 1,
|
85
|
+
"geopoint": [
|
86
|
+
33.016492, -117.20264
|
87
|
+
],
|
88
|
+
"longitude": -117.20264,
|
89
|
+
"state": "CA",
|
90
|
+
"latitude": 33.016492,
|
91
|
+
"timezone": -8
|
92
|
+
},
|
93
|
+
"geometry":
|
94
|
+
{
|
95
|
+
"type": "Point",
|
96
|
+
"coordinates": [
|
97
|
+
-117.20264, 33.016492
|
98
|
+
]
|
99
|
+
},
|
100
|
+
"record_timestamp": "2018-02-09T18:33:38.603+02:00"
|
101
|
+
}
|
102
|
+
]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "rad_core_rails/zip_importer"
|
2
|
+
|
3
|
+
namespace :rad_core_rails do
|
4
|
+
desc "Import zip codes data from file"
|
5
|
+
task :import_zip_codes, [:file_path] => [:environment] do |task, args|
|
6
|
+
file_path = args[:file_path] || "#{File.dirname __dir__}/resources/us_zip_codes.json"
|
7
|
+
|
8
|
+
unless ActiveRecord::Base.connection.table_exists? "zip_codes"
|
9
|
+
abort "Table `zip_codes` doesn't exist. Run `rails generate rad_core_rails:zip_codes_migration`"
|
10
|
+
end
|
11
|
+
|
12
|
+
RadCoreRails::ZipImporter.new(file_path).call
|
13
|
+
end
|
14
|
+
end
|
data/rad_core_rails.gemspec
CHANGED
@@ -1,39 +1,44 @@
|
|
1
|
-
require_relative 'lib/rad_core_rails/version'
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = "rad_core_rails"
|
5
|
-
spec.version = RadCoreRails::VERSION
|
6
|
-
spec.authors = ["Oleksandr Poltavets, James Marrs"]
|
7
|
-
spec.email = ["sancho.ck@gmail.com"]
|
8
|
-
|
9
|
-
spec.summary = %q{RadCoreRails}
|
10
|
-
spec.description = %q{RadCoreRails lib}
|
11
|
-
spec.homepage = "https://github.com/jamesmarrs/rad-core-rails"
|
12
|
-
spec.license = "MIT"
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
-
|
15
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
16
|
-
|
17
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] = "https://rubygems.org/gems/rad_core_rails"
|
19
|
-
spec.metadata["changelog_uri"] = "https://rubygems.org/gems/rad_core_rails"
|
20
|
-
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
-
end
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
spec.add_dependency "
|
31
|
-
spec.add_dependency "
|
32
|
-
spec.add_dependency "
|
33
|
-
|
34
|
-
|
35
|
-
spec.add_development_dependency "
|
36
|
-
spec.add_development_dependency "
|
37
|
-
spec.add_development_dependency "
|
38
|
-
|
39
|
-
|
1
|
+
require_relative 'lib/rad_core_rails/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "rad_core_rails"
|
5
|
+
spec.version = RadCoreRails::VERSION
|
6
|
+
spec.authors = ["Oleksandr Poltavets, James Marrs"]
|
7
|
+
spec.email = ["sancho.ck@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{RadCoreRails}
|
10
|
+
spec.description = %q{RadCoreRails lib}
|
11
|
+
spec.homepage = "https://github.com/jamesmarrs/rad-core-rails"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://rubygems.org/gems/rad_core_rails"
|
19
|
+
spec.metadata["changelog_uri"] = "https://rubygems.org/gems/rad_core_rails"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|support|bin|config|db)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
# spec.add_dependency "rails", '>= 4.2'
|
31
|
+
spec.add_dependency "activesupport", '>= 4.2'
|
32
|
+
spec.add_dependency "activemodel", '>= 4.2'
|
33
|
+
spec.add_dependency "activerecord", '>= 4.2'
|
34
|
+
|
35
|
+
spec.add_development_dependency "actionpack", '>= 4.2'
|
36
|
+
spec.add_development_dependency "bundler", '>= 1.17.3'
|
37
|
+
spec.add_development_dependency "rake"
|
38
|
+
spec.add_development_dependency "rspec-rails"
|
39
|
+
spec.add_development_dependency "factory_bot_rails"
|
40
|
+
spec.add_development_dependency "shoulda-matchers", '>= 4.0'
|
41
|
+
spec.add_development_dependency 'pg', '>= 0.19'
|
42
|
+
spec.add_development_dependency 'railties', '>= 5'
|
43
|
+
# spec.add_development_dependency "simplecov", '~> 0.17', '>= 0.18.5'
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rad_core_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleksandr Poltavets, James Marrs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -95,19 +95,75 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: rspec
|
98
|
+
name: rspec-rails
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: factory_bot_rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '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'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: shoulda-matchers
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '4.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pg
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.19'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.19'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: railties
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '5'
|
104
160
|
type: :development
|
105
161
|
prerelease: false
|
106
162
|
version_requirements: !ruby/object:Gem::Requirement
|
107
163
|
requirements:
|
108
164
|
- - ">="
|
109
165
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
166
|
+
version: '5'
|
111
167
|
description: RadCoreRails lib
|
112
168
|
email:
|
113
169
|
- sancho.ck@gmail.com
|
@@ -117,17 +173,25 @@ extra_rdoc_files: []
|
|
117
173
|
files:
|
118
174
|
- ".gitignore"
|
119
175
|
- ".rspec"
|
176
|
+
- ".rubocop.yml"
|
120
177
|
- ".travis.yml"
|
121
178
|
- CODE_OF_CONDUCT.md
|
122
179
|
- Gemfile
|
123
180
|
- LICENSE.txt
|
124
181
|
- README.md
|
125
182
|
- Rakefile
|
183
|
+
- lib/generators/rad_core_rails/templates/migration.rb.tt
|
184
|
+
- lib/generators/rad_core_rails/zip_codes_migration_generator.rb
|
126
185
|
- lib/rad_core_rails.rb
|
127
186
|
- lib/rad_core_rails/query_generator.rb
|
187
|
+
- lib/rad_core_rails/railtie.rb
|
128
188
|
- lib/rad_core_rails/search_terms.rb
|
129
189
|
- lib/rad_core_rails/sortable.rb
|
130
190
|
- lib/rad_core_rails/version.rb
|
191
|
+
- lib/rad_core_rails/zip_code.rb
|
192
|
+
- lib/rad_core_rails/zip_importer.rb
|
193
|
+
- lib/resources/us_zip_codes.json
|
194
|
+
- lib/tasks/rad_core_rails.rake
|
131
195
|
- rad_core_rails.gemspec
|
132
196
|
homepage: https://github.com/jamesmarrs/rad-core-rails
|
133
197
|
licenses:
|