moodle_rb 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/moodle_rb/categories.rb +5 -5
- data/lib/moodle_rb/client.rb +1 -0
- data/lib/moodle_rb/courses.rb +7 -6
- data/lib/moodle_rb/enrolments.rb +2 -5
- data/lib/moodle_rb/grades.rb +4 -10
- data/lib/moodle_rb/users.rb +10 -11
- data/lib/moodle_rb/utility.rb +7 -0
- data/lib/moodle_rb/version.rb +1 -1
- data/spec/cassettes/MoodleRb_Categories/_destroy/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Categories/_destroy/{.yml → when_using_valid_token/.yml} +29 -29
- data/spec/cassettes/MoodleRb_Categories/_index/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Categories/_show/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Courses/_destroy/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Courses/_destroy/{.yml → when_using_valid_token/.yml} +37 -37
- data/spec/cassettes/MoodleRb_Courses/_destroy/when_using_valid_token/when_using_invalid_course_id/.yml +39 -0
- data/spec/cassettes/MoodleRb_Courses/_enrolled_users/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Courses/_enrolled_users/when_using_valid_token/.yml +75 -0
- data/spec/cassettes/MoodleRb_Courses/_index/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Courses/_show/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Users/_destroy/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Users/_enrolled_courses/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Users/_search/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Users/_show/when_using_invalid_token/.yml +39 -0
- data/spec/cassettes/MoodleRb_Users/_update/when_using_invalid_token/.yml +39 -0
- data/spec/lib/moodle_rb/categories_spec.rb +36 -4
- data/spec/lib/moodle_rb/client_spec.rb +4 -2
- data/spec/lib/moodle_rb/courses_spec.rb +70 -13
- data/spec/lib/moodle_rb/users_spec.rb +56 -1
- metadata +36 -10
- data/spec/cassettes/MoodleRb_Courses/_enrolled_users/.yml +0 -75
data/lib/moodle_rb/categories.rb
CHANGED
@@ -18,6 +18,7 @@ module MoodleRb
|
|
18
18
|
:query => query_hash('core_course_get_categories', token)
|
19
19
|
}
|
20
20
|
)
|
21
|
+
check_for_errors(response)
|
21
22
|
response.parsed_response
|
22
23
|
end
|
23
24
|
|
@@ -48,11 +49,8 @@ module MoodleRb
|
|
48
49
|
}
|
49
50
|
}
|
50
51
|
)
|
51
|
-
|
52
|
-
|
53
|
-
else
|
54
|
-
response.parsed_response.first
|
55
|
-
end
|
52
|
+
check_for_errors(response)
|
53
|
+
response.parsed_response.first
|
56
54
|
end
|
57
55
|
|
58
56
|
def show(id)
|
@@ -70,6 +68,7 @@ module MoodleRb
|
|
70
68
|
}
|
71
69
|
}
|
72
70
|
)
|
71
|
+
check_for_errors(response)
|
73
72
|
response.parsed_response.first
|
74
73
|
end
|
75
74
|
|
@@ -88,6 +87,7 @@ module MoodleRb
|
|
88
87
|
}
|
89
88
|
}
|
90
89
|
)
|
90
|
+
check_for_errors(response)
|
91
91
|
response.parsed_response.nil?
|
92
92
|
end
|
93
93
|
end
|
data/lib/moodle_rb/client.rb
CHANGED
data/lib/moodle_rb/courses.rb
CHANGED
@@ -17,6 +17,7 @@ module MoodleRb
|
|
17
17
|
:query => query_hash('core_course_get_courses', token)
|
18
18
|
}
|
19
19
|
)
|
20
|
+
check_for_errors(response)
|
20
21
|
response.parsed_response
|
21
22
|
end
|
22
23
|
|
@@ -46,11 +47,8 @@ module MoodleRb
|
|
46
47
|
}
|
47
48
|
}
|
48
49
|
)
|
49
|
-
|
50
|
-
|
51
|
-
else
|
52
|
-
response.parsed_response.first
|
53
|
-
end
|
50
|
+
check_for_errors(response)
|
51
|
+
response.parsed_response.first
|
54
52
|
end
|
55
53
|
|
56
54
|
def show(id)
|
@@ -67,6 +65,7 @@ module MoodleRb
|
|
67
65
|
}
|
68
66
|
}
|
69
67
|
)
|
68
|
+
check_for_errors(response)
|
70
69
|
response.parsed_response.first
|
71
70
|
end
|
72
71
|
|
@@ -82,7 +81,8 @@ module MoodleRb
|
|
82
81
|
}
|
83
82
|
}
|
84
83
|
)
|
85
|
-
response
|
84
|
+
check_for_errors(response)
|
85
|
+
response.parsed_response
|
86
86
|
end
|
87
87
|
|
88
88
|
def enrolled_users(course_id)
|
@@ -95,6 +95,7 @@ module MoodleRb
|
|
95
95
|
}
|
96
96
|
}
|
97
97
|
)
|
98
|
+
check_for_errors(response)
|
98
99
|
response.parsed_response
|
99
100
|
end
|
100
101
|
end
|
data/lib/moodle_rb/enrolments.rb
CHANGED
@@ -29,11 +29,8 @@ module MoodleRb
|
|
29
29
|
}
|
30
30
|
}
|
31
31
|
)
|
32
|
-
|
33
|
-
|
34
|
-
else
|
35
|
-
response.code == 200 && response.parsed_response.nil?
|
36
|
-
end
|
32
|
+
check_for_errors(response)
|
33
|
+
response.code == 200 && response.parsed_response.nil?
|
37
34
|
end
|
38
35
|
end
|
39
36
|
end
|
data/lib/moodle_rb/grades.rb
CHANGED
@@ -20,11 +20,8 @@ module MoodleRb
|
|
20
20
|
}
|
21
21
|
}
|
22
22
|
)
|
23
|
-
|
24
|
-
|
25
|
-
else
|
26
|
-
response.parsed_response['assignments']
|
27
|
-
end
|
23
|
+
check_for_errors(response)
|
24
|
+
response.parsed_response['assignments']
|
28
25
|
end
|
29
26
|
|
30
27
|
def by_course(course_id, *user_ids)
|
@@ -38,11 +35,8 @@ module MoodleRb
|
|
38
35
|
}
|
39
36
|
}
|
40
37
|
)
|
41
|
-
|
42
|
-
|
43
|
-
else
|
44
|
-
response.parsed_response['items']
|
45
|
-
end
|
38
|
+
check_for_errors(response)
|
39
|
+
response.parsed_response['items']
|
46
40
|
end
|
47
41
|
end
|
48
42
|
end
|
data/lib/moodle_rb/users.rb
CHANGED
@@ -27,11 +27,8 @@ module MoodleRb
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
)
|
30
|
-
|
31
|
-
|
32
|
-
else
|
33
|
-
response.parsed_response.first
|
34
|
-
end
|
30
|
+
check_for_errors(response)
|
31
|
+
response.parsed_response.first
|
35
32
|
end
|
36
33
|
|
37
34
|
def show(id)
|
@@ -49,7 +46,9 @@ module MoodleRb
|
|
49
46
|
}
|
50
47
|
}
|
51
48
|
)
|
52
|
-
response
|
49
|
+
check_for_errors(response)
|
50
|
+
response.parsed_response['users'] &&
|
51
|
+
response.parsed_response['users'].first
|
53
52
|
end
|
54
53
|
|
55
54
|
def destroy(id)
|
@@ -64,6 +63,7 @@ module MoodleRb
|
|
64
63
|
}
|
65
64
|
}
|
66
65
|
)
|
66
|
+
check_for_errors(response)
|
67
67
|
response.parsed_response.nil?
|
68
68
|
end
|
69
69
|
|
@@ -77,6 +77,7 @@ module MoodleRb
|
|
77
77
|
}
|
78
78
|
}
|
79
79
|
)
|
80
|
+
check_for_errors(response)
|
80
81
|
response.parsed_response
|
81
82
|
end
|
82
83
|
|
@@ -92,6 +93,7 @@ module MoodleRb
|
|
92
93
|
}
|
93
94
|
}
|
94
95
|
)
|
96
|
+
check_for_errors(response)
|
95
97
|
response.parsed_response['users']
|
96
98
|
end
|
97
99
|
|
@@ -110,11 +112,8 @@ module MoodleRb
|
|
110
112
|
}
|
111
113
|
}
|
112
114
|
)
|
113
|
-
|
114
|
-
|
115
|
-
else
|
116
|
-
response.response.code == '200'
|
117
|
-
end
|
115
|
+
check_for_errors(response)
|
116
|
+
response.response.code == '200'
|
118
117
|
end
|
119
118
|
end
|
120
119
|
end
|
data/lib/moodle_rb/utility.rb
CHANGED
@@ -27,6 +27,13 @@ module MoodleRb
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
def check_for_errors(response)
|
31
|
+
return unless error_response?(response)
|
32
|
+
raise MoodleError.new(response.parsed_response)
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
30
37
|
def error_response?(response)
|
31
38
|
response && response.parsed_response.is_a?(Hash) &&
|
32
39
|
response.parsed_response.has_key?('exception')
|
data/lib/moodle_rb/version.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.9.3
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: post
|
6
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_create_categories&wstoken=
|
7
|
+
body:
|
8
|
+
string: categories[0][description]=&categories[0][parent]=0&categories[0][name]=_&categories[0][idnumber]=
|
9
|
+
headers: {}
|
10
|
+
|
11
|
+
response:
|
12
|
+
status:
|
13
|
+
code: 200
|
14
|
+
message: OK
|
15
|
+
headers:
|
16
|
+
Accept-Ranges:
|
17
|
+
- none
|
18
|
+
X-Powered-By:
|
19
|
+
- PHP/5.6.2
|
20
|
+
Content-Type:
|
21
|
+
- application/json
|
22
|
+
Date:
|
23
|
+
- Mon, 20 Jun 2016 23:22:31 GMT
|
24
|
+
Server:
|
25
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
26
|
+
Content-Length:
|
27
|
+
- "103"
|
28
|
+
Expires:
|
29
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Cache-Control:
|
33
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
34
|
+
Access-Control-Allow-Origin:
|
35
|
+
- "*"
|
36
|
+
body:
|
37
|
+
string: "{\"exception\":\"moodle_exception\",\"errorcode\":\"invalidtoken\",\"message\":\"Invalid token - token not found\"}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Mon, 20 Jun 2016 23:22:31 GMT
|
@@ -3,9 +3,9 @@ recorded_with: VCR 2.9.3
|
|
3
3
|
http_interactions:
|
4
4
|
- request:
|
5
5
|
method: post
|
6
|
-
uri: http://localhost:8888/
|
6
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_create_categories&wstoken=87b95af2df709fa60b395b5c59a3fc2e
|
7
7
|
body:
|
8
|
-
string: categories[0][description]=&categories[0][
|
8
|
+
string: categories[0][description]=&categories[0][parent]=0&categories[0][name]=_&categories[0][idnumber]=
|
9
9
|
headers: {}
|
10
10
|
|
11
11
|
response:
|
@@ -14,34 +14,34 @@ http_interactions:
|
|
14
14
|
message: OK
|
15
15
|
headers:
|
16
16
|
Server:
|
17
|
-
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.
|
18
|
-
|
19
|
-
-
|
20
|
-
Pragma:
|
21
|
-
- no-cache
|
22
|
-
Date:
|
23
|
-
- Sun, 12 Apr 2015 00:40:12 GMT
|
17
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
18
|
+
Access-Control-Allow-Origin:
|
19
|
+
- "*"
|
24
20
|
Content-Type:
|
25
21
|
- application/json
|
26
22
|
Expires:
|
27
23
|
- Thu, 01 Jan 1970 00:00:00 GMT
|
28
|
-
Access-Control-Allow-Origin:
|
29
|
-
- "*"
|
30
|
-
Content-Length:
|
31
|
-
- "21"
|
32
24
|
X-Powered-By:
|
33
25
|
- PHP/5.6.2
|
34
26
|
Accept-Ranges:
|
35
27
|
- none
|
28
|
+
Cache-Control:
|
29
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
30
|
+
Date:
|
31
|
+
- Mon, 20 Jun 2016 23:23:47 GMT
|
32
|
+
Content-Length:
|
33
|
+
- "21"
|
34
|
+
Pragma:
|
35
|
+
- no-cache
|
36
36
|
body:
|
37
|
-
string: "[{\"id\":
|
37
|
+
string: "[{\"id\":3,\"name\":\"_\"}]"
|
38
38
|
http_version:
|
39
|
-
recorded_at:
|
39
|
+
recorded_at: Mon, 20 Jun 2016 23:23:47 GMT
|
40
40
|
- request:
|
41
41
|
method: post
|
42
|
-
uri: http://localhost:8888/
|
42
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_delete_categories&wstoken=87b95af2df709fa60b395b5c59a3fc2e
|
43
43
|
body:
|
44
|
-
string: categories[0][recursive]=1&categories[0][id]=
|
44
|
+
string: categories[0][recursive]=1&categories[0][id]=3
|
45
45
|
headers: {}
|
46
46
|
|
47
47
|
response:
|
@@ -50,26 +50,26 @@ http_interactions:
|
|
50
50
|
message: OK
|
51
51
|
headers:
|
52
52
|
Server:
|
53
|
-
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.
|
54
|
-
|
55
|
-
-
|
56
|
-
Pragma:
|
57
|
-
- no-cache
|
58
|
-
Date:
|
59
|
-
- Sun, 12 Apr 2015 00:40:12 GMT
|
53
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
54
|
+
Access-Control-Allow-Origin:
|
55
|
+
- "*"
|
60
56
|
Content-Type:
|
61
57
|
- application/json
|
62
58
|
Expires:
|
63
59
|
- Thu, 01 Jan 1970 00:00:00 GMT
|
64
|
-
Access-Control-Allow-Origin:
|
65
|
-
- "*"
|
66
|
-
Content-Length:
|
67
|
-
- "4"
|
68
60
|
X-Powered-By:
|
69
61
|
- PHP/5.6.2
|
70
62
|
Accept-Ranges:
|
71
63
|
- none
|
64
|
+
Cache-Control:
|
65
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
66
|
+
Date:
|
67
|
+
- Mon, 20 Jun 2016 23:23:47 GMT
|
68
|
+
Content-Length:
|
69
|
+
- "4"
|
70
|
+
Pragma:
|
71
|
+
- no-cache
|
72
72
|
body:
|
73
73
|
string: "null"
|
74
74
|
http_version:
|
75
|
-
recorded_at:
|
75
|
+
recorded_at: Mon, 20 Jun 2016 23:23:47 GMT
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.9.3
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: get
|
6
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_get_categories&wstoken=
|
7
|
+
body:
|
8
|
+
string: ""
|
9
|
+
headers: {}
|
10
|
+
|
11
|
+
response:
|
12
|
+
status:
|
13
|
+
code: 200
|
14
|
+
message: OK
|
15
|
+
headers:
|
16
|
+
Accept-Ranges:
|
17
|
+
- none
|
18
|
+
X-Powered-By:
|
19
|
+
- PHP/5.6.2
|
20
|
+
Content-Type:
|
21
|
+
- application/json
|
22
|
+
Date:
|
23
|
+
- Mon, 20 Jun 2016 23:22:31 GMT
|
24
|
+
Server:
|
25
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
26
|
+
Content-Length:
|
27
|
+
- "103"
|
28
|
+
Expires:
|
29
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Cache-Control:
|
33
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
34
|
+
Access-Control-Allow-Origin:
|
35
|
+
- "*"
|
36
|
+
body:
|
37
|
+
string: "{\"exception\":\"moodle_exception\",\"errorcode\":\"invalidtoken\",\"message\":\"Invalid token - token not found\"}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Mon, 20 Jun 2016 23:22:31 GMT
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.9.3
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: post
|
6
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_get_categories&wstoken=
|
7
|
+
body:
|
8
|
+
string: criteria[0][value]=1&criteria[0][key]=id
|
9
|
+
headers: {}
|
10
|
+
|
11
|
+
response:
|
12
|
+
status:
|
13
|
+
code: 200
|
14
|
+
message: OK
|
15
|
+
headers:
|
16
|
+
Accept-Ranges:
|
17
|
+
- none
|
18
|
+
X-Powered-By:
|
19
|
+
- PHP/5.6.2
|
20
|
+
Content-Type:
|
21
|
+
- application/json
|
22
|
+
Date:
|
23
|
+
- Mon, 20 Jun 2016 23:22:31 GMT
|
24
|
+
Server:
|
25
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
26
|
+
Content-Length:
|
27
|
+
- "103"
|
28
|
+
Expires:
|
29
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
30
|
+
Pragma:
|
31
|
+
- no-cache
|
32
|
+
Cache-Control:
|
33
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
34
|
+
Access-Control-Allow-Origin:
|
35
|
+
- "*"
|
36
|
+
body:
|
37
|
+
string: "{\"exception\":\"moodle_exception\",\"errorcode\":\"invalidtoken\",\"message\":\"Invalid token - token not found\"}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Mon, 20 Jun 2016 23:22:31 GMT
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.9.3
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: post
|
6
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_delete_courses&wstoken=
|
7
|
+
body:
|
8
|
+
string: courseids[0]=2244291800
|
9
|
+
headers: {}
|
10
|
+
|
11
|
+
response:
|
12
|
+
status:
|
13
|
+
code: 200
|
14
|
+
message: OK
|
15
|
+
headers:
|
16
|
+
Date:
|
17
|
+
- Mon, 20 Jun 2016 22:21:27 GMT
|
18
|
+
Server:
|
19
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
20
|
+
Accept-Ranges:
|
21
|
+
- none
|
22
|
+
Pragma:
|
23
|
+
- no-cache
|
24
|
+
Expires:
|
25
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
26
|
+
Cache-Control:
|
27
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
28
|
+
Access-Control-Allow-Origin:
|
29
|
+
- "*"
|
30
|
+
Content-Length:
|
31
|
+
- "103"
|
32
|
+
X-Powered-By:
|
33
|
+
- PHP/5.6.2
|
34
|
+
Content-Type:
|
35
|
+
- application/json
|
36
|
+
body:
|
37
|
+
string: "{\"exception\":\"moodle_exception\",\"errorcode\":\"invalidtoken\",\"message\":\"Invalid token - token not found\"}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Mon, 20 Jun 2016 22:21:27 GMT
|
@@ -1,10 +1,11 @@
|
|
1
1
|
---
|
2
|
+
recorded_with: VCR 2.9.3
|
2
3
|
http_interactions:
|
3
4
|
- request:
|
4
5
|
method: post
|
5
|
-
uri: http://localhost:8888/
|
6
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_create_courses&wstoken=87b95af2df709fa60b395b5c59a3fc2e
|
6
7
|
body:
|
7
|
-
string: courses[0][
|
8
|
+
string: courses[0][fullname]=Test%20Course&courses[0][idnumber]=ExtRef&courses[0][shortname]=TestC1&courses[0][categoryid]=1
|
8
9
|
headers: {}
|
9
10
|
|
10
11
|
response:
|
@@ -12,35 +13,35 @@ http_interactions:
|
|
12
13
|
code: 200
|
13
14
|
message: OK
|
14
15
|
headers:
|
16
|
+
Date:
|
17
|
+
- Mon, 20 Jun 2016 22:21:27 GMT
|
18
|
+
Server:
|
19
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
20
|
+
Accept-Ranges:
|
21
|
+
- none
|
22
|
+
Pragma:
|
23
|
+
- no-cache
|
24
|
+
Expires:
|
25
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
26
|
+
Cache-Control:
|
27
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
15
28
|
Access-Control-Allow-Origin:
|
16
29
|
- "*"
|
30
|
+
Content-Length:
|
31
|
+
- "32"
|
17
32
|
X-Powered-By:
|
18
33
|
- PHP/5.6.2
|
19
|
-
Expires:
|
20
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
21
|
-
Server:
|
22
|
-
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zd DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
23
|
-
Pragma:
|
24
|
-
- no-cache
|
25
|
-
Accept-Ranges:
|
26
|
-
- none
|
27
34
|
Content-Type:
|
28
35
|
- application/json
|
29
|
-
Date:
|
30
|
-
- Sun, 12 Apr 2015 00:51:46 GMT
|
31
|
-
Content-Length:
|
32
|
-
- "31"
|
33
|
-
Cache-Control:
|
34
|
-
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
35
36
|
body:
|
36
|
-
string: "[{\"id\":
|
37
|
+
string: "[{\"id\":15,\"shortname\":\"TestC1\"}]"
|
37
38
|
http_version:
|
38
|
-
recorded_at:
|
39
|
+
recorded_at: Mon, 20 Jun 2016 22:21:27 GMT
|
39
40
|
- request:
|
40
41
|
method: post
|
41
|
-
uri: http://localhost:8888/
|
42
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_delete_courses&wstoken=87b95af2df709fa60b395b5c59a3fc2e
|
42
43
|
body:
|
43
|
-
string: courseids[0]=
|
44
|
+
string: courseids[0]=15
|
44
45
|
headers: {}
|
45
46
|
|
46
47
|
response:
|
@@ -48,28 +49,27 @@ http_interactions:
|
|
48
49
|
code: 200
|
49
50
|
message: OK
|
50
51
|
headers:
|
52
|
+
Date:
|
53
|
+
- Mon, 20 Jun 2016 22:21:27 GMT
|
54
|
+
Server:
|
55
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
56
|
+
Accept-Ranges:
|
57
|
+
- none
|
58
|
+
Pragma:
|
59
|
+
- no-cache
|
60
|
+
Expires:
|
61
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
62
|
+
Cache-Control:
|
63
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
51
64
|
Access-Control-Allow-Origin:
|
52
65
|
- "*"
|
66
|
+
Content-Length:
|
67
|
+
- "15"
|
53
68
|
X-Powered-By:
|
54
69
|
- PHP/5.6.2
|
55
|
-
Expires:
|
56
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
57
|
-
Server:
|
58
|
-
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zd DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
59
|
-
Pragma:
|
60
|
-
- no-cache
|
61
|
-
Accept-Ranges:
|
62
|
-
- none
|
63
70
|
Content-Type:
|
64
71
|
- application/json
|
65
|
-
Date:
|
66
|
-
- Sun, 12 Apr 2015 00:51:46 GMT
|
67
|
-
Content-Length:
|
68
|
-
- "4"
|
69
|
-
Cache-Control:
|
70
|
-
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
71
72
|
body:
|
72
|
-
string: "
|
73
|
+
string: "{\"warnings\":[]}"
|
73
74
|
http_version:
|
74
|
-
recorded_at:
|
75
|
-
recorded_with: VCR 2.9.3
|
75
|
+
recorded_at: Mon, 20 Jun 2016 22:21:27 GMT
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.9.3
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: post
|
6
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_delete_courses&wstoken=87b95af2df709fa60b395b5c59a3fc2e
|
7
|
+
body:
|
8
|
+
string: courseids[0]=-1
|
9
|
+
headers: {}
|
10
|
+
|
11
|
+
response:
|
12
|
+
status:
|
13
|
+
code: 200
|
14
|
+
message: OK
|
15
|
+
headers:
|
16
|
+
Date:
|
17
|
+
- Mon, 20 Jun 2016 22:21:27 GMT
|
18
|
+
Server:
|
19
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
20
|
+
Accept-Ranges:
|
21
|
+
- none
|
22
|
+
Pragma:
|
23
|
+
- no-cache
|
24
|
+
Expires:
|
25
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
26
|
+
Cache-Control:
|
27
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
28
|
+
Access-Control-Allow-Origin:
|
29
|
+
- "*"
|
30
|
+
Content-Length:
|
31
|
+
- "115"
|
32
|
+
X-Powered-By:
|
33
|
+
- PHP/5.6.2
|
34
|
+
Content-Type:
|
35
|
+
- application/json
|
36
|
+
body:
|
37
|
+
string: "{\"warnings\":[{\"item\":\"course\",\"itemid\":-1,\"warningcode\":\"unknowncourseidnumber\",\"message\":\"Unknown course ID -1\"}]}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Mon, 20 Jun 2016 22:21:27 GMT
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
recorded_with: VCR 2.9.3
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
|
+
method: post
|
6
|
+
uri: http://localhost:8888/moodle29/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_enrol_get_enrolled_users&wstoken=
|
7
|
+
body:
|
8
|
+
string: courseid=8
|
9
|
+
headers: {}
|
10
|
+
|
11
|
+
response:
|
12
|
+
status:
|
13
|
+
code: 200
|
14
|
+
message: OK
|
15
|
+
headers:
|
16
|
+
Pragma:
|
17
|
+
- no-cache
|
18
|
+
Cache-Control:
|
19
|
+
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
20
|
+
Server:
|
21
|
+
- Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
22
|
+
Content-Type:
|
23
|
+
- application/json
|
24
|
+
Date:
|
25
|
+
- Mon, 20 Jun 2016 22:26:04 GMT
|
26
|
+
Accept-Ranges:
|
27
|
+
- none
|
28
|
+
Expires:
|
29
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
30
|
+
Content-Length:
|
31
|
+
- "103"
|
32
|
+
Access-Control-Allow-Origin:
|
33
|
+
- "*"
|
34
|
+
X-Powered-By:
|
35
|
+
- PHP/5.6.2
|
36
|
+
body:
|
37
|
+
string: "{\"exception\":\"moodle_exception\",\"errorcode\":\"invalidtoken\",\"message\":\"Invalid token - token not found\"}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Mon, 20 Jun 2016 22:26:04 GMT
|