Class: Cellect::Client::Connection
- Inherits:
-
Object
- Object
- Cellect::Client::Connection
- Defined in:
- lib/cellect/client/connection.rb
Class Attribute Summary collapse
-
.timeout ⇒ Object
Returns the value of attribute timeout.
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.
Class Attribute Details
.timeout ⇒ Object
Returns the value of attribute timeout.
9 10 11 |
# File 'lib/cellect/client/connection.rb', line 9 def timeout @timeout end |
Instance Method Details
#add_seen(subject_id:, user_id:, host:, workflow_id:) ⇒ Object
Adds a subject to a users seen set
40 41 42 |
# File 'lib/cellect/client/connection.rb', line 40 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
25 26 27 |
# File 'lib/cellect/client/connection.rb', line 25 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
20 21 22 |
# File 'lib/cellect/client/connection.rb', line 20 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
45 46 47 48 49 |
# File 'lib/cellect/client/connection.rb', line 45 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
35 36 37 |
# File 'lib/cellect/client/connection.rb', line 35 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
15 16 17 |
# File 'lib/cellect/client/connection.rb', line 15 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
30 31 32 |
# File 'lib/cellect/client/connection.rb', line 30 def remove_subject(id, workflow_id:, group_id: nil) broadcast :put, "/workflows/#{ workflow_id }/remove", querystring(subject_id: id, group_id: group_id) end |