ruxster 0.0.0 → 0.0.1
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/VERSION +1 -1
- data/lib/ruxster/base.rb +11 -0
- data/lib/ruxster/edge.rb +3 -0
- data/lib/ruxster/vertex.rb +3 -0
- data/ruxster.gemspec +2 -2
- data/spec/edge_spec.rb +11 -0
- data/spec/vertex_spec.rb +16 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/lib/ruxster/base.rb
CHANGED
@@ -53,6 +53,17 @@ module Ruxster
|
|
53
53
|
def destroy
|
54
54
|
response = Excon.delete(Base.connect_string + "/#{self.class.url_directory}/#{self.id}")
|
55
55
|
end
|
56
|
+
|
57
|
+
def self.create_index(automatic=true)
|
58
|
+
url = Base.connect_string + "/indices/index?class=#{self.index_type}"
|
59
|
+
url += "&type=automatic" if automatic
|
60
|
+
Excon.post(url)
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.indices
|
64
|
+
response = JSON.parse(Excon.get(Base.connect_string + "/indices").body)
|
65
|
+
response["results"]
|
66
|
+
end
|
56
67
|
|
57
68
|
def self.find(key, value)
|
58
69
|
response = JSON.parse(Excon.get(Base.connect_string + "/indices/#{url_directory}?key=#{key}&value=#{value}").body)
|
data/lib/ruxster/edge.rb
CHANGED
data/lib/ruxster/vertex.rb
CHANGED
data/ruxster.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruxster}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Christopher Petersen"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-13}
|
13
13
|
s.description = %q{An Object Graph Mapper (OGM) for mapping Ruby Objects onto graphs in a instance or Rexster, like CouchRest is for CouchDB}
|
14
14
|
s.email = %q{christopher.petersen@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/edge_spec.rb
CHANGED
@@ -116,4 +116,15 @@ describe "Ruxster::Edge" do
|
|
116
116
|
edges = Ruxster::Edge.all
|
117
117
|
edges.class.should == Array
|
118
118
|
end
|
119
|
+
|
120
|
+
it "should post to the proper url when creating the edge index" do
|
121
|
+
Excon.should_receive(:post).with("http://localhost:8182/database/indices/index?class=edge&type=automatic")
|
122
|
+
Ruxster::Edge.create_index
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should return an array of hashes when Edge.indices is called" do
|
126
|
+
Ruxster::Edge.create_index
|
127
|
+
indices = Ruxster::Edge.indices
|
128
|
+
indices.should include({"name" => "edges","class" => "com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jEdge","type" => "automatic"})
|
129
|
+
end
|
119
130
|
end
|
data/spec/vertex_spec.rb
CHANGED
@@ -79,15 +79,26 @@ describe "Ruxster::Vertex" do
|
|
79
79
|
it "Jack should have 3 Total Edges" do
|
80
80
|
@jack.all_edges.count.should == 3
|
81
81
|
end
|
82
|
-
|
83
|
-
it "find the right vertex" do
|
84
|
-
results = Ruxster::Vertex.find("name", "Jack")
|
85
|
-
results.first["name"].should == "Jack"
|
86
|
-
end
|
87
82
|
end
|
88
83
|
|
89
84
|
it "should return all vertices in the database when all is called" do
|
90
85
|
vertices = Ruxster::Vertex.all
|
91
86
|
vertices.class.should == Array
|
92
87
|
end
|
88
|
+
|
89
|
+
it "should post to the proper url when creating the vertex index" do
|
90
|
+
Excon.should_receive(:post).with("http://localhost:8182/database/indices/index?class=vertex&type=automatic")
|
91
|
+
Ruxster::Vertex.create_index
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should return an array of hashes when Vertex.indices is called" do
|
95
|
+
Ruxster::Vertex.create_index
|
96
|
+
indices = Ruxster::Vertex.indices
|
97
|
+
indices.should include({"name" => "vertices","class" => "com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex","type" => "automatic"})
|
98
|
+
end
|
99
|
+
|
100
|
+
it "find the right vertex" do
|
101
|
+
results = Ruxster::Vertex.find("name", "Jack")
|
102
|
+
results.first["name"].should == "Jack"
|
103
|
+
end
|
93
104
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Christopher Petersen
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-13 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|