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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a945054d21ad4dccae1e6a4447fef9dcbf7f30d4
4
- data.tar.gz: fee2b2070cff140fe90e41cce096e1f80d13e1d6
3
+ metadata.gz: c518a38534d81e84960fb603a85089268949d7ca
4
+ data.tar.gz: ba71be03ab92b66cfd378dbb555c735c83cd4043
5
5
  SHA512:
6
- metadata.gz: dc92be103ff6b6027bcd2b915430a9fe7877ed03077e71a8b00ac3f99e4f63c5b8c04db104a8abf1ab019453ed7f1fecd3ca8f5acd7032025f1f8c423e060a02
7
- data.tar.gz: a7b7cfb49ff7b3c196d1d3e6711c70af644b828aa732a6dd1021c777a3d28d5900c09abe2413858995d359723dc094eae9dc654feccdb6fcae2a6768c66a562d
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 reload_project(id)
10
- broadcast :post, "/projects/#{ id }/reload"
9
+ def reload_workflow(id)
10
+ broadcast :post, "/workflows/#{ id }/reload"
11
11
  end
12
12
 
13
- def delete_project(id)
14
- broadcast :delete, "/projects/#{ id }"
13
+ def delete_workflow(id)
14
+ broadcast :delete, "/workflows/#{ id }"
15
15
  end
16
16
 
17
- def add_subject(id, project_id: project_id, group_id: nil, priority: nil)
18
- broadcast :put, "/projects/#{ project_id }/add", querystring(subject_id: id, group_id: group_id, priority: priority)
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, project_id: project_id, group_id: nil)
22
- broadcast :put, "/projects/#{ project_id }/remove", querystring(subject_id: id, group_id: group_id)
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, project_id: project_id)
26
- send_http host, :post, "/projects/#{ project_id }/users/#{ id }/load"
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, project_id: project_id)
30
- send_http host, :put, "/projects/#{ project_id }/users/#{ user_id }/add_seen", querystring(subject_id: id)
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
@@ -1,3 +1,3 @@
1
1
  module Cellect
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -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 projects' do
20
- should_broadcast action: :post, url: 'projects/random/reload'
21
- connection.reload_project 'random'
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 projects' do
25
- should_broadcast action: :delete, url: 'projects/random'
26
- connection.delete_project 'random'
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: 'projects/random/add?subject_id=123'
31
- connection.add_subject 123, project_id: 'random'
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: 'projects/random/add?subject_id=123&group_id=321'
36
- connection.add_subject 123, project_id: 'random', group_id: 321
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: 'projects/random/add?subject_id=123&group_id=321&priority=0.123'
41
- connection.add_subject 123, project_id: 'random', group_id: 321, priority: 0.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: 'projects/random/remove?subject_id=123'
46
- connection.remove_subject 123, project_id: 'random'
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: 'projects/random/remove?subject_id=123&group_id=321'
51
- connection.remove_subject 123, project_id: 'random', group_id: 321
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: 'projects/random/users/123/load', to: 1
56
- connection.load_user 123, host: '1', project_id: 'random'
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: 'projects/random/users/123/add_seen?subject_id=456', to: 1
61
- connection.add_seen 456, host: '1', user_id: 123, project_id: 'random'
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
@@ -9,8 +9,7 @@ module Cellect::Client
9
9
  begin
10
10
  pass_until node_set, is: :ready
11
11
  node_set.zk.create '/nodes/node', data: 'foo', mode: :ephemeral_sequential
12
-
13
- 10.times do
12
+ 100.times do |i|
14
13
  break if node_set.nodes['node0000000001']
15
14
  Thread.pass
16
15
  end
@@ -1,12 +1,12 @@
1
- shared_examples_for 'project' do |name|
1
+ shared_examples_for 'workflow' do |name|
2
2
  let(:obj){ send name }
3
3
 
4
4
  before(:each) do
5
- Cellect::Server.adapter.load_project obj.name
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::Project
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 project_list
4
+ def workflow_list
5
5
  fixtures.values
6
6
  end
7
7
 
8
- def load_data_for(project_name)
9
- fixtures.fetch(project_name, { }).fetch 'entries', []
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 }/project_data/*.json"].collect do |f|
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(project_name, id)
33
+ def load_user(workflow_name, id)
34
34
  user = user_fixtures[id]
35
- user ? user[project_name] : user_fixtures['new_user'][project_name]
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.1
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-05-15 00:00:00.000000000 Z
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