Module: Checkpoints
Instance Method Summary collapse
-
#batch_create_checkpoints(section_id = nil, checkpoints = []) ⇒ Array
Create multiple checkpoints in a single request.
-
#get_checkpoint(id) ⇒ Checkpoint
Get a checkpoint.
-
#update_checkpoint(id, options = {}) ⇒ Checkpoint
Update a checkpoint.
Methods included from BaseClient
#auth_header, #convert_keys, #convert_response, #handle_timeouts, #success?, #whitelist_params
Instance Method Details
#batch_create_checkpoints(section_id = nil, checkpoints = []) ⇒ Array
Create multiple checkpoints in a single request
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/client/checkpoints.rb', line 67 def batch_create_checkpoints(section_id=nil, checkpoints=[]) url = "#{@api_base_path}/checkpoints/batch_create" handle_timeouts do response = self.class.post( url, headers: auth_header, body: { section_id: section_id, checkpoints: checkpoints } ) convert_response(response, "checkpoint") end end |
#get_checkpoint(id) ⇒ Checkpoint
Get a checkpoint
11 12 13 14 15 16 17 18 |
# File 'lib/client/checkpoints.rb', line 11 def get_checkpoint(id) url = "#{@api_base_path}/checkpoints/#{id}" handle_timeouts do response = self.class.get(url, headers: auth_header) convert_response(response, "checkpoint") end end |
#update_checkpoint(id, options = {}) ⇒ Checkpoint
Update a checkpoint
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/client/checkpoints.rb', line 34 def update_checkpoint(id, ={}) whitelist = ['name', 'summary', 'body', 'assignment','body_and_assignment', 'points'] = convert_keys() checkpoint_params = whitelist_params(, whitelist) url = "#{@api_base_path}/checkpoints/#{id}" handle_timeouts do response = self.class.put(url, headers: auth_header, body: { checkpoint: checkpoint_params }) convert_response(response, "checkpoint") end end |