neography 0.0.31 → 1.0.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.
Files changed (85) hide show
  1. data/.gitignore +3 -0
  2. data/.travis.yml +1 -1
  3. data/CONTRIBUTORS +2 -1
  4. data/README.md +247 -0
  5. data/Rakefile +1 -2
  6. data/lib/neography/config.rb +48 -16
  7. data/lib/neography/connection.rb +151 -0
  8. data/lib/neography/errors.rb +42 -0
  9. data/lib/neography/node.rb +17 -14
  10. data/lib/neography/node_relationship.rb +3 -1
  11. data/lib/neography/node_traverser.rb +24 -20
  12. data/lib/neography/property.rb +31 -28
  13. data/lib/neography/property_container.rb +1 -1
  14. data/lib/neography/relationship.rb +16 -19
  15. data/lib/neography/rest/auto_indexes.rb +64 -0
  16. data/lib/neography/rest/batch.rb +262 -0
  17. data/lib/neography/rest/clean.rb +19 -0
  18. data/lib/neography/rest/cypher.rb +24 -0
  19. data/lib/neography/rest/gremlin.rb +24 -0
  20. data/lib/neography/rest/helpers.rb +26 -0
  21. data/lib/neography/rest/indexes.rb +97 -0
  22. data/lib/neography/rest/node_auto_indexes.rb +14 -0
  23. data/lib/neography/rest/node_indexes.rb +35 -0
  24. data/lib/neography/rest/node_paths.rb +57 -0
  25. data/lib/neography/rest/node_properties.rb +11 -0
  26. data/lib/neography/rest/node_relationships.rb +53 -0
  27. data/lib/neography/rest/node_traversal.rb +81 -0
  28. data/lib/neography/rest/nodes.rb +102 -0
  29. data/lib/neography/rest/paths.rb +36 -0
  30. data/lib/neography/rest/properties.rb +56 -0
  31. data/lib/neography/rest/relationship_auto_indexes.rb +14 -0
  32. data/lib/neography/rest/relationship_indexes.rb +35 -0
  33. data/lib/neography/rest/relationship_properties.rb +11 -0
  34. data/lib/neography/rest/relationships.rb +23 -0
  35. data/lib/neography/rest.rb +285 -615
  36. data/lib/neography/tasks.rb +1 -1
  37. data/lib/neography/version.rb +1 -1
  38. data/lib/neography.rb +13 -2
  39. data/neography.gemspec +8 -8
  40. data/spec/integration/authorization_spec.rb +2 -2
  41. data/spec/integration/index_spec.rb +4 -4
  42. data/spec/integration/neography_spec.rb +2 -2
  43. data/spec/integration/node_path_spec.rb +2 -2
  44. data/spec/integration/node_relationship_spec.rb +5 -3
  45. data/spec/integration/node_spec.rb +20 -19
  46. data/spec/integration/parsing_spec.rb +2 -2
  47. data/spec/integration/relationship_spec.rb +2 -2
  48. data/spec/integration/rest_batch_spec.rb +28 -28
  49. data/spec/integration/rest_bulk_spec.rb +2 -2
  50. data/spec/integration/rest_experimental_spec.rb +2 -2
  51. data/spec/integration/rest_gremlin_fail_spec.rb +2 -2
  52. data/spec/integration/rest_header_spec.rb +4 -9
  53. data/spec/integration/rest_index_spec.rb +21 -1
  54. data/spec/integration/rest_node_spec.rb +58 -44
  55. data/spec/integration/rest_path_spec.rb +5 -5
  56. data/spec/integration/rest_plugin_spec.rb +8 -2
  57. data/spec/integration/rest_relationship_spec.rb +35 -30
  58. data/spec/integration/rest_traverse_spec.rb +2 -2
  59. data/spec/matchers.rb +33 -0
  60. data/spec/neography_spec.rb +23 -0
  61. data/spec/spec_helper.rb +19 -1
  62. data/spec/unit/config_spec.rb +46 -0
  63. data/spec/unit/connection_spec.rb +205 -0
  64. data/spec/unit/node_spec.rb +100 -0
  65. data/spec/unit/properties_spec.rb +136 -0
  66. data/spec/unit/relationship_spec.rb +118 -0
  67. data/spec/unit/rest/batch_spec.rb +243 -0
  68. data/spec/unit/rest/clean_spec.rb +17 -0
  69. data/spec/unit/rest/cypher_spec.rb +21 -0
  70. data/spec/unit/rest/gremlin_spec.rb +26 -0
  71. data/spec/unit/rest/node_auto_indexes_spec.rb +67 -0
  72. data/spec/unit/rest/node_indexes_spec.rb +126 -0
  73. data/spec/unit/rest/node_paths_spec.rb +80 -0
  74. data/spec/unit/rest/node_properties_spec.rb +80 -0
  75. data/spec/unit/rest/node_relationships_spec.rb +78 -0
  76. data/spec/unit/rest/node_traversal_spec.rb +128 -0
  77. data/spec/unit/rest/nodes_spec.rb +188 -0
  78. data/spec/unit/rest/paths_spec.rb +69 -0
  79. data/spec/unit/rest/relationship_auto_indexes_spec.rb +67 -0
  80. data/spec/unit/rest/relationship_indexes_spec.rb +128 -0
  81. data/spec/unit/rest/relationship_properties_spec.rb +80 -0
  82. data/spec/unit/rest/relationships_spec.rb +22 -0
  83. metadata +86 -19
  84. data/Gemfile.lock +0 -44
  85. data/README.rdoc +0 -420
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ module Neography
4
+ class Rest
5
+ describe RelationshipProperties do
6
+
7
+ let(:connection) { stub }
8
+ subject { RelationshipProperties.new(connection) }
9
+
10
+ it "sets properties" do
11
+ options1 = {
12
+ :body => '"bar"',
13
+ :headers => json_content_type
14
+ }
15
+ options2 = {
16
+ :body => '"qux"',
17
+ :headers => json_content_type
18
+ }
19
+ connection.should_receive(:put).with("/relationship/42/properties/foo", options1)
20
+ connection.should_receive(:put).with("/relationship/42/properties/baz", options2)
21
+ subject.set("42", {:foo => "bar", :baz => "qux"})
22
+ end
23
+
24
+ it "resets properties" do
25
+ options = {
26
+ :body => '{"foo":"bar"}',
27
+ :headers => json_content_type
28
+ }
29
+ connection.should_receive(:put).with("/relationship/42/properties", options)
30
+ subject.reset("42", {:foo => "bar"})
31
+ end
32
+
33
+ context "getting properties" do
34
+
35
+ it "gets all properties" do
36
+ connection.should_receive(:get).with("/relationship/42/properties")
37
+ subject.get("42")
38
+ end
39
+
40
+ it "gets multiple properties" do
41
+ connection.should_receive(:get).with("/relationship/42/properties/foo")
42
+ connection.should_receive(:get).with("/relationship/42/properties/bar")
43
+ subject.get("42", "foo", "bar")
44
+ end
45
+
46
+ it "returns multiple properties as a hash" do
47
+ connection.stub(:get).and_return("baz", "qux")
48
+ subject.get("42", "foo", "bar").should == { "foo" => "baz", "bar" => "qux" }
49
+ end
50
+
51
+ it "returns nil if no properties were found" do
52
+ connection.stub(:get).and_return(nil, nil)
53
+ subject.get("42", "foo", "bar").should be_nil
54
+ end
55
+
56
+ it "returns hash without nil return values" do
57
+ connection.stub(:get).and_return("baz", nil)
58
+ subject.get("42", "foo", "bar").should == { "foo" => "baz" }
59
+ end
60
+
61
+ end
62
+
63
+ context "removing properties" do
64
+
65
+ it "removes all properties" do
66
+ connection.should_receive(:delete).with("/relationship/42/properties")
67
+ subject.remove("42")
68
+ end
69
+
70
+ it "removes multiple properties" do
71
+ connection.should_receive(:delete).with("/relationship/42/properties/foo")
72
+ connection.should_receive(:delete).with("/relationship/42/properties/bar")
73
+ subject.remove("42", "foo", "bar")
74
+ end
75
+
76
+ end
77
+
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ module Neography
4
+ class Rest
5
+ describe Relationships do
6
+
7
+ let(:connection) { stub }
8
+ subject { Relationships.new(connection) }
9
+
10
+ it "gets a relationship" do
11
+ connection.should_receive(:get).with("/relationship/42")
12
+ subject.get("42")
13
+ end
14
+
15
+ it "deletes a relationship" do
16
+ connection.should_receive(:delete).with("/relationship/42")
17
+ subject.delete("42")
18
+ end
19
+
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neography
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.31
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-06 00:00:00.000000000 Z
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '2.0'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: '2.0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: net-http-spy
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: 0.8.7
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.8.7
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: httparty
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: 0.8.7
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: 0.8.7
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: json
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
- version: '0'
101
+ version: 1.6.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: 1.6.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: os
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 0.9.6
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
- version: '0'
125
+ version: 0.9.6
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rubyzip
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ! '>='
132
132
  - !ruby/object:Gem::Version
