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,97 @@
1
+ module Neography
2
+ class Rest
3
+ class Indexes
4
+ include Neography::Rest::Helpers
5
+
6
+ def initialize(connection, index_type)
7
+ @connection = connection
8
+ @index_type = index_type
9
+ end
10
+
11
+ def list
12
+ @connection.get(all_path)
13
+ end
14
+
15
+ def create(name, type = "exact", provider = "lucene")
16
+ options = {
17
+ :body => (
18
+ { :name => name,
19
+ :config => {
20
+ :type => type,
21
+ :provider => provider
22
+ }
23
+ }
24
+ ).to_json,
25
+ :headers => json_content_type
26
+ }
27
+ @connection.post(all_path, options)
28
+ end
29
+
30
+ def create_auto(type = "exact", provider = "lucene")
31
+ create("#{@index_type}_auto_index", type, provider)
32
+ end
33
+
34
+ def add(index, key, value, id)
35
+ options = {
36
+ :body => (
37
+ { :uri => @connection.configuration + "/#{@index_type}/#{get_id(id)}",
38
+ :key => key,
39
+ :value => value
40
+ }
41
+ ).to_json,
42
+ :headers => json_content_type
43
+ }
44
+
45
+ @connection.post(base_path(:index => index), options)
46
+ end
47
+
48
+ def get(index, key, value)
49
+ index = @connection.get(key_value_path(:index => index, :key => key, :value => value)) || []
50
+ return nil if index.empty?
51
+ index
52
+ end
53
+
54
+ def find(index, key_or_query, value = nil)
55
+ if value
56
+ index = find_by_key_value(index, key_or_query, value)
57
+ else
58
+ index = find_by_query(index, key_or_query)
59
+ end
60
+ return nil if index.empty?
61
+ index
62
+ end
63
+
64
+ def find_by_key_value(index, key, value)
65
+ @connection.get(key_value_path(:index => index, :key => key, :value => value)) || []
66
+ end
67
+
68
+ def find_by_query(index, query)
69
+ @connection.get(query_path(:index => index, :query => query)) || []
70
+ end
71
+
72
+ # Mimick original neography API in Rest class.
73
+ def remove(index, id_or_key, id_or_value = nil, id = nil)
74
+ if id
75
+ remove_by_value(index, id, id_or_key, id_or_value)
76
+ elsif id_or_value
77
+ remove_by_key(index, id_or_value, id_or_key)
78
+ else
79
+ remove_by_id(index, id_or_key)
80
+ end
81
+ end
82
+
83
+ def remove_by_id(index, id)
84
+ @connection.delete(id_path(:index => index, :id => get_id(id)))
85
+ end
86
+
87
+ def remove_by_key(index, id, key)
88
+ @connection.delete(key_path(:index => index, :id => get_id(id), :key => key))
89
+ end
90
+
91
+ def remove_by_value(index, id, key, value)
92
+ @connection.delete(value_path(:index => index, :id => get_id(id), :key => key, :value => value))
93
+ end
94
+
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,14 @@
1
+ module Neography
2
+ class Rest
3
+ class NodeAutoIndexes < AutoIndexes
4
+ extend Neography::Rest::Paths
5
+
6
+ add_path :key_value, "/index/auto/node/:key/:value"
7
+ add_path :query_index, "/index/auto/node/?query=:query"
8
+ add_path :index_status, "/index/auto/node/status"
9
+ add_path :index_properties, "/index/auto/node/properties"
10
+ add_path :index_property, "/index/auto/node/properties/:property"
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,35 @@
1
+ module Neography
2
+ class Rest
3
+ class NodeIndexes < Indexes
4
+ extend Neography::Rest::Paths
5
+ include Neography::Rest::Helpers
6
+
7
+ add_path :all, "/index/node"
8
+ add_path :base, "/index/node/:index"
9
+ add_path :unique, "/index/node/:index?unique"
10
+ add_path :id, "/index/node/:index/:id"
11
+ add_path :key, "/index/node/:index/:key/:id"
12
+ add_path :value, "/index/node/:index/:key/:value/:id"
13
+ add_path :key_value, "/index/node/:index/:key/:value"
14
+ add_path :query, "/index/node/:index?query=:query"
15
+
16
+ def initialize(connection)
17
+ super(connection, :node)
18
+ end
19
+
20
+ def create_unique(index, key, value, properties = {})
21
+ options = {
22
+ :body => (
23
+ { :properties => properties,
24
+ :key => key,
25
+ :value => value
26
+ }
27
+ ).to_json,
28
+ :headers => json_content_type
29
+ }
30
+ @connection.post(unique_path(:index => index), options)
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,57 @@
1
+ module Neography
2
+ class Rest
3
+ class NodePaths
4
+ extend Neography::Rest::Paths
5
+ include Neography::Rest::Helpers
6
+
7
+ add_path :base, "/node/:id/path"
8
+ add_path :all, "/node/:id/paths"
9
+
10
+ def initialize(connection)
11
+ @connection = connection
12
+ end
13
+
14
+ def get(from, to, relationships, depth = 1, algorithm = "shortestPath")
15
+ options = path_options(to, relationships, depth, algorithm)
16
+ @connection.post(base_path(:id => get_id(from)), options) || {}
17
+ end
18
+
19
+ def get_all(from, to, relationships, depth = 1, algorithm = "allPaths")
20
+ options = path_options(to, relationships, depth, algorithm)
21
+ @connection.post(all_path(:id => get_id(from)), options) || []
22
+ end
23
+
24
+ def shortest_weighted(from, to, relationships, weight_attribute = "weight", depth = 1, algorithm = "dijkstra")
25
+ options = path_options(to, relationships, depth, algorithm, { :cost_property => weight_attribute })
26
+ @connection.post(all_path(:id => get_id(from)), options) || {}
27
+ end
28
+
29
+ private
30
+
31
+ def get_algorithm(algorithm)
32
+ case algorithm
33
+ when :shortest, "shortest", :shortestPath, "shortestPath", :short, "short"
34
+ "shortestPath"
35
+ when :allSimplePaths, "allSimplePaths", :simple, "simple"
36
+ "allSimplePaths"
37
+ when :dijkstra, "dijkstra"
38
+ "dijkstra"
39
+ else
40
+ "allPaths"
41
+ end
42
+ end
43
+
44
+ def path_options(to, relationships, depth, algorithm, extra_body = {})
45
+ options = { :body => {
46
+ "to" => @connection.configuration + "/node/#{get_id(to)}",
47
+ "relationships" => relationships,
48
+ "max_depth" => depth,
49
+ "algorithm" => get_algorithm(algorithm)
50
+ }.merge(extra_body).to_json,
51
+ :headers => json_content_type
52
+ }
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,11 @@
1
+ module Neography
2
+ class Rest
3
+ class NodeProperties < Properties
4
+ extend Neography::Rest::Paths
5
+
6
+ add_path :all, "/node/:id/properties"
7
+ add_path :single, "/node/:id/properties/:property"
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,53 @@
1
+ module Neography
2
+ class Rest
3
+ class NodeRelationships
4
+ extend Neography::Rest::Paths
5
+ include Neography::Rest::Helpers
6
+
7
+ add_path :base, "/node/:id/relationships"
8
+ add_path :direction, "/node/:id/relationships/:direction"
9
+ add_path :type, "/node/:id/relationships/:direction/:types"
10
+
11
+ def initialize(connection)
12
+ @connection = connection
13
+ end
14
+
15
+ def create(type, from, to, properties = nil)
16
+ options = {
17
+ :body => {
18
+ :to => @connection.configuration + "/node/#{get_id(to)}",
19
+ :data => properties,
20
+ :type => type
21
+ }.to_json,
22
+ :headers => json_content_type }
23
+
24
+ @connection.post(base_path(:id => get_id(from)), options)
25
+ end
26
+
27
+ def get(id, direction = nil, types = nil)
28
+ direction = parse_direction(direction)
29
+
30
+ if types.nil?
31
+ node_relationships = @connection.get(direction_path(:id => get_id(id), :direction => direction)) || []
32
+ else
33
+ node_relationships = @connection.get(type_path(:id => get_id(id), :direction => direction, :types => Array(types).join('&'))) || []
34
+ end
35
+
36
+ return nil if node_relationships.empty?
37
+ node_relationships
38
+ end
39
+
40
+ def parse_direction(direction)
41
+ case direction
42
+ when :incoming, "incoming", :in, "in"
43
+ "in"
44
+ when :outgoing, "outgoing", :out, "out"
45
+ "out"
46
+ else
47
+ "all"
48
+ end
49
+ end
50
+
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,81 @@
1
+ module Neography
2
+ class Rest
3
+ class NodeTraversal
4
+ extend Neography::Rest::Paths
5
+ include Neography::Rest::Helpers
6
+
7
+ add_path :traversal, "/node/:id/traverse/:type"
8
+
9
+ def initialize(connection)
10
+ @connection = connection
11
+ end
12
+
13
+ def traverse(id, return_type, description)
14
+ options = { :body => {
15
+ "order" => get_order(description["order"]),
16
+ "uniqueness" => get_uniqueness(description["uniqueness"]),
17
+ "relationships" => description["relationships"],
18
+ "prune_evaluator" => description["prune evaluator"],
19
+ "return_filter" => description["return filter"],
20
+ "max_depth" => get_depth(description["depth"])
21
+ }.to_json,
22
+ :headers => json_content_type
23
+ }
24
+
25
+ type = get_type(return_type)
26
+
27
+ @connection.post(traversal_path(:id => get_id(id), :type => type), options) || []
28
+ end
29
+
30
+ private
31
+
32
+ def get_order(order)
33
+ case order
34
+ when :breadth, "breadth", "breadth first", "breadthFirst", :wide, "wide"
35
+ "breadth first"
36
+ else
37
+ "depth first"
38
+ end
39
+ end
40
+
41
+ def get_uniqueness(uniqueness)
42
+ case uniqueness
43
+ when :nodeglobal, "node global", "nodeglobal", "node_global"
44
+ "node global"
45
+ when :nodepath, "node path", "nodepath", "node_path"
46
+ "node path"
47
+ when :noderecent, "node recent", "noderecent", "node_recent"
48
+ "node recent"
49
+ when :relationshipglobal, "relationship global", "relationshipglobal", "relationship_global"
50
+ "relationship global"
51
+ when :relationshippath, "relationship path", "relationshippath", "relationship_path"
52
+ "relationship path"
53
+ when :relationshiprecent, "relationship recent", "relationshiprecent", "relationship_recent"
54
+ "relationship recent"
55
+ else
56
+ "none"
57
+ end
58
+ end
59
+
60
+ def get_depth(depth)
61
+ return nil if depth.nil?
62
+ return 1 if depth.to_i == 0
63
+ depth.to_i
64
+ end
65
+
66
+ def get_type(type)
67
+ case type
68
+ when :relationship, "relationship", :relationships, "relationships"
69
+ "relationship"
70
+ when :path, "path", :paths, "paths"
71
+ "path"
72
+ when :fullpath, "fullpath", :fullpaths, "fullpaths"
73
+ "fullpath"
74
+ else
75
+ "node"
76
+ end
77
+ end
78
+
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,102 @@
1
+ module Neography
2
+ class Rest
3
+ class Nodes
4
+ extend Neography::Rest::Paths
5
+ include Neography::Rest::Helpers
6
+
7
+ add_path :index, "/node"
8
+ add_path :base, "/node/:id"
9
+
10
+ def initialize(connection)
11
+ @connection = connection
12
+ end
13
+
14
+ def get(id)
15
+ @connection.get(base_path(:id => get_id(id)))
16
+ end
17
+
18
+ def get_each(*nodes)
19
+ gotten_nodes = []
20
+ Array(nodes).flatten.each do |node|
21
+ gotten_nodes << get(node)
22
+ end
23
+ gotten_nodes
24
+ end
25
+
26
+ def root
27
+ root_node = @connection.get('/')["reference_node"]
28
+ @connection.get(base_path(:id => get_id(root_node)))
29
+ end
30
+
31
+ def create(*args)
32
+ if args[0].respond_to?(:each_pair) && args[0]
33
+ create_with_attributes(args[0])
34
+ else
35
+ create_empty
36
+ end
37
+ end
38
+
39
+ def create_with_attributes(attributes)
40
+ options = {
41
+ :body => attributes.delete_if { |k, v| v.nil? }.to_json,
42
+ :headers => json_content_type
43
+ }
44
+ @connection.post(index_path, options)
45
+ end
46
+
47
+ def create_empty
48
+ @connection.post(index_path)
49
+ end
50
+
51
+ def delete(id)
52
+ @connection.delete(base_path(:id => get_id(id)))
53
+ end
54
+
55
+ def create_multiple(nodes)
56
+ nodes = Array.new(nodes) if nodes.kind_of? Fixnum
57
+ created_nodes = []
58
+ nodes.each do |node|
59
+ created_nodes << create(node)
60
+ end
61
+ created_nodes
62
+ end
63
+
64
+ def create_multiple_threaded(nodes)
65
+ nodes = Array.new(nodes) if nodes.kind_of? Fixnum
66
+
67
+ node_queue = Queue.new
68
+ thread_pool = []
69
+ responses = Queue.new
70
+
71
+ nodes.each do |node|
72
+ node_queue.push node
73
+ end
74
+
75
+ [nodes.size, @connection.max_threads].min.times do
76
+ thread_pool << Thread.new do
77
+ until node_queue.empty? do
78
+ node = node_queue.pop
79
+ if node.respond_to?(:each_pair)
80
+ responses.push( @connection.post(index_path, {
81
+ :body => node.to_json,
82
+ :headers => json_content_type
83
+ } ) )
84
+ else
85
+ responses.push( @connection.post(index_path) )
86
+ end
87
+ end
88
+ self.join
89
+ end
90
+ end
91
+
92
+ created_nodes = []
93
+
94
+ while created_nodes.size < nodes.size
95
+ created_nodes << responses.pop
96
+ end
97
+ created_nodes
98
+ end
99
+
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,36 @@
1
+ module Neography
2
+ class Rest
3
+ module Paths
4
+
5
+ def add_path(key, path)
6
+ method_name = :"#{key}_path"
7
+
8
+ metaclass = (class << self; self; end)
9
+ metaclass.instance_eval do
10
+ define_method method_name do |*attributes|
11
+ if attributes.any?
12
+ build_path(path, *attributes)
13
+ else
14
+ path
15
+ end
16
+ end
17
+ end
18
+
19
+ define_method method_name do |*attributes|
20
+ self.class.send(method_name, *attributes)
21
+ end
22
+ end
23
+
24
+ def build_path(path, attributes)
25
+ path.gsub(/:([\w_]*)/) do
26
+ encode(attributes[$1.to_sym].to_s)
27
+ end
28
+ end
29
+
30
+ def encode(value)
31
+ URI.encode(value).gsub("/","%2F")
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,56 @@
1
+ module Neography
2
+ class Rest
3
+ class Properties
4
+ include Neography::Rest::Helpers
5
+
6
+ def initialize(connection)
7
+ @connection = connection
8
+ end
9
+
10
+ def set(id, properties)
11
+ properties.each do |property, value|
12
+ options = { :body => value.to_json, :headers => json_content_type }
13
+ @connection.put(single_path(:id => get_id(id), :property => property), options)
14
+ end
15
+ end
16
+
17
+ def reset(id, properties)
18
+ options = { :body => properties.to_json, :headers => json_content_type }
19
+ @connection.put(all_path(:id => get_id(id)), options)
20
+ end
21
+
22
+ def get(id, *properties)
23
+ if properties.none?
24
+ @connection.get(all_path(:id => get_id(id)))
25
+ else
26
+ get_each(id, *properties)
27
+ end
28
+ end
29
+
30
+ def get_each(id, *properties)
31
+ retrieved_properties = properties.flatten.inject({}) do |memo, property|
32
+ value = @connection.get(single_path(:id => get_id(id), :property => property))
33
+ memo[property] = value unless value.nil?
34
+ memo
35
+ end
36
+ return nil if retrieved_properties.empty?
37
+ retrieved_properties
38
+ end
39
+
40
+ def remove(id, *properties)
41
+ if properties.none?
42
+ @connection.delete(all_path(:id => get_id(id)))
43
+ else
44
+ remove_each(id, *properties)
45
+ end
46
+ end
47
+
48
+ def remove_each(id, *properties)
49
+ properties.flatten.each do |property|
50
+ @connection.delete(single_path(:id => get_id(id), :property => property))
51
+ end
52
+ end
53
+
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,14 @@
1
+ module Neography
2
+ class Rest
3
+ class RelationshipAutoIndexes < AutoIndexes
4
+ extend Neography::Rest::Paths
5
+
6
+ add_path :key_value, "/index/auto/relationship/:key/:value"
7
+ add_path :query_index, "/index/auto/relationship/?query=:query"
8
+ add_path :index_status, "/index/auto/relationship/status"
9
+ add_path :index_properties, "/index/auto/relationship/properties"
10
+ add_path :index_property, "/index/auto/relationship/properties/:property"
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,35 @@
1
+ module Neography
2
+ class Rest
3
+ class RelationshipIndexes < Indexes
4
+ extend Neography::Rest::Paths
5
+ include Neography::Rest::Helpers
6
+
7
+ add_path :all, "/index/relationship"
8
+ add_path :base, "/index/relationship/:index"
9
+ add_path :unique, "/index/relationship/:index?unique"
10
+ add_path :id, "/index/relationship/:index/:id"
11
+ add_path :key, "/index/relationship/:index/:key/:id"
12
+ add_path :value, "/index/relationship/:index/:key/:value/:id"
13
+ add_path :key_value, "/index/relationship/:index/:key/:value"
14
+ add_path :query, "/index/relationship/:index?query=:query"
15
+
16
+ def initialize(connection)
17
+ super(connection, :relationship)
18
+ end
19
+
20
+ def create_unique(index, key, value, type, from, to)
21
+ body = {
22
+ :key => key,
23
+ :value => value,
24
+ :type => type,
25
+ :start => @connection.configuration + "/node/#{get_id(from)}",
26
+ :end => @connection.configuration + "/node/#{get_id(to)}"
27
+ }
28
+ options = { :body => body.to_json, :headers => json_content_type }
29
+
30
+ @connection.post(unique_path(:index => index), options)
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,11 @@
1
+ module Neography
2
+ class Rest
3
+ class RelationshipProperties < Properties
4
+ extend Neography::Rest::Paths
5
+
6
+ add_path :all, "/relationship/:id/properties"
7
+ add_path :single, "/relationship/:id/properties/:property"
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ module Neography
2
+ class Rest
3
+ class Relationships
4
+ extend Neography::Rest::Paths
5
+ include Neography::Rest::Helpers
6
+
7
+ add_path :base, "/relationship/:id"
8
+
9
+ def initialize(connection)
10
+ @connection = connection
11
+ end
12
+
13
+ def get(id)
14
+ @connection.get(base_path(:id => get_id(id)))
15
+ end
16
+
17
+ def delete(id)
18
+ @connection.delete(base_path(:id => get_id(id)))
19
+ end
20
+
21
+ end
22
+ end
23
+ end