keymaker 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,106 @@
1
+ require 'keymaker'
2
+
3
+ Keymaker.configure do |c|
4
+ c.server = "localhost"
5
+ c.port = 7475
6
+ end
7
+
8
+ shared_context "Keymaker connections" do
9
+ let(:connection) do
10
+ Faraday.new({url: "http://localhost:7475"}) do |conn|
11
+ conn.request :json
12
+ conn.use FaradayMiddleware::ParseJson, content_type: /\bjson$/
13
+ conn.adapter :net_http
14
+ end
15
+ end
16
+ let(:faraday_stubs) do
17
+ Faraday::Adapter::Test::Stubs.new
18
+ end
19
+ let(:test_connection) do
20
+ Faraday.new do |conn|
21
+ conn.adapter :test, faraday_stubs
22
+ end
23
+ end
24
+ let(:service) { Keymaker.service }
25
+ end
26
+
27
+ shared_context "John and Sarah nodes" do
28
+ include_context "Keymaker connections"
29
+
30
+ let!(:john_node_url) do
31
+ connection.post("/db/data/node") do |request|
32
+ request.body = {email: john_email}
33
+ end.body["self"]
34
+ end
35
+
36
+ let!(:sarah_node_url) do
37
+ connection.post("/db/data/node") do |request|
38
+ request.body = {email: sarah_email}
39
+ end.body["self"]
40
+ end
41
+
42
+ let(:john_node_id) { john_node_url.split("/").last }
43
+ let(:sarah_node_id) { sarah_node_url.split("/").last }
44
+
45
+ let(:index_query_for_john_url) { "/db/data/index/node/users/email/#{john_email}" }
46
+ let(:index_query_for_sarah_url) { "/db/data/index/node/users/email/#{sarah_email}" }
47
+ let(:delete_index_path_for_john_url) { "/db/data/index/node/users/#{john_node_id}" }
48
+
49
+ let(:john_email) { "john@resistance.net" }
50
+ let(:sarah_email) { "sarah@resistance.net" }
51
+ end
52
+
53
+ shared_context "John and Sarah indexed nodes" do
54
+
55
+ include_context "John and Sarah nodes"
56
+
57
+ let!(:indexed_john) do
58
+ connection.post("db/data/index/node/users") do |request|
59
+ request.body = {
60
+ key: "email",
61
+ value: john_email,
62
+ uri: john_node_url
63
+ }
64
+ end.body
65
+ end
66
+
67
+ let!(:indexed_sarah) do
68
+ connection.post("db/data/index/node/users") do |request|
69
+ request.body = {
70
+ key: "email",
71
+ value: sarah_email,
72
+ uri: sarah_node_url
73
+ }
74
+ end.body
75
+ end
76
+
77
+ end
78
+
79
+ def clear_graph
80
+ raw_connection.post("/db/data/ext/GremlinPlugin/graphdb/execute_script", {script: "g.clear()\;g.V()"})
81
+ end
82
+
83
+ def clear_users_index
84
+ raw_connection.delete("http://localhost:7475/db/data/index/node/users")
85
+ end
86
+
87
+ def raw_connection
88
+ Faraday.new({url: "http://localhost:7475"}) do |conn|
89
+ conn.request :json
90
+ conn.use FaradayMiddleware::ParseJson, content_type: /\bjson$/
91
+ conn.adapter :net_http
92
+ end
93
+ end
94
+
95
+ RSpec.configure do |config|
96
+ config.before(:all) do
97
+ clear_graph
98
+ end
99
+ config.before(:each) do
100
+ clear_graph
101
+ clear_users_index
102
+ end
103
+ config.after(:all) do
104
+ clear_graph
105
+ end
106
+ end
metadata ADDED
@@ -0,0 +1,194 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: keymaker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Rogelio J. Samour
9
+ - Travis L. Anderson
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-06-06 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: addressable
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: faraday
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: faraday_middleware
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: activemodel
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: rake
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rspec
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: ruby-debug19
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ description: A multi-layer REST API wrapper for neo4j.
128
+ email:
129
+ - rogelio@therubymug.com
130
+ - travis@travisleeanderson.com
131
+ executables: []
132
+ extensions: []
133
+ extra_rdoc_files:
134
+ - README.md
135
+ - LICENSE.md
136
+ files:
137
+ - Gemfile
138
+ - LICENSE.md
139
+ - README.md
140
+ - Rakefile
141
+ - keymaker.gemspec
142
+ - keymaker_integration_spec.rb
143
+ - lib/keymaker.rb
144
+ - lib/keymaker/add_node_to_index_request.rb
145
+ - lib/keymaker/batch_get_nodes_request.rb
146
+ - lib/keymaker/configuration.rb
147
+ - lib/keymaker/create_node_request.rb
148
+ - lib/keymaker/create_relationship_request.rb
149
+ - lib/keymaker/delete_relationship_request.rb
150
+ - lib/keymaker/execute_cypher_request.rb
151
+ - lib/keymaker/execute_gremlin_request.rb
152
+ - lib/keymaker/indexing.rb
153
+ - lib/keymaker/node.rb
154
+ - lib/keymaker/path_traverse_request.rb
155
+ - lib/keymaker/remove_node_from_index_request.rb
156
+ - lib/keymaker/request.rb
157
+ - lib/keymaker/response.rb
158
+ - lib/keymaker/serialization.rb
159
+ - lib/keymaker/service.rb
160
+ - lib/keymaker/update_node_properties_request.rb
161
+ - spec/lib/keymaker_integration_spec.rb
162
+ - spec/spec_helper.rb
163
+ - spec/support/keymaker.rb
164
+ homepage: https://github.com/therubymug/keymaker
165
+ licenses: []
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ! '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ segments:
177
+ - 0
178
+ hash: -3417876533899238016
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
+ none: false
181
+ requirements:
182
+ - - ! '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ requirements: []
186
+ rubyforge_project:
187
+ rubygems_version: 1.8.24
188
+ signing_key:
189
+ specification_version: 2
190
+ summary: A multi-layer REST API wrapper for neo4j.
191
+ test_files:
192
+ - spec/lib/keymaker_integration_spec.rb
193
+ - spec/spec_helper.rb
194
+ - spec/support/keymaker.rb