133
- version: '0'
133
+ version: 0.9.7
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ! '>='
140
140
  - !ruby/object:Gem::Version
141
- version: '0'
141
+ version: 0.9.7
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: multi_json
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ! '>='
148
148
  - !ruby/object:Gem::Version
149
- version: '0'
149
+ version: 1.3.2
150
150
  type: :runtime
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
@@ -154,8 +154,8 @@ dependencies:
154
154
  requirements:
155
155
  - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
- version: '0'
158
- description: A Ruby wrapper to the Neo4j Rest API see http://components.neo4j.org/neo4j-rest/
157
+ version: 1.3.2
158
+ description: A Ruby wrapper to the Neo4j Rest API see http://docs.neo4j.org/chunked/stable/rest-api.html
159
159
  for more details.
160
160
  email: maxdemarzi@gmail.com
161
161
  executables: []
@@ -167,9 +167,8 @@ files:
167
167
  - .travis.yml
168
168
  - CONTRIBUTORS
169
169
  - Gemfile
170
- - Gemfile.lock
171
170
  - LICENSE
172
- - README.rdoc
171
+ - README.md
173
172
  - Rakefile
174
173
  - examples/facebook.rb
175
174
  - examples/facebook_v2.rb
@@ -180,7 +179,9 @@ files:
180
179
  - examples/traversal_example2.rb
