cellect-client 0.0.1 → 0.0.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/client/connection.rb +16 -12
- data/lib/cellect/version.rb +1 -1
- data/spec/client/connection_spec.rb +27 -20
- data/spec/client/node_set_spec.rb +1 -2
- data/spec/fixtures/{project_data → workflow_data}/grouped_pairwise_priority.json +0 -0
- data/spec/fixtures/{project_data → workflow_data}/grouped_pairwise_random.json +0 -0
- data/spec/fixtures/{project_data → workflow_data}/grouped_priority.json +0 -0
- data/spec/fixtures/{project_data → workflow_data}/grouped_random.json +0 -0
- data/spec/fixtures/{project_data → workflow_data}/pairwise_priority.json +0 -0
- data/spec/fixtures/{project_data → workflow_data}/pairwise_random.json +0 -0
- data/spec/fixtures/{project_data → workflow_data}/priority.json +0 -0
- data/spec/fixtures/{project_data → workflow_data}/random.json +0 -0
- data/spec/support/{shared_examples_for_project.rb → shared_examples_for_workflow.rb} +3 -3
- data/spec/support/spec_adapter.rb +6 -6
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c518a38534d81e84960fb603a85089268949d7ca
|
4
|
+
data.tar.gz: ba71be03ab92b66cfd378dbb555c735c83cd4043
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: decf62a6c9470b6975d2f11a06039e37794d7f8eb2175388143235e1a4e75e677b372ed2907f9a501561a48b68374c6d34e398c5f47025c56f5ee8711736d0a6
|
7
|
+
data.tar.gz: bc56057cbe643cf9751095c5a01fa5f48d7fcfb1f815bfe1d85da034694d66286932d867b2111cba32e60ad213d8f4533958c891a2bcdda0dfd2d6993101082f
|
@@ -6,28 +6,32 @@ module Cellect
|
|
6
6
|
include Celluloid
|
7
7
|
include Celluloid::IO
|
8
8
|
|
9
|
-
def
|
10
|
-
broadcast :post, "/
|
9
|
+
def reload_workflow(id)
|
10
|
+
broadcast :post, "/workflows/#{ id }/reload"
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
broadcast :delete, "/
|
13
|
+
def delete_workflow(id)
|
14
|
+
broadcast :delete, "/workflows/#{ id }"
|
15
15
|
end
|
16
16
|
|
17
|
-
def add_subject(id,
|
18
|
-
broadcast :put, "/
|
17
|
+
def add_subject(id, workflow_id: workflow_id, group_id: nil, priority: nil)
|
18
|
+
broadcast :put, "/workflows/#{ workflow_id }/add", querystring(subject_id: id, group_id: group_id, priority: priority)
|
19
19
|
end
|
20
20
|
|
21
|
-
def remove_subject(id,
|
22
|
-
broadcast :put, "/
|
21
|
+
def remove_subject(id, workflow_id: workflow_id, group_id: nil)
|
22
|
+
broadcast :put, "/workflows/#{ workflow_id }/remove", querystring(subject_id: id, group_id: group_id)
|
23
23
|
end
|
24
24
|
|
25
|
-
def load_user(id, host: host,
|
26
|
-
send_http host, :post, "/
|
25
|
+
def load_user(id, host: host, workflow_id: workflow_id)
|
26
|
+
send_http host, :post, "/workflows/#{ workflow_id }/users/#{ id }/load"
|
27
27
|
end
|
28
28
|
|
29
|
-
def add_seen(id, user_id: user_id, host: host,
|
30
|
-
send_http host, :put, "/
|
29
|
+
def add_seen(id, user_id: user_id, host: host, workflow_id: workflow_id)
|
30
|
+
send_http host, :put, "/workflows/#{ workflow_id }/users/#{ user_id }/add_seen", querystring(subject_id: id)
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_subjects(user_id: user_id, host: host, workflow_id: workflow_id, limit: limit, group_id: group_id)
|
34
|
+
send_http host, :get, "/workflows/#{ workflow_id }", querystring(user_id: user_id, group_id: group_id, limit: limit)
|
31
35
|
end
|
32
36
|
|
33
37
|
protected
|
data/lib/cellect/version.rb
CHANGED
@@ -16,49 +16,56 @@ module Cellect::Client
|
|
16
16
|
[1, 2].each{ |i| should_send action: action, url: url, to: i }
|
17
17
|
end
|
18
18
|
|
19
|
-
it 'should reload
|
20
|
-
should_broadcast action: :post, url: '
|
21
|
-
connection.
|
19
|
+
it 'should reload workflows' do
|
20
|
+
should_broadcast action: :post, url: 'workflows/random/reload'
|
21
|
+
connection.reload_workflow 'random'
|
22
22
|
end
|
23
23
|
|
24
|
-
it 'should delete
|
25
|
-
should_broadcast action: :delete, url: '
|
26
|
-
connection.
|
24
|
+
it 'should delete workflows' do
|
25
|
+
should_broadcast action: :delete, url: 'workflows/random'
|
26
|
+
connection.delete_workflow 'random'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should add subjects' do
|
30
|
-
should_broadcast action: :put, url: '
|
31
|
-
connection.add_subject 123,
|
30
|
+
should_broadcast action: :put, url: 'workflows/random/add?subject_id=123'
|
31
|
+
connection.add_subject 123, workflow_id: 'random'
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should add grouped subjects' do
|
35
|
-
should_broadcast action: :put, url: '
|
36
|
-
connection.add_subject 123,
|
35
|
+
should_broadcast action: :put, url: 'workflows/random/add?subject_id=123&group_id=321'
|
36
|
+
connection.add_subject 123, workflow_id: 'random', group_id: 321
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should add prioritized grouped subjects' do
|
40
|
-
should_broadcast action: :put, url: '
|
41
|
-
connection.add_subject 123,
|
40
|
+
should_broadcast action: :put, url: 'workflows/random/add?subject_id=123&group_id=321&priority=0.123'
|
41
|
+
connection.add_subject 123, workflow_id: 'random', group_id: 321, priority: 0.123
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'should remove subjects' do
|
45
|
-
should_broadcast action: :put, url: '
|
46
|
-
connection.remove_subject 123,
|
45
|
+
should_broadcast action: :put, url: 'workflows/random/remove?subject_id=123'
|
46
|
+
connection.remove_subject 123, workflow_id: 'random'
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should remove grouped subjects' do
|
50
|
-
should_broadcast action: :put, url: '
|
51
|
-
connection.remove_subject 123,
|
50
|
+
should_broadcast action: :put, url: 'workflows/random/remove?subject_id=123&group_id=321'
|
51
|
+
connection.remove_subject 123, workflow_id: 'random', group_id: 321
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'should load users' do
|
55
|
-
should_send action: :post, url: '
|
56
|
-
connection.load_user 123, host: '1',
|
55
|
+
should_send action: :post, url: 'workflows/random/users/123/load', to: 1
|
56
|
+
connection.load_user 123, host: '1', workflow_id: 'random'
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should add seen subjects' do
|
60
|
-
should_send action: :put, url: '
|
61
|
-
connection.add_seen 456, host: '1', user_id: 123,
|
60
|
+
should_send action: :put, url: 'workflows/random/users/123/add_seen?subject_id=456', to: 1
|
61
|
+
connection.add_seen 456, host: '1', user_id: 123, workflow_id: 'random'
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should get subjects' do
|
65
|
+
should_send action: :get, url: 'workflows/random?user_id=1&limit=10&group_id=1', to: 1
|
66
|
+
connection.get_subjects host: 1, workflow_id: 'random', user_id: 1, limit: 10, group_id: 1
|
67
|
+
should_send action: :get, url: 'workflows/random?user_id=1', to: 1
|
68
|
+
connection.get_subjects host: 1, workflow_id: 'random', user_id: 1
|
62
69
|
end
|
63
70
|
end
|
64
71
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,12 +1,12 @@
|
|
1
|
-
shared_examples_for '
|
1
|
+
shared_examples_for 'workflow' do |name|
|
2
2
|
let(:obj){ send name }
|
3
3
|
|
4
4
|
before(:each) do
|
5
|
-
Cellect::Server.adapter.
|
5
|
+
Cellect::Server.adapter.load_workflow obj.name
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should add singleton instances to the registry' do
|
9
|
-
obj.class[:foo].should be_a_kind_of Cellect::Server::
|
9
|
+
obj.class[:foo].should be_a_kind_of Cellect::Server::Workflow
|
10
10
|
obj.class[:foo].object_id.should == obj.class[:foo].object_id
|
11
11
|
end
|
12
12
|
|
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'oj'
|
2
2
|
|
3
3
|
class SpecAdapter < Cellect::Server::Adapters::Default
|
4
|
-
def
|
4
|
+
def workflow_list
|
5
5
|
fixtures.values
|
6
6
|
end
|
7
7
|
|
8
|
-
def load_data_for(
|
9
|
-
fixtures.fetch(
|
8
|
+
def load_data_for(workflow_name)
|
9
|
+
fixtures.fetch(workflow_name, { }).fetch 'entries', []
|
10
10
|
end
|
11
11
|
|
12
12
|
def fixtures
|
13
13
|
@fixtures ||= { }.tap do |fixtures|
|
14
|
-
Dir["#{ _fixture_path }/
|
14
|
+
Dir["#{ _fixture_path }/workflow_data/*.json"].collect do |f|
|
15
15
|
name = File.basename(f).sub /\.json$/, ''
|
16
16
|
data = Oj.strict_load File.read f
|
17
17
|
fixtures[name] = data
|
@@ -30,9 +30,9 @@ class SpecAdapter < Cellect::Server::Adapters::Default
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def load_user(
|
33
|
+
def load_user(workflow_name, id)
|
34
34
|
user = user_fixtures[id]
|
35
|
-
user ? user[
|
35
|
+
user ? user[workflow_name] : user_fixtures['new_user'][workflow_name]
|
36
36
|
end
|
37
37
|
|
38
38
|
protected
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cellect-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.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: 2014-
|
11
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -174,23 +174,23 @@ files:
|
|
174
174
|
- log/.gitkeep
|
175
175
|
- spec/client/connection_spec.rb
|
176
176
|
- spec/client/node_set_spec.rb
|
177
|
-
- spec/fixtures/project_data/grouped_pairwise_priority.json
|
178
|
-
- spec/fixtures/project_data/grouped_pairwise_random.json
|
179
|
-
- spec/fixtures/project_data/grouped_priority.json
|
180
|
-
- spec/fixtures/project_data/grouped_random.json
|
181
|
-
- spec/fixtures/project_data/pairwise_priority.json
|
182
|
-
- spec/fixtures/project_data/pairwise_random.json
|
183
|
-
- spec/fixtures/project_data/priority.json
|
184
|
-
- spec/fixtures/project_data/random.json
|
185
177
|
- spec/fixtures/user_data/complete_user.json
|
186
178
|
- spec/fixtures/user_data/new_user.json
|
187
179
|
- spec/fixtures/user_data/partial_user.json
|
180
|
+
- spec/fixtures/workflow_data/grouped_pairwise_priority.json
|
181
|
+
- spec/fixtures/workflow_data/grouped_pairwise_random.json
|
182
|
+
- spec/fixtures/workflow_data/grouped_priority.json
|
183
|
+
- spec/fixtures/workflow_data/grouped_random.json
|
184
|
+
- spec/fixtures/workflow_data/pairwise_priority.json
|
185
|
+
- spec/fixtures/workflow_data/pairwise_random.json
|
186
|
+
- spec/fixtures/workflow_data/priority.json
|
187
|
+
- spec/fixtures/workflow_data/random.json
|
188
188
|
- spec/spec_helper.rb
|
189
189
|
- spec/support/cellect_helper.rb
|
190
190
|
- spec/support/shared_api_context.rb
|
191
191
|
- spec/support/shared_examples_for_node_set.rb
|
192
|
-
- spec/support/shared_examples_for_project.rb
|
193
192
|
- spec/support/shared_examples_for_set.rb
|
193
|
+
- spec/support/shared_examples_for_workflow.rb
|
194
194
|
- spec/support/spec_adapter.rb
|
195
195
|
- spec/support/zk_setup.rb
|
196
196
|
- tmp/.gitkeep
|
@@ -221,22 +221,22 @@ summary: ''
|
|
221
221
|
test_files:
|
222
222
|
- spec/client/connection_spec.rb
|
223
223
|
- spec/client/node_set_spec.rb
|
224
|
-
- spec/fixtures/project_data/grouped_pairwise_priority.json
|
225
|
-
- spec/fixtures/project_data/grouped_pairwise_random.json
|
226
|
-
- spec/fixtures/project_data/grouped_priority.json
|
227
|
-
- spec/fixtures/project_data/grouped_random.json
|
228
|
-
- spec/fixtures/project_data/pairwise_priority.json
|
229
|
-
- spec/fixtures/project_data/pairwise_random.json
|
230
|
-
- spec/fixtures/project_data/priority.json
|
231
|
-
- spec/fixtures/project_data/random.json
|
232
224
|
- spec/fixtures/user_data/complete_user.json
|
233
225
|
- spec/fixtures/user_data/new_user.json
|
234
226
|
- spec/fixtures/user_data/partial_user.json
|
227
|
+
- spec/fixtures/workflow_data/grouped_pairwise_priority.json
|
228
|
+
- spec/fixtures/workflow_data/grouped_pairwise_random.json
|
229
|
+
- spec/fixtures/workflow_data/grouped_priority.json
|
230
|
+
- spec/fixtures/workflow_data/grouped_random.json
|
231
|
+
- spec/fixtures/workflow_data/pairwise_priority.json
|
232
|
+
- spec/fixtures/workflow_data/pairwise_random.json
|
233
|
+
- spec/fixtures/workflow_data/priority.json
|
234
|
+
- spec/fixtures/workflow_data/random.json
|
235
235
|
- spec/spec_helper.rb
|
236
236
|
- spec/support/cellect_helper.rb
|
237
237
|
- spec/support/shared_api_context.rb
|
238
238
|
- spec/support/shared_examples_for_node_set.rb
|
239
|
-
- spec/support/shared_examples_for_project.rb
|
240
239
|
- spec/support/shared_examples_for_set.rb
|
240
|
+
- spec/support/shared_examples_for_workflow.rb
|
241
241
|
- spec/support/spec_adapter.rb
|
242
242
|
- spec/support/zk_setup.rb
|