rhino_project_core 0.20.0.beta.87 → 0.20.0.beta.91
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rhino/engine.rb +1 -0
- data/lib/rhino/sieve/geospatial.rb +45 -0
- data/lib/rhino/sieve.rb +1 -0
- data/lib/rhino/version.rb +1 -1
- data/lib/rhino_project_core.rb +2 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b13e16249dfcf0ffe63cd28c60ac6fce08e64b1e8148a4f77cc58cdd380997f
|
4
|
+
data.tar.gz: 565da4f95028585899cf7dbb160b39c889a144069c63816f9094d0ed37939e44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b183f05953cad514ba0819d28461a47d90192f4406ac727d2b5cd898333b7ada483479c5c9baef3ad45d5292b99b855a864f71a9b689e0b17ad17f3770f34ea
|
7
|
+
data.tar.gz: 57f24e2d114a5af334a41dc09d5c240fae75da66877e82779b339abc2ebac751136b7da193c564ddaec4f0bd78ca23e2d7f63bd0b4fb29d5d5270686719fc662
|
data/lib/rhino/engine.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rhino
|
4
|
+
module Sieve
|
5
|
+
class Geospatial
|
6
|
+
def initialize(app)
|
7
|
+
@app = app
|
8
|
+
end
|
9
|
+
|
10
|
+
# geospatial={near: {location: { latitude: 41.2565, longitude: -95.9345 }, max_distance: 10, units: 'km'}}
|
11
|
+
# geospatial={near: {location: 'Omaha, NE, US', max_distance: 10, units: 'km'}}
|
12
|
+
def resolve(scope, params)
|
13
|
+
return @app.resolve(scope, params) unless valid?(params)
|
14
|
+
|
15
|
+
@app.resolve(
|
16
|
+
scope.near(
|
17
|
+
@location_params,
|
18
|
+
@near_params[:max_distance],
|
19
|
+
units: @near_params[:units]
|
20
|
+
), params
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def valid?(params) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
26
|
+
@geospatial_params = params[:geospatial]
|
27
|
+
return false unless @geospatial_params.is_a?(ActionController::Parameters)
|
28
|
+
|
29
|
+
@near_params = @geospatial_params[:near]
|
30
|
+
return false unless @near_params.is_a?(ActionController::Parameters)
|
31
|
+
|
32
|
+
@location_params = @near_params[:location]
|
33
|
+
if @location_params.is_a?(String)
|
34
|
+
@location_params = @near_params[:location]
|
35
|
+
elsif @location_params.is_a?(ActionController::Parameters) && @location_params[:latitude].present? && @location_params[:longitude].present?
|
36
|
+
@location_params = [@location_params[:latitude], @location_params[:longitude]]
|
37
|
+
else
|
38
|
+
return false
|
39
|
+
end
|
40
|
+
|
41
|
+
@near_params[:max_distance].present?
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/rhino/sieve.rb
CHANGED
data/lib/rhino/version.rb
CHANGED
data/lib/rhino_project_core.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhino_project_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.0.beta.
|
4
|
+
version: 0.20.0.beta.91
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Rosevear
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -156,6 +156,20 @@ dependencies:
|
|
156
156
|
- - '='
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: 5.3.0
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: geocoder
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - '='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 1.8.2
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - '='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 1.8.2
|
159
173
|
- !ruby/object:Gem::Dependency
|
160
174
|
name: js_regex
|
161
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -471,6 +485,7 @@ files:
|
|
471
485
|
- lib/rhino/resource/sieves.rb
|
472
486
|
- lib/rhino/sieve.rb
|
473
487
|
- lib/rhino/sieve/filter.rb
|
488
|
+
- lib/rhino/sieve/geospatial.rb
|
474
489
|
- lib/rhino/sieve/helpers.rb
|
475
490
|
- lib/rhino/sieve/limit.rb
|
476
491
|
- lib/rhino/sieve/offset.rb
|