Module: Agilix::Buzz::Commands::Course
- Included in:
- Api
- Defined in:
- lib/agilix/buzz/commands/course.rb
Instance Method Summary collapse
-
#copy_courses(items = []) ⇒ Object
api.copy_courses [60982, domainid: 57025].
-
#create_courses(items = []) ⇒ Object
api.create_courses title: “Starter Course”, domainid: 57025.
-
#create_demo_course(options = {}) ⇒ Object
ISSUE: documentation on request format is inconsistent, not sure if it is bulk post or normal post format.
-
#deactivate_course(options = {}) ⇒ Object
ISSUE: get request should be delete, put, patch api.deactivate_course.
-
#delete_courses(items = []) ⇒ Object
ISSUE: Why so different than deactivate course api.delete_courses [60994].
-
#get_course2(options = {}) ⇒ Object
(also: #get_course)
api.get_course2 courseid: 60994.
-
#get_course_history(options = {}) ⇒ Object
api.get_course_history courseid: 60994.
-
#list_courses(options = {}) ⇒ Object
api.list_courses domainid: 5.
-
#merge_courses(items = []) ⇒ Object
api.merge_courses courseid: 60994.
-
#restore_course(options = {}) ⇒ Object
api.restore_course courseid: 60994.
-
#update_courses(items = []) ⇒ Object
api.update_courses [60994, title: “Updated Course”].
Instance Method Details
#copy_courses(items = []) ⇒ Object
api.copy_courses [60982, domainid: 57025]
7 8 9 10 11 12 |
# File 'lib/agilix/buzz/commands/course.rb', line 7 def copy_courses(items = []) = items.map do |item| argument_cleaner(required_params: %i( courseid domainid ), optional_params: %i( action depth reference status roleid title type startdate enddate days term indexrule ), options: item ) end authenticated_bulk_post cmd: "copycourses", root_node: "course", body: end |
#create_courses(items = []) ⇒ Object
api.create_courses title: “Starter Course”, domainid: 57025
15 16 17 18 19 20 21 |
# File 'lib/agilix/buzz/commands/course.rb', line 15 def create_courses(items = []) = items.map do |item| item[:schema] ||= 3 # should default to 3, 2 is old news argument_cleaner(required_params: %i( title domainid schema ), optional_params: %i(reference status roleid type startdate enddate days term indexrule data ), options: item ) end authenticated_bulk_post cmd: "createcourses", root_node: "course", body: end |
#create_demo_course(options = {}) ⇒ Object
ISSUE: documentation on request format is inconsistent, not sure if it is bulk post or normal post format. in one place rood node is request, in other its course api.create_demo_course courseid: 60982, domainid: 57025, title: “Demo Course”, daysoffset: 60
25 26 27 28 |
# File 'lib/agilix/buzz/commands/course.rb', line 25 def create_demo_course( = {}) = argument_cleaner(required_params: %i( courseid domainid ), optional_params: %i( schema reference title daysoffset usermap ), options: ) authenticated_post cmd: "createdemocourse", ** end |
#deactivate_course(options = {}) ⇒ Object
ISSUE: get request should be delete, put, patch api.deactivate_course
32 33 34 35 |
# File 'lib/agilix/buzz/commands/course.rb', line 32 def deactivate_course( = {}) = argument_cleaner(required_params: %i( courseid ), optional_params: %i( ), options: ) authenticated_get cmd: "deactivatecourse", ** end |
#delete_courses(items = []) ⇒ Object
ISSUE: Why so different than deactivate course api.delete_courses [60994]
39 40 41 42 43 44 |
# File 'lib/agilix/buzz/commands/course.rb', line 39 def delete_courses(items = []) = items.map do |item| argument_cleaner(required_params: %i( courseid ), optional_params: %i(), options: item ) end authenticated_bulk_post cmd: "deletecourses", root_node: "course", body: end |
#get_course2(options = {}) ⇒ Object Also known as: get_course
api.get_course2 courseid: 60994
47 48 49 50 |
# File 'lib/agilix/buzz/commands/course.rb', line 47 def get_course2( = {}) = argument_cleaner(required_params: %i( courseid ), optional_params: %i( select version ), options: ) authenticated_get cmd: "getcourse2", ** end |
#get_course_history(options = {}) ⇒ Object
api.get_course_history courseid: 60994
54 55 56 57 |
# File 'lib/agilix/buzz/commands/course.rb', line 54 def get_course_history( = {}) = argument_cleaner(required_params: %i( courseid ), optional_params: %i( ), options: ) authenticated_get cmd: "getcoursehistory", ** end |
#list_courses(options = {}) ⇒ Object
api.list_courses domainid: 5
60 61 62 63 64 |
# File 'lib/agilix/buzz/commands/course.rb', line 60 def list_courses( = {}) [:domainid] ||= 0 = argument_cleaner(required_params: %i( domainid ), optional_params: %i( includedescendantdomains limit show select text query subtype subscriptionmode subscriptiondomainid ), options: ) authenticated_get cmd: "listcourses", ** end |
#merge_courses(items = []) ⇒ Object
api.merge_courses courseid: 60994
67 68 69 70 71 72 |
# File 'lib/agilix/buzz/commands/course.rb', line 67 def merge_courses(items = []) = items.map do |item| argument_cleaner(required_params: %i( courseid ), optional_params: %i( ), options: item ) end authenticated_bulk_post cmd: "mergecourses", root_node: "course", body: end |
#restore_course(options = {}) ⇒ Object
api.restore_course courseid: 60994
75 76 77 78 |
# File 'lib/agilix/buzz/commands/course.rb', line 75 def restore_course( = {}) = argument_cleaner(required_params: %i( courseid ), optional_params: %i( ), options: ) authenticated_get cmd: "restorecourse", ** end |
#update_courses(items = []) ⇒ Object
api.update_courses [60994, title: “Updated Course”]
81 82 83 84 85 86 |
# File 'lib/agilix/buzz/commands/course.rb', line 81 def update_courses(items = []) = items.map do |item| argument_cleaner(required_params: %i( courseid ), optional_params: %i( domainid title reference type baseid startdate enddate days term indexrule schema data ), options: item ) end authenticated_bulk_post cmd: "updatecourses", root_node: "course", body: end |