neography 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,19 @@
1
1
  require 'rails'
2
2
 
3
- class Railtie < Rails::Railtie
3
+ module Neography
4
+ class Railtie < Rails::Railtie
4
5
 
5
- rake_tasks do
6
- load "neography/tasks.rb"
7
- end
8
- end
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
@@ -1,3 +1,3 @@
1
1
  module Neography
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
@@ -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
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