unidom-geo 0.3 → 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 +4 -4
- data/README.md +5 -1
- data/app/models/unidom/geo/locating.rb +1 -1
- data/app/models/unidom/geo/location.rb +4 -0
- data/lib/unidom/geo/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d998808f283dbc60704cadb0a1a08df3708d185
|
4
|
+
data.tar.gz: 156ba7447884012df3147844f632e4d9eb6113bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b38e065be0d15e329e1ecd9e82520615004481cc7714d3c79d968ddea8547f1e3579b2914a2136efdcf76b2c4f1ebe7b4291b4213e16ee26efc970f1ee6ac3c
|
7
|
+
data.tar.gz: 7f7923875cb11cbbd4786bce9b3b7919b43f03bc18abc1c80ea58607beeb5b8f9d0c91b5d958cdf79be32ad7a69055c19f647f90063dd1f50307c2b78f95d14f
|
data/README.md
CHANGED
@@ -26,5 +26,9 @@ The migration versions start with 200104.
|
|
26
26
|
Unidom::Geo::Location.valid_at.alive.first.region
|
27
27
|
|
28
28
|
active_locatings = location.locatings.valid_at.alive
|
29
|
-
|
29
|
+
|
30
|
+
# Locate: associate a shop, an estate, or a facility with a location
|
31
|
+
location.locate! shop, by: person
|
32
|
+
# or
|
33
|
+
Unidom::Geo::Locating.locate! location: location, located: shop
|
30
34
|
```
|
@@ -14,7 +14,7 @@ class Unidom::Geo::Locating < ActiveRecord::Base
|
|
14
14
|
scope :located_is, ->(located) { where located: located }
|
15
15
|
scope :located_by, ->(locator) { where locator: locator }
|
16
16
|
|
17
|
-
def self.locate!(location, located, locator
|
17
|
+
def self.locate!(location: nil, located: nil, locator: nil, opened_at: Time.now)
|
18
18
|
attributes = { opened_at: opened_at }
|
19
19
|
if locator.present?
|
20
20
|
attributes[:locator] = locator
|
@@ -24,4 +24,8 @@ class Unidom::Geo::Location < ActiveRecord::Base
|
|
24
24
|
scope :region_is, ->(region) { where region: region }
|
25
25
|
scope :postal_address_is, ->(postal_address) { where postal_address: postal_address }
|
26
26
|
|
27
|
+
def locate!(located, by: nil, at: Time.now)
|
28
|
+
locatings.create! located: located, locator: by, opened_at: at
|
29
|
+
end
|
30
|
+
|
27
31
|
end
|
data/lib/unidom/geo/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-geo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0
|
4
|
+
version: '1.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.9'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|