ddp-server-rethinkdb 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ddp-server-rethinkdb.gemspec +1 -1
- data/examples/messages.rb +1 -0
- data/lib/ddp/server/rethinkdb/api.rb +5 -25
- data/lib/ddp/server/rethinkdb/helpers.rb +1 -1
- data/lib/ddp/server/rethinkdb/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca6f906789448ffa62337a30e7ed3860a5c267af
|
4
|
+
data.tar.gz: e14ec5f8ade185e2b69eb31333b68ec9a71c17fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1234cf21991ee7e4b6e19059bdfffc2b8ac263b4f6fb05a4d2badf119209ab01991ad4afa424fb52fb48eaa72d60a6028dd85c865e3cf5c8eff20105741fe01a
|
7
|
+
data.tar.gz: ef6742ed36055813de21c553359f568b9eb69d38c34a2b173756d2adc64f38cf9850e2ce895a915f56c53b2abf2deb9f5d16ca6a45c03121d56bd87612dedb0f
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
22
|
spec.add_development_dependency 'rake'
|
23
23
|
|
24
|
-
spec.add_dependency 'ddp-server', '>= 0.1.
|
24
|
+
spec.add_dependency 'ddp-server', '>= 0.1.2'
|
25
25
|
spec.add_dependency 'rethinkdb'
|
26
26
|
spec.add_dependency 'connection_pool'
|
27
27
|
end
|
data/examples/messages.rb
CHANGED
@@ -1,31 +1,23 @@
|
|
1
|
+
require 'ddp/server/api'
|
2
|
+
|
1
3
|
module DDP
|
2
4
|
module Server
|
3
5
|
# A RethinkDB DDP Server implementation
|
4
6
|
module RethinkDB
|
5
7
|
# Helper class that users can extend to implement an API that can be passed
|
6
8
|
# as the RPC API parameter to the RethinkDB DDP protocol
|
7
|
-
class API
|
9
|
+
class API < DDP::Server::API
|
8
10
|
include Helpers
|
9
11
|
|
10
12
|
attr_accessor :database_name
|
11
13
|
|
12
14
|
def initialize(config)
|
15
|
+
super()
|
16
|
+
|
13
17
|
@config = config
|
14
18
|
@database_name = config[:database]
|
15
19
|
|
16
20
|
setup_connection_pool
|
17
|
-
setup_rpc
|
18
|
-
setup_collections
|
19
|
-
end
|
20
|
-
|
21
|
-
def invoke_rpc(method, *params)
|
22
|
-
raise 'No such method' unless @rpc_methods.include? method
|
23
|
-
send(method, *params)
|
24
|
-
end
|
25
|
-
|
26
|
-
def collection_query(name, *params)
|
27
|
-
raise 'No such collection' unless @collections.include? name
|
28
|
-
wrap_query(send(name, *params), new_connection)
|
29
21
|
end
|
30
22
|
|
31
23
|
def database
|
@@ -59,18 +51,6 @@ module DDP
|
|
59
51
|
new_connection
|
60
52
|
end
|
61
53
|
end
|
62
|
-
|
63
|
-
def setup_rpc
|
64
|
-
rpc_module = self.class.const_get :RPC
|
65
|
-
@rpc_methods = rpc_module.instance_methods.map(&:to_s)
|
66
|
-
singleton_class.include rpc_module
|
67
|
-
end
|
68
|
-
|
69
|
-
def setup_collections
|
70
|
-
collections_module = self.class.const_get :Collections
|
71
|
-
@collections = collections_module.instance_methods.map(&:to_s)
|
72
|
-
singleton_class.include collections_module
|
73
|
-
end
|
74
54
|
end
|
75
55
|
end
|
76
56
|
end
|
@@ -5,7 +5,7 @@ module DDP
|
|
5
5
|
# Helper class that users can extend to implement an API that can be passed
|
6
6
|
# as the RPC API parameter to the RethinkDB DDP protocol
|
7
7
|
module Helpers
|
8
|
-
def wrap_query(query
|
8
|
+
def wrap_query(query)
|
9
9
|
lambda do |&on_update|
|
10
10
|
connection = new_connection
|
11
11
|
results = query.run(connection)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddp-server-rethinkdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tinco Andringa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.
|
47
|
+
version: 0.1.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.
|
54
|
+
version: 0.1.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rethinkdb
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|