Class: Cellect::Client::Connection
- Inherits:
-
Object
- Object
- Cellect::Client::Connection
- Includes:
- Celluloid, Celluloid::IO
- Defined in:
- lib/cellect/client/connection.rb
Instance Method Summary collapse
-
#add_seen(subject_id:, user_id:, host:, workflow_id:) ⇒ Object
Adds a subject to a users seen set.
-
#add_subject(id, workflow_id:, group_id: nil, priority: nil) ⇒ Object
Adds or updates a subject on all servers.
-
#delete_workflow(id) ⇒ Object
Remove the workflow from all servers.
-
#get_subjects(user_id:, host:, workflow_id:, limit: nil, group_id: nil) ⇒ Object
Gets unseen subjects for a user.
-
#load_user(user_id:, host:, workflow_id:) ⇒ Object
Preload a user on a server.
-
#reload_workflow(id) ⇒ Object
Reload the data for a workflow on all servers.
-
#remove_subject(id, workflow_id:, group_id: nil) ⇒ Object
Removes a subject on all servers.
Instance Method Details
#add_seen(subject_id:, user_id:, host:, workflow_id:) ⇒ Object
Adds a subject to a users seen set
37 38 39 |
# File 'lib/cellect/client/connection.rb', line 37 def add_seen(subject_id:, user_id:, host:, workflow_id:) send_http host, :put, "/workflows/#{ workflow_id }/users/#{ user_id }/add_seen", querystring(subject_id: subject_id) end |
#add_subject(id, workflow_id:, group_id: nil, priority: nil) ⇒ Object
Adds or updates a subject on all servers
22 23 24 |
# File 'lib/cellect/client/connection.rb', line 22 def add_subject(id, workflow_id:, group_id: nil, priority: nil) broadcast :put, "/workflows/#{ workflow_id }/add", querystring(subject_id: id, group_id: group_id, priority: priority) end |
#delete_workflow(id) ⇒ Object
Remove the workflow from all servers
17 18 19 |
# File 'lib/cellect/client/connection.rb', line 17 def delete_workflow(id) broadcast :delete, "/workflows/#{ id }" end |
#get_subjects(user_id:, host:, workflow_id:, limit: nil, group_id: nil) ⇒ Object
Gets unseen subjects for a user
42 43 44 45 46 |
# File 'lib/cellect/client/connection.rb', line 42 def get_subjects(user_id:, host:, workflow_id:, limit: nil, group_id: nil) response = send_http host, :get, "/workflows/#{ workflow_id }", querystring(user_id: user_id, group_id: group_id, limit: limit) ensure_valid_response response MultiJson.load response.body end |
#load_user(user_id:, host:, workflow_id:) ⇒ Object
Preload a user on a server
32 33 34 |
# File 'lib/cellect/client/connection.rb', line 32 def load_user(user_id:, host:, workflow_id:) send_http host, :post, "/workflows/#{ workflow_id }/users/#{ user_id }/load" end |
#reload_workflow(id) ⇒ Object
Reload the data for a workflow on all servers
12 13 14 |
# File 'lib/cellect/client/connection.rb', line 12 def reload_workflow(id) broadcast :post, "/workflows/#{ id }/reload" end |
#remove_subject(id, workflow_id:, group_id: nil) ⇒ Object
Removes a subject on all servers
27 28 29 |
# File 'lib/cellect/client/connection.rb', line 27 def remove_subject(id, workflow_id:, group_id: nil) broadcast :put, "/workflows/#{ workflow_id }/remove", querystring(subject_id: id, group_id: group_id) end |