neography 1.0.11 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -94,6 +94,14 @@ It supports indexes, Gremlin scripts, Cypher queries and batch operations.
94
94
 
95
95
  Some of this functionality is shown here, but all of it is explained in the following Wiki pages:
96
96
 
97
+ 2.0 Only features:
98
+
99
+ * [Schema indexes](https://github.com/maxdemarzi/neography/wiki/Schema-indexes) - Create, get and delete schema indexes.
100
+ * [Node labels](https://github.com/maxdemarzi/neography/wiki/Node-labels) - Create, get and delete node labels.
101
+ * [Transactions](https://github.com/maxdemarzi/neography/wiki/Transactions) - Begin, add to, commit, rollback transactions.
102
+
103
+ 1.8+ features:
104
+
97
105
  * [Nodes](https://github.com/maxdemarzi/neography/wiki/Nodes) - Create, get and delete nodes.
98
106
  * [Node properties](https://github.com/maxdemarzi/neography/wiki/Node-properties) - Set, get and remove node properties.
99
107
  * [Node relationships](https://github.com/maxdemarzi/neography/wiki/Node-relationships) - Create and get relationships between nodes.
@@ -136,10 +136,10 @@ module Neography
136
136
  end
137
137
 
138
138
  def commit_transaction(tx, statements=[])
139
- if tx.is_a?(Array)
140
- @transactions.begin(tx, "commit")
141
- else
139
+ if (tx.is_a?(Hash) || tx.is_a?(Integer))
142
140
  @transactions.commit(tx, statements)
141
+ else
142
+ @transactions.begin(tx, "/commit")
143
143
  end
144
144
  end
145
145
 
@@ -60,15 +60,15 @@ module Neography
60
60
  query = nil
61
61
  parameters = nil
62
62
  Array(statements).each do |statement|
63
- if query & parameters
63
+ if query && parameters
64
64
  array << {:statement => query, :parameters => {:props => parameters}}
65
65
  query = statement
66
66
  parameters = nil
67
- elsif query & statement.is_a?(String)
67
+ elsif query && statement.is_a?(String)
68
68
  array << {:statement => query}
69
69
  query = statement
70
70
  parameters = nil
71
- elsif query & statement.is_a?(Hash)
71
+ elsif query && statement.is_a?(Hash)
72
72
  array << {:statement => query, :parameters => {:props => parameters}}
73
73
  query = nil
74
74
  parameters = nil
@@ -1,3 +1,3 @@
1
1
  module Neography
2
- VERSION = "1.0.11"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -74,6 +74,28 @@ describe Neography::Rest do
74
74
  existing_tx.should have_key("results")
75
75
  existing_tx["results"].should_not be_empty
76
76
  end
77
+
78
+ it "can commit an new transaction right away" do
79
+ tx = @neo.commit_transaction(["start n=node(0) return n"])
80
+ tx.should_not have_key("transaction")
81
+ tx.should have_key("results")
82
+ tx["results"].should_not be_empty
83
+ end
84
+
85
+ it "can commit an new transaction right away with parameters" do
86
+ tx = @neo.commit_transaction(["start n=node({id}) return n", {:id => 0}])
87
+ tx.should_not have_key("transaction")
88
+ tx.should have_key("results")
89
+ tx["results"].should_not be_empty
90
+ end
91
+
92
+ it "can commit an new transaction right away without parameters" do
93
+ tx = @neo.commit_transaction("start n=node(0) return n")
94
+ tx.should_not have_key("transaction")
95
+ tx.should have_key("results")
96
+ tx["results"].should_not be_empty
97
+ end
98
+
77
99
  end
78
100
 
79
101
  describe "rollback a transaction" do
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.11
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: