Skip to content

Commit

Permalink
Added Analytics and Enrollment terms
Browse files Browse the repository at this point in the history
  • Loading branch information
Lannro committed Jun 22, 2018
1 parent ad19923 commit 95cf84a
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 2 deletions.
4 changes: 4 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@

from CanvasAPI import accounts
from CanvasAPI import admins
from CanvasAPI import analytics
from CanvasAPI import assignments
from CanvasAPI import courses
from CanvasAPI import custom_gradebook_columns
from CanvasAPI import enrollment_terms
from CanvasAPI import enrollments
from CanvasAPI import external_tools
from CanvasAPI import favorites
Expand All @@ -115,9 +117,11 @@
__all__ = ['instance',
'accounts',
'admins',
'analytics',
'assignments',
'courses',
'custom_gradebook_columns',
'enrollment_terms',
'enrollments',
'external_tools',
'favorites',
Expand Down
3 changes: 3 additions & 0 deletions analytics/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from CanvasAPI.analytics import activity, grades, statistics

__all__ = ["activity", "grades", "statistics"]
19 changes: 19 additions & 0 deletions analytics/activity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from CanvasAPI.util import callhelper
from CanvasAPI import instance

__all__ = ["get", "get_current", "get_completed"]

def get(account_id, term_id):
'''Get department-level participation data'''
url_str = "accounts/{}/analytics/terms/{}/activity".format(account_id, term_id)
return instance.all_pages(url_str)

def get_current(account_id):
'''Get department-level participation data'''
url_str = "accounts/{}/analytics/current/activity".format(account_id)
return instance.all_pages(url_str)

def get_completed(account_id):
'''Get department-level participation data'''
url_str = "accounts/{}/analytics/completed/activity".format(account_id)
return instance.all_pages(url_str)
19 changes: 19 additions & 0 deletions analytics/grades.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from CanvasAPI.util import callhelper
from CanvasAPI import instance

__all__ = ["get", "get_current", "get_completed"]

def get(account_id, term_id):
'''Get department-level grade data'''
url_str = "accounts/{}/analytics/terms/{}/grades".format(account_id, term_id)
return instance.all_pages(url_str)

def get_current(account_id):
'''Get department-level grade data'''
url_str = "accounts/{}/analytics/current/grades".format(account_id)
return instance.all_pages(url_str)

def get_completed(account_id):
'''Get department-level grade data'''
url_str = "accounts/{}/analytics/completed/grades".format(account_id)
return instance.all_pages(url_str)
19 changes: 19 additions & 0 deletions analytics/statistics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from CanvasAPI.util import callhelper
from CanvasAPI import instance

__all__ = ["get", "get_current", "get_completed"]

def get(account_id, term_id):
'''Get department-level statistics'''
url_str = "accounts/{}/analytics/terms/{}/statistics".format(account_id, term_id)
return instance.call_api(url_str)

def get_current(account_id):
'''Get department-level statistics'''
url_str = "accounts/{}/analytics/current/statistics".format(account_id)
return instance.call_api(url_str)

def get_completed(account_id):
'''Get department-level statistics'''
url_str = "accounts/{}/analytics/completed/statistics".format(account_id)
return instance.call_api(url_str)
9 changes: 9 additions & 0 deletions enrollment_terms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from CanvasAPI.util import callhelper
from CanvasAPI import instance

__all__ = ["get"]

def get(account_id, *args):
'''List enrollment terms'''
url_str = "accounts/{}/terms{}".format(account_id, callhelper.args_to_params(*args))
return instance.all_pages(url_str)
2 changes: 1 addition & 1 deletion enrollments/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
def get(user_id, *args):
'''List enrollments'''
url_str = "users/{}/enrollments{}".format(user_id, callhelper.args_to_params(*args))
return instance.call_api(url_str)
return instance.all_pages(url_str)

7 changes: 6 additions & 1 deletion sections/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from CanvasAPI.util import callhelper
from CanvasAPI import instance

__all__ = ["get", "delete", "cross_list_section"]
__all__ = ["get", "post", "delete", "cross_list_section"]


def get(section_id, *args):
Expand All @@ -19,3 +19,8 @@ def cross_list_section(section_id, new_course_id):
url_str = "sections/{}/crosslist/{}".format(section_id, new_course_id)
return instance.call_api(url_str, method="POST")


def post(course_id, name):
'''Create course section'''
url_str = "courses/{}/sections".format(course_id)
return instance.call_api(url_str, method="POST", post_fields={"course_section[name]":name})
Empty file added users/canvasapi.log
Empty file.

0 comments on commit 95cf84a

Please sign in to comment.