neo4apis 0.4.2 → 0.5.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/lib/neo4apis/base.rb +10 -10
- data/lib/neo4apis/query_buffer.rb +2 -2
- data/neo4apis.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0536c8fe2eca8047b3db19bd254ee7e03fa31c96
|
4
|
+
data.tar.gz: ffc513eac7d0f1e8660c91fa48ccc93cfe03dcca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05f7a6ef06e4b70dfcf2cd879f38102e22a6dcbdcc6537c013a8780f7f48d4444d1b9d085e7ab525220e82ad492ffb92195a6c4c2b0bc9dca02b5b694cac1f57
|
7
|
+
data.tar.gz: 1e7f06e11a49b545020dd3d372459572b5f204e900fcda12ab43e1554f51db3798f3624e5fb8c738edd7dbba0f77768d122c7edca6b9ebdb2f8db46f689b1f55
|
data/lib/neo4apis/base.rb
CHANGED
@@ -24,7 +24,7 @@ module Neo4Apis
|
|
24
24
|
|
25
25
|
if object
|
26
26
|
columns.each do |column|
|
27
|
-
props
|
27
|
+
props.send("#{column}=", object.send(column))
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -32,16 +32,16 @@ module Neo4Apis
|
|
32
32
|
|
33
33
|
require_batch
|
34
34
|
|
35
|
-
|
35
|
+
fail ArgumentError, "No UUID specified for label `#{label}`" if not UUID_FIELDS[label.to_sym]
|
36
36
|
|
37
|
-
self.class.node_proxy(label).new(props.
|
37
|
+
self.class.node_proxy(label).new(props.marshal_dump).tap do |node_proxy|
|
38
38
|
@buffer << create_node_query(node_proxy)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
def add_relationship(type, source, target, props = {})
|
43
|
-
|
44
|
-
|
43
|
+
fail ArgumentError, "No source specified" if not source
|
44
|
+
fail ArgumentError, "No target specified" if not target
|
45
45
|
|
46
46
|
require_batch
|
47
47
|
|
@@ -58,8 +58,8 @@ module Neo4Apis
|
|
58
58
|
@in_batch = false
|
59
59
|
end
|
60
60
|
|
61
|
-
def import(label,
|
62
|
-
self.instance_exec
|
61
|
+
def import(label, *args)
|
62
|
+
self.instance_exec(*args, &IMPORTERS[label.to_sym])
|
63
63
|
end
|
64
64
|
|
65
65
|
def self.prefix(prefix)
|
@@ -94,7 +94,7 @@ module Neo4Apis
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def uuid_value
|
97
|
-
|
97
|
+
fail ArgumentError, "props does not have UUID field `#{uuid_field}` for #{self.inspect}" if not props.has_key?(uuid_field)
|
98
98
|
|
99
99
|
props[uuid_field]
|
100
100
|
end
|
@@ -107,7 +107,7 @@ module Neo4Apis
|
|
107
107
|
elsif batch_size.nil?
|
108
108
|
@batch_size
|
109
109
|
else
|
110
|
-
|
110
|
+
fail ArgumentError, "Invalid value for batch_size: #{batch_size.inspect}"
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
@@ -138,7 +138,7 @@ module Neo4Apis
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def require_batch
|
141
|
-
|
141
|
+
fail "Must be in a batch" if not @in_batch
|
142
142
|
end
|
143
143
|
end
|
144
144
|
end
|
@@ -42,7 +42,7 @@ module Neo4Apis
|
|
42
42
|
req.body = request_body_data.to_json
|
43
43
|
end.tap do |response|
|
44
44
|
if response.status != 200
|
45
|
-
|
45
|
+
fail "ERROR: response status #{response.status}:\n#{response.body}"
|
46
46
|
else
|
47
47
|
response_data = JSON.parse(response.body)
|
48
48
|
if response_data['errors'].size > 0
|
@@ -50,7 +50,7 @@ module Neo4Apis
|
|
50
50
|
[error['code'], error['message']].join("\n")
|
51
51
|
end.join("\n\n")
|
52
52
|
|
53
|
-
|
53
|
+
fail "ERROR: Cypher response error:\n" + error_string
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/neo4apis.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4apis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Underwood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -107,3 +107,4 @@ signing_key:
|
|
107
107
|
specification_version: 4
|
108
108
|
summary: An API to import web API data to neo4j
|
109
109
|
test_files: []
|
110
|
+
has_rdoc:
|