cellect-server 1.3.1 → 1.3.2
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.
- checksums.yaml +4 -4
- data/lib/cellect/server/api.rb +2 -0
- data/lib/cellect/server/api/helpers.rb +4 -0
- data/lib/cellect/server/api/sets.rb +6 -3
- data/lib/cellect/server/api/users.rb +2 -0
- data/lib/cellect/server/workflow.rb +3 -2
- data/lib/cellect/version.rb +1 -1
- data/spec/server/api/add_seen_spec.rb +7 -0
- data/spec/server/api/add_spec.rb +7 -0
- data/spec/server/api/remove_spec.rb +7 -0
- data/spec/server/api/sample_spec.rb +7 -0
- data/spec/server/api/user_load_spec.rb +7 -0
- data/spec/server/server_spec.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87c22c0c9de05b34f0da9f19778ffc5cb89faf2f
|
4
|
+
data.tar.gz: 6018574d21d7b9c74a67419bfff573153bdfcf9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47f439777229098490e256db315e66e9bb20f285262f2a1bf72cbeca3ecac88c2c7055e9bf3b05a2a6aef685084e0d7c860f745301e0372d957361afb2cd01da
|
7
|
+
data.tar.gz: b73b3f427c2329dd3ef7b7e2d0697cabf09fc07624f2d33f2d994f74cff8578b7ccc9ba9b9daacaa2e7e7d6e8b002a7f1b739c788a2bea2bc6e901c12564b75b
|
data/lib/cellect/server/api.rb
CHANGED
@@ -47,6 +47,7 @@ module Cellect
|
|
47
47
|
#
|
48
48
|
# Returns the workflow's status
|
49
49
|
get :status do
|
50
|
+
return four_oh_four unless workflow
|
50
51
|
workflow.status
|
51
52
|
end
|
52
53
|
|
@@ -54,6 +55,7 @@ module Cellect
|
|
54
55
|
#
|
55
56
|
# Reloads the workflow from the adapter
|
56
57
|
post :reload do
|
58
|
+
return four_oh_four unless workflow
|
57
59
|
workflow.async.load_data
|
58
60
|
end
|
59
61
|
|
@@ -10,7 +10,8 @@ module Cellect
|
|
10
10
|
# user_id: integer, optional
|
11
11
|
# group_id: integer, optional
|
12
12
|
get do
|
13
|
-
workflow
|
13
|
+
return four_oh_four unless workflow
|
14
|
+
workflow.sample(selector_params)
|
14
15
|
end
|
15
16
|
|
16
17
|
# PUT /workflows/:workflow_id/add
|
@@ -21,7 +22,8 @@ module Cellect
|
|
21
22
|
# group_id: integer, required if grouped
|
22
23
|
# priority: float, required if prioritized
|
23
24
|
put :add do
|
24
|
-
workflow
|
25
|
+
return four_oh_four unless workflow
|
26
|
+
workflow.add(update_params)
|
25
27
|
nil
|
26
28
|
end
|
27
29
|
|
@@ -32,7 +34,8 @@ module Cellect
|
|
32
34
|
# subject_id: integer
|
33
35
|
# group_id: integer, required if grouped
|
34
36
|
put :remove do
|
35
|
-
workflow
|
37
|
+
return four_oh_four unless workflow
|
38
|
+
workflow.remove(update_params)
|
36
39
|
nil
|
37
40
|
end
|
38
41
|
end
|
@@ -10,6 +10,7 @@ module Cellect
|
|
10
10
|
# Accepts params
|
11
11
|
# subject_id: integer, required
|
12
12
|
put :add_seen do
|
13
|
+
return four_oh_four unless workflow
|
13
14
|
user_id = param_to_int :user_id
|
14
15
|
subject_id = param_to_int :subject_id
|
15
16
|
|
@@ -24,6 +25,7 @@ module Cellect
|
|
24
25
|
#
|
25
26
|
# Preloads a user for a workflow
|
26
27
|
post :load do
|
28
|
+
return four_oh_four unless workflow
|
27
29
|
user_id = param_to_int :user_id
|
28
30
|
|
29
31
|
if user_id && user_id > 0
|
@@ -19,8 +19,9 @@ module Cellect
|
|
19
19
|
|
20
20
|
# Load a workflow
|
21
21
|
def self.[]=(name, opts)
|
22
|
-
Workflow.workflow_names[name] = true
|
23
22
|
Actor[name] = supervise name, pairwise: opts['pairwise'], prioritized: opts['prioritized']
|
23
|
+
Workflow.workflow_names[name] = true if Actor[name]
|
24
|
+
Actor[name]
|
24
25
|
end
|
25
26
|
|
26
27
|
# The names of all workflows currently loaded
|
@@ -31,7 +32,7 @@ module Cellect
|
|
31
32
|
|
32
33
|
# All currently loaded workflows
|
33
34
|
def self.all
|
34
|
-
names.collect{ |name| Workflow[name] }
|
35
|
+
names.collect{ |name| Workflow[name] }.compact
|
35
36
|
end
|
36
37
|
|
37
38
|
# Sets up a new workflow and starts the data loading
|
data/lib/cellect/version.rb
CHANGED
@@ -22,5 +22,12 @@ module Cellect::Server
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
it 'should handle missing workflows' do
|
27
|
+
allow(Workflow).to receive(:[]).with('missing').and_return nil
|
28
|
+
put '/workflows/missing/users/123/add_seen', subject_id: 123
|
29
|
+
expect(last_response.status).to eql 404
|
30
|
+
expect(last_response.body).to match /Not Found/
|
31
|
+
end
|
25
32
|
end
|
26
33
|
end
|
data/spec/server/api/add_spec.rb
CHANGED
@@ -36,5 +36,12 @@ module Cellect::Server
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
it 'should handle missing workflows' do
|
41
|
+
allow(Workflow).to receive(:[]).with('missing').and_return nil
|
42
|
+
put '/workflows/missing/add', subject_id: 123
|
43
|
+
expect(last_response.status).to eql 404
|
44
|
+
expect(last_response.body).to match /Not Found/
|
45
|
+
end
|
39
46
|
end
|
40
47
|
end
|
@@ -31,5 +31,12 @@ module Cellect::Server
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
it 'should handle missing workflows' do
|
36
|
+
allow(Workflow).to receive(:[]).with('missing').and_return nil
|
37
|
+
put '/workflows/missing/remove', subject_id: 123
|
38
|
+
expect(last_response.status).to eql 404
|
39
|
+
expect(last_response.body).to match /Not Found/
|
40
|
+
end
|
34
41
|
end
|
35
42
|
end
|
@@ -30,5 +30,12 @@ module Cellect::Server
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
it 'should handle missing workflows' do
|
35
|
+
allow(Workflow).to receive(:[]).with('missing').and_return nil
|
36
|
+
get '/workflows/missing', limit: 3, user_id: 123
|
37
|
+
expect(last_response.status).to eql 404
|
38
|
+
expect(last_response.body).to match /Not Found/
|
39
|
+
end
|
33
40
|
end
|
34
41
|
end
|
@@ -21,5 +21,12 @@ module Cellect::Server
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
it 'should handle missing workflows' do
|
26
|
+
allow(Workflow).to receive(:[]).with('missing').and_return nil
|
27
|
+
post '/workflows/missing/users/123/load'
|
28
|
+
expect(last_response.status).to eql 404
|
29
|
+
expect(last_response.body).to match /Not Found/
|
30
|
+
end
|
24
31
|
end
|
25
32
|
end
|
data/spec/server/server_spec.rb
CHANGED
@@ -38,7 +38,7 @@ module Cellect::Server
|
|
38
38
|
|
39
39
|
before(:each) do
|
40
40
|
pass_until{ all_workflows.all? &:ready? }
|
41
|
-
get
|
41
|
+
get '/stats'
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'should include information' do
|
@@ -69,6 +69,12 @@ module Cellect::Server
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
72
|
+
|
73
|
+
it 'should handle missing workflows' do
|
74
|
+
Workflow.names << 'missing'
|
75
|
+
get '/stats'
|
76
|
+
expect(last_response).to be_ok
|
77
|
+
end
|
72
78
|
end
|
73
79
|
end
|
74
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cellect-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Parrish
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|