-
Notifications
You must be signed in to change notification settings - Fork 7
/
restdemo.php
92 lines (62 loc) · 2.34 KB
/
restdemo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
require_once('classes/Rest.class.php');
require_once('classes/Token.class.php');
require_once('classes/Datasource.class.php');
require_once('classes/Term.class.php');
require_once('classes/Course.class.php');
require_once('classes/User.class.php');
require_once('classes/Membership.class.php');
$rest = new Rest();
$token = new Token();
$datasource = new Datasource();
$term = new Term();
$course = new Course();
$user = new User();
$membership = new Membership();
$token = $rest->authorize();
var_dump($token);
$access_token = $token->access_token;
$datasource = $rest->createDatasource($access_token);
var_dump($datasource);
$dsk_id = $datasource->id;
$datasource = $rest->readDatasource($access_token,$dsk_id);
var_dump($datasource);
$datasource = $rest->updateDatasource($access_token,$dsk_id);
var_dump($datasource);
$term = $rest->createTerm($access_token, $dsk_id);
var_dump($term);
$term_id = $term->id;
$term = $rest->readTerm($access_token, $term_id);
var_dump($term);
$term = $rest->updateTerm($access_token, $dsk_id, $term_id);
var_dump($term);
$course = $rest->createCourse($access_token, $dsk_id, $term_id);
var_dump($course);
$course_id = $course->id;
$course = $rest->readCourse($access_token, $course_id);
var_dump($course);
$course = $rest->updateCourse($access_token, $dsk_id, $course_id, $course->uuid, $course->created, $term_id);
var_dump($course);
$user = $rest->createUser($access_token, $dsk_id);
var_dump($user);
$user_id = $user->id;
$user = $rest->readUser($access_token, $user_id);
var_dump($user);
$user = $rest->updateUser($access_token, $dsk_id, $user_id, $user->uuid, $user->created);
var_dump($user);
$membership = $rest->createMembership($access_token, $dsk_id, $course_id, $user_id);
var_dump($membership);
$membership = $rest->readMembership($access_token, $course_id, $user_id);
var_dump($membership);
$membership = $rest->updateMembership($access_token, $dsk_id, $course_id, $user_id, $membership->created);
var_dump($membership);
$result = $rest->deleteMembership($access_token, $course_id, $user_id);
var_dump($result);
$result = $rest->deleteUser($access_token, $user_id);
var_dump($result);
$result = $rest->deleteCourse($access_token, $course_id);
var_dump($result);
$result = $rest->deleteTerm($access_token, $term_id);
var_dump($result);
$result = $rest->deleteDatasource($access_token,$dsk_id);
var_dump($result);