neography 1.0.4 → 1.0.5
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.
- data/lib/neography/railtie.rb +16 -5
- data/lib/neography/rest/extensions.rb +25 -0
- data/lib/neography/version.rb +1 -1
- data/spec/unit/rest/extensions_spec.rb +29 -0
- metadata +4 -1
data/lib/neography/railtie.rb
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
require 'rails'
|
2
2
|
|
3
|
-
|
3
|
+
module Neography
|
4
|
+
class Railtie < Rails::Railtie
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
# To add an initialization step from your Railtie to Rails boot process, you just need to create an initializer block:
|
7
|
+
# See: http://api.rubyonrails.org/classes/Rails/Railtie.html
|
8
|
+
initializer 'neography.configure' do
|
9
|
+
# Provides a hook so people implementing the gem can do this in a railtie of their own:
|
10
|
+
# initializer "my_thing.neography_initialization", before: 'neography_railtie.configure_rails_initialization' do
|
11
|
+
# require 'my_thing/neography'
|
12
|
+
# end
|
13
|
+
end
|
14
|
+
|
15
|
+
rake_tasks do
|
16
|
+
load 'neography/tasks.rb'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Neography
|
2
|
+
class Rest
|
3
|
+
class Extensions
|
4
|
+
include Neography::Rest::Helpers
|
5
|
+
|
6
|
+
def initialize(connection)
|
7
|
+
@connection = connection
|
8
|
+
end
|
9
|
+
|
10
|
+
def get(path)
|
11
|
+
@connection.get(path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def post(path, body = {})
|
15
|
+
options = {
|
16
|
+
:body => body.to_json,
|
17
|
+
:headers => json_content_type.merge({'Accept' => 'application/json;stream=true'})
|
18
|
+
}
|
19
|
+
|
20
|
+
@connection.post(path, options)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/neography/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Neography
|
4
|
+
class Rest
|
5
|
+
describe Extensions do
|
6
|
+
|
7
|
+
let(:connection) { stub }
|
8
|
+
subject { Extensions.new(connection) }
|
9
|
+
|
10
|
+
it "executes an extensions get query" do
|
11
|
+
path = "/unmanaged_extension/test"
|
12
|
+
|
13
|
+
connection.should_receive(:get).with(path)
|
14
|
+
subject.get("/unmanaged_extension/test")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "executes an extensions post query" do
|
18
|
+
path = "/unmanaged_extension/test"
|
19
|
+
options = {
|
20
|
+
:body=>"{\"foo\":\"bar\",\"baz\":\"qux\"}",
|
21
|
+
:headers=>{"Content-Type"=>"application/json", "Accept"=>"application/json;stream=true"}
|
22
|
+
}
|
23
|
+
connection.should_receive(:post).with(path, options)
|
24
|
+
subject.post("/unmanaged_extension/test", { :foo => "bar", :baz => "qux" })
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
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: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/neography/rest/batch.rb
|
201
201
|
- lib/neography/rest/clean.rb
|
202
202
|
- lib/neography/rest/cypher.rb
|
203
|
+
- lib/neography/rest/extensions.rb
|
203
204
|
- lib/neography/rest/gremlin.rb
|
204
205
|
- lib/neography/rest/helpers.rb
|
205
206
|
- lib/neography/rest/indexes.rb
|
@@ -249,6 +250,7 @@ files:
|
|
249
250
|
- spec/unit/rest/batch_spec.rb
|
250
251
|
- spec/unit/rest/clean_spec.rb
|
251
252
|
- spec/unit/rest/cypher_spec.rb
|
253
|
+
- spec/unit/rest/extensions_spec.rb
|
252
254
|
- spec/unit/rest/gremlin_spec.rb
|
253
255
|
- spec/unit/rest/node_auto_indexes_spec.rb
|
254
256
|
- spec/unit/rest/node_indexes_spec.rb
|
@@ -317,6 +319,7 @@ test_files:
|
|
317
319
|
- spec/unit/rest/batch_spec.rb
|
318
320
|
- spec/unit/rest/clean_spec.rb
|
319
321
|
- spec/unit/rest/cypher_spec.rb
|
322
|
+
- spec/unit/rest/extensions_spec.rb
|
320
323
|
- spec/unit/rest/gremlin_spec.rb
|
321
324
|
- spec/unit/rest/node_auto_indexes_spec.rb
|
322
325
|
- spec/unit/rest/node_indexes_spec.rb
|