neography 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,7 +19,7 @@ module Neography
19
19
 
20
20
  def load(node, db = Neography::Rest.new)
21
21
  raise ArgumentError.new("syntax deprecated") if node.is_a?(Neography::Rest)
22
-
22
+ node = node.first if node.kind_of?(Array)
23
23
  node = db.get_node(node) if (node.to_s.match(/^\d+$/) or node.to_s.split("/").last.match(/^\d+$/))
24
24
  if node
25
25
  node = self.new(node)
@@ -2,6 +2,7 @@
2
2
  require 'os'
3
3
  require 'httpclient'
4
4
  require 'zip/zip'
5
+ require 'net/http'
5
6
 
6
7
  namespace :neo4j do
7
8
  desc "Install Neo4j"
@@ -14,7 +15,13 @@ namespace :neo4j do
14
15
  unless File.exist?('neo4j.zip')
15
16
  df = File.open('neo4j.zip', 'wb')
16
17
  begin
17
- df << HTTPClient.new.get("http://dist.neo4j.org/neo4j-#{args[:edition]}-#{args[:version]}-windows.zip")
18
+ Net::HTTP.start("dist.neo4j.org") do |http|
19
+ http.request_get("/neo4j-#{args[:edition]}-#{args[:version]}-windows.zip") do |resp|
20
+ resp.read_body do |segment|
21
+ df.write(segment)
22
+ end
23
+ end
24
+ end
18
25
  ensure
19
26
  df.close()
20
27
  end
@@ -1,3 +1,3 @@
1
1
  module Neography
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -69,6 +69,19 @@ describe Neography::Node do
69
69
  }.to raise_error(ArgumentError)
70
70
  end
71
71
 
72
+ it "can get a node from an index" do
73
+ @neo = Neography::Rest.new
74
+ new_node = Neography::Node.create("age" => 31, "name" => "Max")
75
+ key = generate_text(6)
76
+ value = generate_text
77
+ @neo.add_node_to_index("test_node_index", key, value, new_node)
78
+ node_from_index = @neo.get_node_index("test_node_index", key, value)
79
+ existing_node = Neography::Node.load(node_from_index)
80
+ existing_node.should_not be_nil
81
+ existing_node.neo_id.should_not be_nil
82
+ existing_node.neo_id.should == new_node.neo_id
83
+ end
84
+
72
85
  it "can get a node that exists via cypher" do
73
86
  new_node = Neography::Node.create("age" => 31, "name" => "Max")
74
87
  cypher = "START n = node({id}) return n"
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.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-19 00:00:00.000000000 Z
12
+ date: 2013-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec