neo4jrb_spatial 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9a8fabd817cc1db5b5d5f6f7466a1c0850f7359
4
- data.tar.gz: 39f2e8a65c7a8a3f4baf988423be0916b6a9c282
3
+ metadata.gz: 5d7020cf724fdf56d3816dd13a1c1a6335f9cee3
4
+ data.tar.gz: 2326bbe73ef0c9787be9fcdac40b220a505e7e52
5
5
  SHA512:
6
- metadata.gz: 3fd46e9a2b1605f8539f97c68fb9fecfd39f9a4949a20a18a811ce0ac697c015e0d181b6882c45d2b1f9bdaf7e5d895e0252a6b7c7ee4b483c07c0c962e10fca
7
- data.tar.gz: 0d2eedf8a8df07564138fd9e2be26c0fad14b2f424169fbae7fbd7c4f8a8289f563e57af8ae3b2546a7e9e74889f5a1cbdd685d0c7464b266b85410869a68a9f
6
+ metadata.gz: 4f6874f5330f2bf7c895db54280b263c741c6b055a7ac6846d7cac3f7eb7a99e99f74177e8f4f16e49638173574bbb22c080234ee2809e3b72926e118736f4d2
7
+ data.tar.gz: 8e550e27b37a492ddaf7974ca22f7f962047f0bd36ae59cc1853bee5c52124cc3b01d174ae35bf7f8c7faea7cd52e36cc4f3f272570f21218b1a322818a7c419
@@ -5,6 +5,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased][unreleased]
7
7
 
8
+ ## [1.1.0] - 2015-10-15
9
+
10
+ ### Fixed
11
+
12
+ - Problems with gem config were preventing installation. Relaxed versioning requirements.
13
+ - Rake tasks were moved out of Neo4j-core, so added the `neo4j-rake_tasks` gem to keep this ship sailing.
14
+
8
15
  ## [1.0.0] - 2015-06-TBD
9
16
 
10
17
  ### Added
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source 'https://rubygems.org'
2
- # gem 'neo4j', github: 'neo4jrb/neo4j', branch: 'master'
3
- gem 'neo4j-core', github: 'neo4jrb/neo4j-core', branch: 'master'
4
2
 
5
3
  # Specify your gem's dependencies in neo4jrb_spatial.gemspec
6
4
  gemspec
data/README.md CHANGED
@@ -30,6 +30,11 @@ Optionally:
30
30
 
31
31
  # Usage
32
32
 
33
+ ## Add it
34
+
35
+ ```
36
+ gem 'neo4jrb_spatial', '~> 1.0.0'
37
+ ```
33
38
 
34
39
  ## Require it
35
40
 
@@ -41,7 +46,7 @@ require 'neo4j/spatial'
41
46
  include Neo4j::ActiveNode::Spatial
42
47
  ```
43
48
 
44
- ## Basics - Neo4j-core
49
+ ## Use it with Neo4j-core
45
50
 
46
51
  ```ruby
47
52
  # Create an index
@@ -58,26 +63,46 @@ Neo4j::Session.current.query.start('n = node:restaurants({location})').params(lo
58
63
  # => CypherNode 90126 (70333884677220)
59
64
  ```
60
65
 
61
- ## Basics - Neo4j gem
66
+ ## Use it with the Neo4j gem
62
67
 
63
- Neo4j.rb does not support legacy indexes, so a helper method is provided to add nodes. As with normal properties, your lat and lon
64
- should be explicitly declared.
68
+ Neo4j.rb does not support legacy indexes, so adding nodes to spatial indexes needs to happen separately from node creation. This is complicated by the fact that Neo4j.rb creates all nodes in transactions, so `after_create` callbacks won't work; instead, add your node to the index once you've confirmed it has been created.
65
69
 
66
- ### Automatic index addition
67
-
68
- At the moment, automatic index addition is not implemented.
70
+ Start by adding `lat` and `lon` properties to your model. You can also add a `spatial_index` to save yourself some time later.
71
+
72
+ ```
73
+ class Restaurant
74
+ include Neo4j::ActiveNode
75
+ include Neo4j::ActiveNode::Spatial
76
+
77
+ # This is optional but might make things easier for you later
78
+ spatial_index 'restaurants'
79
+
80
+ property :name
81
+ property :lat
82
+ property :lon
83
+ end
84
+
85
+ # Create it
86
+ pizza_hut = Restaurant.create(name: 'Pizza Hut', lat: 60.1, lon: 15.1)
87
+
88
+ # When called without an argument, it will use the value set through `spatial_index` in the model
89
+ pizza_hut.add_to_spatial_index
90
+
91
+ # Alternatively, to add it to a different index, just give it that name
92
+ pizza_hut.add_to_spatial_index('fake_pizza_places')
93
+ ```
69
94
 
70
95
  ### Manual index addition
71
96
 
72
- All of the Neo4j-core spatial methods accept ActiveNode-including nodes, so you can use them as arguments for all defined methods as you would
73
- Neo4j::Server::CypherNode instances.
97
+ All of the Neo4j-core spatial methods accept ActiveNode-including nodes, so you can use them as arguments for all defined methods as you would Neo4j::Server::CypherNode instances.
74
98
 
75
- Additionally, you can call the `add_to_spatial_index` instance method on any node to add it to its model's defined index.
99
+ ```ruby
100
+ Neo4j::Session.current.add_node_to_spatial_index('fake_pizza_places', pizza_hut)
101
+ ```
76
102
 
77
103
  ### Spatial queries
78
104
 
79
- No helpers are provided to query against the REST API -- you'll need to use the ones provided for Neo4j-core; however, a class method is provided
80
- to make Cypher queries easier: `spatial_match`.
105
+ No helpers are provided to query against the REST API -- you'll need to use the ones provided for Neo4j-core; however, a class method is provided to make Cypher queries easier: `spatial_match`.
81
106
 
82
107
  ```
83
108
  # Use the index defined on the model as demonstrated above
@@ -93,7 +118,7 @@ It then drops you back into a QueryProxy in the context of the class. If you had
93
118
  Restauarant.all.spatial_match(:r, 'withinDistance:[41.99,-87.67,10.0]').employees.where(age: 30)
94
119
  ```
95
120
 
96
- Alternatively, if you did no define `spatial_index` on your model, you can feed a third argument: the index to use for the query.
121
+ If you did no define `spatial_index` on your model or what to query against something other than the model's default, you can feed a third argument: the index to use for the query.
97
122
 
98
123
  ## Additional Resources
99
124
 
@@ -1,3 +1,3 @@
1
1
  module Neo4jrbSpatial
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'rspec'
23
23
  spec.add_development_dependency 'pry'
24
24
 
25
- spec.add_dependency 'neo4j', '~> 5.0.1'
26
- spec.add_dependency 'neo4j-core', '~> 5.0.1'
25
+ spec.add_dependency 'neo4j', '>= 5.0.1'
26
+ spec.add_dependency 'neo4j-core', '>= 5.0.1'
27
+ spec.add_dependency 'neo4j-rake_tasks', '~> 0.3'
27
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4jrb_spatial
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Grigg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,30 +84,44 @@ dependencies:
84
84
  name: neo4j
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 5.0.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 5.0.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: neo4j-core
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 5.0.1
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 5.0.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: neo4j-rake_tasks
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.3'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.3'
111
125
  description:
112
126
  email:
113
127
  - chris@subvertallmedia.com