neo4apis 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/neo4apis/query_buffer.rb +13 -0
- data/neo4apis.gemspec +2 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40548956dac52684686a356c9c1d3f3afe1ea3ea
|
4
|
+
data.tar.gz: de46e6622fbfd0d5d23ae57dcc7fcf5dc8c68983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7c7ead69bcd5faa416e6310cb96ae84d3fc820b31b6f80c8532573fcf606dd169a7c5f6b1c9d0ba5b87d919b4c7fccec9fd16402b3f16b7ce215d9d4f1f80aa
|
7
|
+
data.tar.gz: 8c93594fcd914ea4d6ea1848e276ed8774c3bd6ca9cb2c602c1611af0f2d351708c7889f362366d6ad39321cbff8ba7e4efcc6c5c9d792d0d6657adc1074039b
|
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
##Introduction
|
3
3
|
|
4
4
|
neo4apis is a ruby gem for building objects which import data into neo4j. It takes care of batching of queries for better import performance and creating indexes for better query performance. It also uses MERGEs to make sure the same node/relationship isn't imported twice. neo4apis is for anybody who want to build a gem or even just an adapter in their application which encapsulates the logic of data import from some source. For examples see the drivers for [Twitter](https://github.com/neo4jrb/neo4apis-twitter) and [GitHub](https://github.com/neo4jrb/neo4apis-github)
|
5
5
|
|
6
6
|
In the below example we assume that a variable `awesome_client` is passed in which allows us to make requests to the API. This may be, for example, provided by another gem.
|
7
7
|
|
8
|
-
|
8
|
+
##To install
|
9
9
|
|
10
10
|
`gem 'neo4apis'` in your Gemfile or `gem install neo4apis`
|
11
11
|
|
12
|
-
|
12
|
+
##To use
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
require 'neo4apis'
|
@@ -40,6 +40,19 @@ module Neo4Apis
|
|
40
40
|
req.headers['Content-Type'] = 'application/json'
|
41
41
|
req.headers['X-Stream'] = 'true'
|
42
42
|
req.body = request_body_data.to_json
|
43
|
+
end.tap do |response|
|
44
|
+
if response.status != 200
|
45
|
+
raise "ERROR: response status #{response.status}:\n#{response.body}"
|
46
|
+
else
|
47
|
+
response_data = JSON.parse(response.body)
|
48
|
+
if response_data['errors'].size > 0
|
49
|
+
error_string = response_data['errors'].map do |error|
|
50
|
+
[error['code'], error['message']].join("\n")
|
51
|
+
end.join("\n\n")
|
52
|
+
|
53
|
+
raise "ERROR: Cypher response error:\n" + error_string
|
54
|
+
end
|
55
|
+
end
|
43
56
|
end
|
44
57
|
end
|
45
58
|
|
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.3.
|
6
|
+
s.version = '0.3.1'
|
7
7
|
s.required_ruby_version = ">= 1.9.1"
|
8
8
|
|
9
9
|
s.authors = "Brian Underwood"
|
@@ -24,5 +24,6 @@ A core library for importing data from APIs into neo4j. Designed to be used wit
|
|
24
24
|
s.add_dependency('faraday', "~> 0.9.0")
|
25
25
|
s.add_dependency("neo4j-core", "~> 3.0.4")
|
26
26
|
s.add_dependency('thor', '~> 0.19.1')
|
27
|
+
s.add_dependency('colorize', '~> 0.7.3')
|
27
28
|
|
28
29
|
end
|
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.3.
|
4
|
+
version: 0.3.1
|
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-11-
|
11
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.19.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: colorize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.7.3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.7.3
|
55
69
|
description: |
|
56
70
|
A core library for importing data from APIs into neo4j. Designed to be used with an adapter
|
57
71
|
email: public@brian-underwood.codes
|