181
180
  - lib/neography.rb
182
181
  - lib/neography/config.rb
182
+ - lib/neography/connection.rb
183
183
  - lib/neography/equal.rb
184
+ - lib/neography/errors.rb
184
185
  - lib/neography/index.rb
185
186
  - lib/neography/multi_json_parser.rb
186
187
  - lib/neography/neography.rb
@@ -195,6 +196,26 @@ files:
195
196
  - lib/neography/relationship.rb
196
197
  - lib/neography/relationship_traverser.rb
197
198
  - lib/neography/rest.rb
199
+ - lib/neography/rest/auto_indexes.rb
200
+ - lib/neography/rest/batch.rb
201
+ - lib/neography/rest/clean.rb
202
+ - lib/neography/rest/cypher.rb
203
+ - lib/neography/rest/gremlin.rb
204
+ - lib/neography/rest/helpers.rb
205
+ - lib/neography/rest/indexes.rb
206
+ - lib/neography/rest/node_auto_indexes.rb
207
+ - lib/neography/rest/node_indexes.rb
208
+ - lib/neography/rest/node_paths.rb
209
+ - lib/neography/rest/node_properties.rb
210
+ - lib/neography/rest/node_relationships.rb
211
+ - lib/neography/rest/node_traversal.rb
212
+ - lib/neography/rest/nodes.rb
213
+ - lib/neography/rest/paths.rb
214
+ - lib/neography/rest/properties.rb
215
+ - lib/neography/rest/relationship_auto_indexes.rb
216
+ - lib/neography/rest/relationship_indexes.rb
217
+ - lib/neography/rest/relationship_properties.rb
218
+ - lib/neography/rest/relationships.rb
198
219
  - lib/neography/tasks.rb
199
220
  - lib/neography/version.rb
200
221
  - neography.gemspec
@@ -217,7 +238,30 @@ files:
217
238
  - spec/integration/rest_plugin_spec.rb
218
239
  - spec/integration/rest_relationship_spec.rb
219
240
  - spec/integration/rest_traverse_spec.rb
241
+ - spec/matchers.rb
242
+ - spec/neography_spec.rb
220
243
  - spec/spec_helper.rb
244
+ - spec/unit/config_spec.rb
245
+ - spec/unit/connection_spec.rb
246
+ - spec/unit/node_spec.rb
247
+ - spec/unit/properties_spec.rb
248
+ - spec/unit/relationship_spec.rb
249
+ - spec/unit/rest/batch_spec.rb
250
+ - spec/unit/rest/clean_spec.rb
251
+ - spec/unit/rest/cypher_spec.rb
252
+ - spec/unit/rest/gremlin_spec.rb
253
+ - spec/unit/rest/node_auto_indexes_spec.rb
254
+ - spec/unit/rest/node_indexes_spec.rb
255
+ - spec/unit/rest/node_paths_spec.rb
256
+ - spec/unit/rest/node_properties_spec.rb
257
+ - spec/unit/rest/node_relationships_spec.rb
258
+ - spec/unit/rest/node_traversal_spec.rb
259
+ - spec/unit/rest/nodes_spec.rb
260
+ - spec/unit/rest/paths_spec.rb
261
+ - spec/unit/rest/relationship_auto_indexes_spec.rb
262
+ - spec/unit/rest/relationship_indexes_spec.rb
263
+ - spec/unit/rest/relationship_properties_spec.rb
264
+ - spec/unit/rest/relationships_spec.rb
221
265
  homepage: http://rubygems.org/gems/neography
222
266
  licenses: []
223
267
  post_install_message:
@@ -262,4 +306,27 @@ test_files:
262
306
  - spec/integration/rest_plugin_spec.rb
263
307
  - spec/integration/rest_relationship_spec.rb
264
308
  - spec/integration/rest_traverse_spec.rb
309
+ - spec/matchers.rb
310
+ - spec/neography_spec.rb
265
311
  - spec/spec_helper.rb
312
+ - spec/unit/config_spec.rb
313
+ - spec/unit/connection_spec.rb
314
+ - spec/unit/node_spec.rb
315
+ - spec/unit/properties_spec.rb
316
+ - spec/unit/relationship_spec.rb
317
+ - spec/unit/rest/batch_spec.rb
318
+ - spec/unit/rest/clean_spec.rb
319
+ - spec/unit/rest/cypher_spec.rb
320
+ - spec/unit/rest/gremlin_spec.rb
321
+ - spec/unit/rest/node_auto_indexes_spec.rb
322
+ - spec/unit/rest/node_indexes_spec.rb
323
+ - spec/unit/rest/node_paths_spec.rb
324
+ - spec/unit/rest/node_properties_spec.rb
325
+ - spec/unit/rest/node_relationships_spec.rb
326
+ - spec/unit/rest/node_traversal_spec.rb
327
+ - spec/unit/rest/nodes_spec.rb
328
+ - spec/unit/rest/paths_spec.rb
329
+ - spec/unit/rest/relationship_auto_indexes_spec.rb
330
+ - spec/unit/rest/relationship_indexes_spec.rb
331
+ - spec/unit/rest/relationship_properties_spec.rb
332
+ - spec/unit/rest/relationships_spec.rb
data/Gemfile.lock DELETED
@@ -1,44 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- neography (0.0.30)
5
- httparty (>= 0.8.1)
6
- json
7
- multi_json
8
- os
9
- rake
10
- rubyzip
11
-
12
- GEM
13
- remote: http://rubygems.org/
14
- specs:
15
- diff-lcs (1.1.3)
16
- httparty (0.8.3)
17
- multi_json (~> 1.0)
18
- multi_xml
19
- json (1.7.5)
20
- json (1.7.5-java)
21
- multi_json (1.3.6)
22
- multi_xml (0.5.1)
23
- net-http-spy (0.2.1)
24
- os (0.9.6)
25
- rake (0.9.2.2)
26
- rspec (2.11.0)
27
- rspec-core (~> 2.11.0)
28
- rspec-expectations (~> 2.11.0)
29
- rspec-mocks (~> 2.11.0)
30
- rspec-core (2.11.1)
31
- rspec-expectations (2.11.3)
32
- diff-lcs (~> 1.1.3)
33
- rspec-mocks (2.11.2)
34
- rubyzip (0.9.9)
35
-
36
- PLATFORMS
37
- java
38
- ruby
39
-
40
- DEPENDENCIES
41
- neography!
42
- net-http-spy (= 0.2.1)
43
- rake
44
- rspec