neo4apis 0.4.2 → 0.5.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: 0f9c2d5c4cb977ed23b36e7d576daec2d4fde202
4
- data.tar.gz: 16e1133370c22b344f8370d6a68396c8935e93d3
3
+ metadata.gz: 0536c8fe2eca8047b3db19bd254ee7e03fa31c96
4
+ data.tar.gz: ffc513eac7d0f1e8660c91fa48ccc93cfe03dcca
5
5
  SHA512:
6
- metadata.gz: f650cfa872e0205cb808a8487ea7bc4e410ebfb76a5528fb26796fa7b305c45f0213a8a498bfa8cfef06bbce31663e6b998120a87652f052902ef8145b1242c9
7
- data.tar.gz: b991266033a079574740169f4165ec52217992251d3af9df33196de60cd1fbba3dd466eb6cc31ed863b7c569a7f01a77508901f05a2055f9599383c6abac27b6
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[column] = object.send(column)
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
- raise ArgumentError, "No UUID specified for label `#{label}`" if not UUID_FIELDS[label.to_sym]
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.to_h).tap do |node_proxy|
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
- raise ArgumentError, "No source specified" if not source
44
- raise ArgumentError, "No target specified" if not target
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, object)
62
- self.instance_exec object, &IMPORTERS[label.to_sym]
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
- raise ArgumentError, "props does not have UUID field `#{uuid_field}` for #{self.inspect}" if not props.has_key?(uuid_field)
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
- raise ArgumentError, "Invalid value for batch_size: #{batch_size.inspect}"
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
- raise "Must be in a batch" if not @in_batch
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
- raise "ERROR: response status #{response.status}:\n#{response.body}"
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
- raise "ERROR: Cypher response error:\n" + error_string
53
+ fail "ERROR: Cypher response error:\n" + error_string
54
54
  end
55
55
  end
56
56
  end
data/neo4apis.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.unshift lib unless $:.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "neo4apis"
6
- s.version = '0.4.2'
6
+ s.version = '0.5.0'
7
7
  s.required_ruby_version = ">= 1.9.1"
8
8
 
9
9
  s.authors = "Brian Underwood"
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.2
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: 2014-12-17 00:00:00.000000000 Z
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: