moodle_rb 1.0.5 → 1.1.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.
- checksums.yaml +7 -0
- data/.github/workflows/build.yml +36 -0
- data/.github/workflows/publish.yml +27 -0
- data/Dockerfile +10 -0
- data/README.md +73 -1
- data/docker-compose.yml +6 -0
- data/lib/moodle_rb/courses.rb +44 -0
- data/lib/moodle_rb/enrolments.rb +28 -1
- data/lib/moodle_rb/users.rb +16 -0
- data/lib/moodle_rb/version.rb +1 -1
- data/moodle_rb.gemspec +1 -2
- data/spec/cassettes/MoodleRb_Categories/_create/.yml +19 -19
- data/spec/cassettes/MoodleRb_Categories/_create/when_validation_fails/.yml +19 -19
- data/spec/cassettes/MoodleRb_Categories/_destroy/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Categories/_destroy/when_using_valid_token/.yml +39 -38
- data/spec/cassettes/MoodleRb_Categories/_index/.yml +19 -19
- data/spec/cassettes/MoodleRb_Categories/_index/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Categories/_show/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Client/_site_info/when_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Client/_site_info/when_valid_token/.yml +19 -19
- data/spec/cassettes/MoodleRb_Courses/_contents/when_using_invalid_token/.yml +52 -0
- data/spec/cassettes/MoodleRb_Courses/_contents/when_using_valid_token/.yml +52 -0
- data/spec/cassettes/MoodleRb_Courses/_create/.yml +19 -19
- data/spec/cassettes/MoodleRb_Courses/_create/when_validation_fails/.yml +36 -36
- data/spec/cassettes/MoodleRb_Courses/_destroy/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Courses/_destroy/when_using_valid_token/.yml +38 -38
- data/spec/cassettes/MoodleRb_Courses/_destroy/when_using_valid_token/when_using_invalid_course_id/.yml +20 -20
- data/spec/cassettes/MoodleRb_Courses/_enrolled_users/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Courses/_enrolled_users/when_using_valid_token/.yml +39 -39
- data/spec/cassettes/MoodleRb_Courses/_grade_items/when_using_invalid_token/.yml +52 -0
- data/spec/cassettes/MoodleRb_Courses/_grade_items/when_using_valid_token/.yml +56 -0
- data/spec/cassettes/MoodleRb_Courses/_index/.yml +19 -19
- data/spec/cassettes/MoodleRb_Courses/_index/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Courses/_module/when_using_invalid_token/.yml +52 -0
- data/spec/cassettes/MoodleRb_Courses/_module/when_using_valid_token/.yml +51 -0
- data/spec/cassettes/MoodleRb_Courses/_show/.yml +19 -19
- data/spec/cassettes/MoodleRb_Courses/_show/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Enrolments/_create/.yml +19 -19
- data/spec/cassettes/MoodleRb_Enrolments/_create/when_user_or_course_id_is_invalid/.yml +19 -19
- data/spec/cassettes/MoodleRb_Enrolments/_destroy/.yml +51 -0
- data/spec/cassettes/MoodleRb_Enrolments/_destroy/when_user_or_course_id_is_invalid/.yml +52 -0
- data/spec/cassettes/MoodleRb_Grades/_by_assignment/.yml +19 -19
- data/spec/cassettes/MoodleRb_Grades/_by_course/.yml +19 -19
- data/spec/cassettes/MoodleRb_Grades/_by_course/when_invalid_parameters/.yml +19 -19
- data/spec/cassettes/MoodleRb_Users/_create/.yml +19 -19
- data/spec/cassettes/MoodleRb_Users/_create/when_missing_required_parameters/.yml +19 -19
- data/spec/cassettes/MoodleRb_Users/_destroy/.yml +19 -19
- data/spec/cassettes/MoodleRb_Users/_destroy/when_id_does_not_exist/.yml +19 -19
- data/spec/cassettes/MoodleRb_Users/_destroy/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Users/_enrolled_courses/.yml +19 -19
- data/spec/cassettes/MoodleRb_Users/_enrolled_courses/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Users/_search/.yml +21 -21
- data/spec/cassettes/MoodleRb_Users/_search/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Users/_search_identity/.yml +51 -0
- data/spec/cassettes/MoodleRb_Users/_search_identity/when_using_invalid_token/.yml +52 -0
- data/spec/cassettes/MoodleRb_Users/_show/.yml +19 -19
- data/spec/cassettes/MoodleRb_Users/_show/when_using_invalid_token/.yml +20 -20
- data/spec/cassettes/MoodleRb_Users/_update/.yml +20 -20
- data/spec/cassettes/MoodleRb_Users/_update/when_using_invalid_token/.yml +20 -20
- data/spec/lib/moodle_rb/categories_spec.rb +6 -6
- data/spec/lib/moodle_rb/client_spec.rb +3 -3
- data/spec/lib/moodle_rb/courses_spec.rb +85 -7
- data/spec/lib/moodle_rb/enrolments_spec.rb +36 -3
- data/spec/lib/moodle_rb/grades_spec.rb +4 -4
- data/spec/lib/moodle_rb/users_spec.rb +37 -8
- data/spec/lib/moodle_rb_spec.rb +2 -2
- metadata +117 -135
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3fdbc847a70cefe6a1641ceebba2f874b8ab8d1459aa475c23d8f1ae70ef4c11
|
4
|
+
data.tar.gz: 7e4034e714f6ca67e92a928bc9ae323e22b48042d4ebbfbab0bf401ec4a54cec
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1e7300716079888fed475a6dea164997ceb375fec6b870370064d88ac8a3a9821a63a63e73579bdf621b63563bfb95e3c33c2be309ecdc6863eda0e7fbf89e5b
|
7
|
+
data.tar.gz: f2613f30e5676831a666a76f8e54cde9e5a2c4b939ab00972833a0c200d86ddd502c50c200fc982ab0c9373b296e47f62b98ddfc525b0ca7dd2cd8df2b275a12
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Build
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ develop ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ develop ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: ['2.3']
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
- name: Set up Ruby
|
27
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
+
# uses: ruby/setup-ruby@v1
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
bundler: 1.17.3
|
34
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
35
|
+
- name: Run tests
|
36
|
+
run: bundle exec rspec spec
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
release:
|
5
|
+
types: [published]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build + Publish
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
packages: write
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby 2.7
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: '2.7'
|
21
|
+
|
22
|
+
- name: Publish to RubyGems
|
23
|
+
run: |
|
24
|
+
gem build *.gemspec
|
25
|
+
gem push *.gem
|
26
|
+
env:
|
27
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/Dockerfile
ADDED
data/README.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
# MoodleRb
|
2
|
+
|
3
|
+
[](https://github.com/jobready/moodle-rb/actions/workflows/build.yml)
|
4
|
+
|
5
|
+
[](https://badge.fury.io/rb/moodle_rb)
|
6
|
+
|
2
7
|
A Ruby Client for the Moodle REST API.
|
3
8
|
|
4
9
|
https://docs.moodle.org/dev/Web_services#Developer_documentation
|
@@ -42,6 +47,21 @@ Delete a course
|
|
42
47
|
moodle.courses.destroy(course_id)
|
43
48
|
```
|
44
49
|
|
50
|
+
Get course grades
|
51
|
+
```
|
52
|
+
moodle.courses.grade_items(course_id)
|
53
|
+
```
|
54
|
+
|
55
|
+
Get course contents
|
56
|
+
```
|
57
|
+
moodle.courses.contents(course_id)
|
58
|
+
```
|
59
|
+
|
60
|
+
Get course module
|
61
|
+
```
|
62
|
+
moodle.courses.module(course_module_id)
|
63
|
+
```
|
64
|
+
|
45
65
|
### Categories
|
46
66
|
|
47
67
|
Create a category
|
@@ -68,7 +88,7 @@ moodle.categories.destroy(category_id)
|
|
68
88
|
|
69
89
|
### Enrolments
|
70
90
|
|
71
|
-
Create
|
91
|
+
Create a student enrolment
|
72
92
|
```
|
73
93
|
moodle.enrolments.create(
|
74
94
|
:user_id => user_id,
|
@@ -76,6 +96,23 @@ moodle.enrolments.create(
|
|
76
96
|
)
|
77
97
|
```
|
78
98
|
|
99
|
+
Create a teacher enrolment
|
100
|
+
```
|
101
|
+
moodle.enrolments.create(
|
102
|
+
:user_id => user_id,
|
103
|
+
:course_id => course_id,
|
104
|
+
:role_id => 3
|
105
|
+
)
|
106
|
+
```
|
107
|
+
|
108
|
+
Delete an enrolment
|
109
|
+
```
|
110
|
+
moodle.enrolments.destroy(
|
111
|
+
:user_id => user_id,
|
112
|
+
:course_id => course_id
|
113
|
+
)
|
114
|
+
```
|
115
|
+
|
79
116
|
View enrolled users by course
|
80
117
|
```
|
81
118
|
moodle.courses.enrolled_users(course_id)
|
@@ -114,16 +151,51 @@ Search for a user
|
|
114
151
|
moodle.users.search(:email => 'admin@localhost')
|
115
152
|
```
|
116
153
|
|
154
|
+
Search for a user via identity
|
155
|
+
```
|
156
|
+
moodle.users.search_identity('admin@localhost')
|
157
|
+
```
|
158
|
+
|
117
159
|
Update a user
|
118
160
|
```
|
119
161
|
moodle.users.update(:id => 4, :email => 'bwayne@wayneenterprises.com')
|
120
162
|
```
|
121
163
|
|
164
|
+
## Development
|
165
|
+
|
166
|
+
To start development, spin up a container
|
167
|
+
|
168
|
+
```
|
169
|
+
docker build -t moodle .
|
170
|
+
```
|
171
|
+
|
172
|
+
To run the test suite with docker
|
173
|
+
|
174
|
+
|
175
|
+
```
|
176
|
+
docker run -v "$(pwd):/app" --rm moodle rspec spec
|
177
|
+
```
|
178
|
+
|
179
|
+
Docker compose
|
180
|
+
|
181
|
+
```
|
182
|
+
docker-compose build
|
183
|
+
docker-compose run app bundle exec rspec spec
|
184
|
+
```
|
185
|
+
|
122
186
|
## Tests
|
123
187
|
|
188
|
+
Tests must be written for new lines of code added as part of a pull request and the test suite must pass. If creating new cassettes, consider updating the hardcoded moodle token and url parameters throughout the suite. They can also be configured with environment variables.
|
189
|
+
|
124
190
|
You will need to set some environment variables to create new cassettes. We build using MAMP https://www.mamp.info/en/ so it might be
|
125
191
|
|
126
192
|
```
|
127
193
|
export MOODLE_URL=http://localhost:8888/moodle29/
|
128
194
|
export MOODLE_TOKEN=87b95af2df709fa60b395b5c59a3fc2e
|
129
195
|
```
|
196
|
+
|
197
|
+
## Deployment
|
198
|
+
|
199
|
+
The gem is automatically published when a new release is created on github. If there is an issue or a new release is required, please contact one of the maintainers
|
200
|
+
|
201
|
+
- Jordan Huizenga (jordan.huizenga@readytech.io)
|
data/docker-compose.yml
ADDED
data/lib/moodle_rb/courses.rb
CHANGED
@@ -99,5 +99,49 @@ module MoodleRb
|
|
99
99
|
check_for_errors(response)
|
100
100
|
response.parsed_response
|
101
101
|
end
|
102
|
+
|
103
|
+
def grade_items(course_id, user_id=0, group_id=0)
|
104
|
+
response = self.class.post(
|
105
|
+
'/webservice/rest/server.php',
|
106
|
+
{
|
107
|
+
:query => query_hash('gradereport_user_get_grade_items', token),
|
108
|
+
:body => {
|
109
|
+
:courseid => course_id,
|
110
|
+
:userid => user_id,
|
111
|
+
:groupid => group_id
|
112
|
+
}
|
113
|
+
}.merge(query_options)
|
114
|
+
)
|
115
|
+
check_for_errors(response)
|
116
|
+
response.parsed_response['usergrades']
|
117
|
+
end
|
118
|
+
|
119
|
+
def contents(course_id)
|
120
|
+
response = self.class.post(
|
121
|
+
'/webservice/rest/server.php',
|
122
|
+
{
|
123
|
+
:query => query_hash('core_course_get_contents', token),
|
124
|
+
:body => {
|
125
|
+
:courseid => course_id
|
126
|
+
}
|
127
|
+
}.merge(query_options)
|
128
|
+
)
|
129
|
+
check_for_errors(response)
|
130
|
+
response.parsed_response[0]
|
131
|
+
end
|
132
|
+
|
133
|
+
def module(course_module_id)
|
134
|
+
response = self.class.post(
|
135
|
+
'/webservice/rest/server.php',
|
136
|
+
{
|
137
|
+
:query => query_hash('core_course_get_course_module', token),
|
138
|
+
:body => {
|
139
|
+
:cmid => course_module_id
|
140
|
+
}
|
141
|
+
}.merge(query_options)
|
142
|
+
)
|
143
|
+
check_for_errors(response)
|
144
|
+
response.parsed_response['cm']
|
145
|
+
end
|
102
146
|
end
|
103
147
|
end
|
data/lib/moodle_rb/enrolments.rb
CHANGED
@@ -5,6 +5,7 @@ module MoodleRb
|
|
5
5
|
|
6
6
|
attr_reader :token, :query_options
|
7
7
|
STUDENT_ROLE_ID = 5
|
8
|
+
TEACHER_ROLE_ID = 3
|
8
9
|
|
9
10
|
def initialize(token, url, query_options)
|
10
11
|
@token = token
|
@@ -14,6 +15,8 @@ module MoodleRb
|
|
14
15
|
|
15
16
|
# required params:
|
16
17
|
# user_id course_id
|
18
|
+
# optional params:
|
19
|
+
# role_id - defaults to student role id
|
17
20
|
def create(params)
|
18
21
|
response = self.class.post(
|
19
22
|
'/webservice/rest/server.php',
|
@@ -24,7 +27,31 @@ module MoodleRb
|
|
24
27
|
'0' => {
|
25
28
|
:userid => params[:user_id],
|
26
29
|
:courseid => params[:course_id],
|
27
|
-
:roleid => STUDENT_ROLE_ID
|
30
|
+
:roleid => params[:role_id] || STUDENT_ROLE_ID
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}.merge(query_options)
|
35
|
+
)
|
36
|
+
check_for_errors(response)
|
37
|
+
response.code == 200 && response.parsed_response.nil?
|
38
|
+
end
|
39
|
+
|
40
|
+
# required params:
|
41
|
+
# user_id course_id
|
42
|
+
# optional params:
|
43
|
+
# role_id - defaults to student role id
|
44
|
+
def destroy(params)
|
45
|
+
response = self.class.post(
|
46
|
+
'/webservice/rest/server.php',
|
47
|
+
{
|
48
|
+
:query => query_hash('enrol_manual_unenrol_users', token),
|
49
|
+
:body => {
|
50
|
+
:enrolments => {
|
51
|
+
'0' => {
|
52
|
+
:userid => params[:user_id],
|
53
|
+
:courseid => params[:course_id],
|
54
|
+
:roleid => params[:role_id] || STUDENT_ROLE_ID
|
28
55
|
}
|
29
56
|
}
|
30
57
|
}
|
data/lib/moodle_rb/users.rb
CHANGED
@@ -98,6 +98,22 @@ module MoodleRb
|
|
98
98
|
response.parsed_response['users']
|
99
99
|
end
|
100
100
|
|
101
|
+
# Return list of users identities matching the given criteria in their name or other identity fields.
|
102
|
+
# Performs a partial match on id, idnumber, fullname, and email
|
103
|
+
def search_identity(search_query)
|
104
|
+
response = self.class.post(
|
105
|
+
'/webservice/rest/server.php',
|
106
|
+
{
|
107
|
+
:query => query_hash('core_user_search_identity', token),
|
108
|
+
:body => {
|
109
|
+
:query => search_query
|
110
|
+
}
|
111
|
+
}.merge(query_options)
|
112
|
+
)
|
113
|
+
check_for_errors(response)
|
114
|
+
response.parsed_response['list']
|
115
|
+
end
|
116
|
+
|
101
117
|
# params must include the id of the user
|
102
118
|
# it may include any other standard user attributes:
|
103
119
|
# username, password, firstname, lastname, email ...
|
data/lib/moodle_rb/version.rb
CHANGED
data/moodle_rb.gemspec
CHANGED
@@ -17,10 +17,9 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
19
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
20
|
-
spec.add_development_dependency 'ruby-debug', '0.10.4'
|
21
20
|
spec.add_development_dependency 'rake', '~> 0'
|
22
21
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
23
|
-
spec.add_development_dependency 'webmock', '~> 1.
|
22
|
+
spec.add_development_dependency 'webmock', '~> 1.24.6'
|
24
23
|
spec.add_development_dependency 'vcr', '~> 2.9'
|
25
24
|
|
26
25
|
spec.add_dependency 'httparty', '>= 0.11.0'
|
@@ -1,39 +1,39 @@
|
|
1
|
-
---
|
1
|
+
---
|
2
2
|
recorded_with: VCR 2.9.3
|
3
|
-
http_interactions:
|
4
|
-
- request:
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
5
|
method: post
|
6
6
|
uri: http://localhost:8888/moodle28/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_create_categories&wstoken=60fc9c9415259404795094957e4ab32f
|
7
|
-
body:
|
7
|
+
body:
|
8
8
|
string: categories[0][description]=&categories[0][idnumber]=&categories[0][parent]=0&categories[0][name]=Test%20category
|
9
9
|
headers: {}
|
10
10
|
|
11
|
-
response:
|
12
|
-
status:
|
11
|
+
response:
|
12
|
+
status:
|
13
13
|
code: 200
|
14
14
|
message: OK
|
15
|
-
headers:
|
16
|
-
Server:
|
15
|
+
headers:
|
16
|
+
Server:
|
17
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.8zd DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
18
|
-
Cache-Control:
|
18
|
+
Cache-Control:
|
19
19
|
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
20
|
-
Pragma:
|
20
|
+
Pragma:
|
21
21
|
- no-cache
|
22
|
-
Date:
|
22
|
+
Date:
|
23
23
|
- Sun, 12 Apr 2015 00:40:13 GMT
|
24
|
-
Content-Type:
|
24
|
+
Content-Type:
|
25
25
|
- application/json
|
26
|
-
Expires:
|
26
|
+
Expires:
|
27
27
|
- Thu, 01 Jan 1970 00:00:00 GMT
|
28
|
-
Access-Control-Allow-Origin:
|
28
|
+
Access-Control-Allow-Origin:
|
29
29
|
- "*"
|
30
|
-
Content-Length:
|
30
|
+
Content-Length:
|
31
31
|
- "33"
|
32
|
-
X-Powered-By:
|
32
|
+
X-Powered-By:
|
33
33
|
- PHP/5.6.2
|
34
|
-
Accept-Ranges:
|
34
|
+
Accept-Ranges:
|
35
35
|
- none
|
36
|
-
body:
|
36
|
+
body:
|
37
37
|
string: "[{\"id\":5,\"name\":\"Test category\"}]"
|
38
|
-
http_version:
|
38
|
+
http_version:
|
39
39
|
recorded_at: Sun, 12 Apr 2015 00:40:13 GMT
|
@@ -1,39 +1,39 @@
|
|
1
|
-
---
|
1
|
+
---
|
2
2
|
recorded_with: VCR 2.9.3
|
3
|
-
http_interactions:
|
4
|
-
- request:
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
5
|
method: post
|
6
6
|
uri: http://localhost:8888/moodle28/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_create_categories&wstoken=60fc9c9415259404795094957e4ab32f
|
7
|
-
body:
|
7
|
+
body:
|
8
8
|
string: categories[0][description]=&categories[0][idnumber]=CAT101&categories[0][parent]=0&categories[0][name]=Test%20category
|
9
9
|
headers: {}
|
10
10
|
|
11
|
-
response:
|
12
|
-
status:
|
11
|
+
response:
|
12
|
+
status:
|
13
13
|
code: 200
|
14
14
|
message: OK
|
15
|
-
headers:
|
16
|
-
Server:
|
15
|
+
headers:
|
16
|
+
Server:
|
17
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.8zd DAV/2 mod_perl/2.0.8 Perl/v5.20.0
|
18
|
-
Cache-Control:
|
18
|
+
Cache-Control:
|
19
19
|
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
20
|
-
Pragma:
|
20
|
+
Pragma:
|
21
21
|
- no-cache
|
22
|
-
Date:
|
22
|
+
Date:
|
23
23
|
- Sun, 12 Apr 2015 00:40:13 GMT
|
24
|
-
Content-Type:
|
24
|
+
Content-Type:
|
25
25
|
- application/json
|
26
|
-
Expires:
|
26
|
+
Expires:
|
27
27
|
- Thu, 01 Jan 1970 00:00:00 GMT
|
28
|
-
Access-Control-Allow-Origin:
|
28
|
+
Access-Control-Allow-Origin:
|
29
29
|
- "*"
|
30
|
-
Content-Length:
|
30
|
+
Content-Length:
|
31
31
|
- "127"
|
32
|
-
X-Powered-By:
|
32
|
+
X-Powered-By:
|
33
33
|
- PHP/5.6.2
|
34
|
-
Accept-Ranges:
|
34
|
+
Accept-Ranges:
|
35
35
|
- none
|
36
|
-
body:
|
36
|
+
body:
|
37
37
|
string: "{\"exception\":\"moodle_exception\",\"errorcode\":\"categoryidnumbertaken\",\"message\":\"ID number is already used for another category\"}"
|
38
|
-
http_version:
|
38
|
+
http_version:
|
39
39
|
recorded_at: Sun, 12 Apr 2015 00:40:13 GMT
|
@@ -1,39 +1,39 @@
|
|
1
|
-
---
|
1
|
+
---
|
2
2
|
recorded_with: VCR 2.9.3
|
3
|
-
http_interactions:
|
4
|
-
- request:
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
5
|
method: post
|
6
|
-
uri: http://localhost:8888/
|
7
|
-
body:
|
6
|
+
uri: http://localhost:8888/moodle28/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_create_categories&wstoken=
|
7
|
+
body:
|
8
8
|
string: categories[0][description]=&categories[0][parent]=0&categories[0][name]=_&categories[0][idnumber]=
|
9
9
|
headers: {}
|
10
10
|
|
11
|
-
response:
|
12
|
-
status:
|
11
|
+
response:
|
12
|
+
status:
|
13
13
|
code: 200
|
14
14
|
message: OK
|
15
|
-
headers:
|
16
|
-
Accept-Ranges:
|
15
|
+
headers:
|
16
|
+
Accept-Ranges:
|
17
17
|
- none
|
18
|
-
X-Powered-By:
|
18
|
+
X-Powered-By:
|
19
19
|
- PHP/5.6.2
|
20
|
-
Content-Type:
|
20
|
+
Content-Type:
|
21
21
|
- application/json
|
22
|
-
Date:
|
22
|
+
Date:
|
23
23
|
- Mon, 20 Jun 2016 23:22:31 GMT
|
24
|
-
Server:
|
24
|
+
Server:
|
25
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:
|
26
|
+
Content-Length:
|
27
27
|
- "103"
|
28
|
-
Expires:
|
28
|
+
Expires:
|
29
29
|
- Thu, 01 Jan 1970 00:00:00 GMT
|
30
|
-
Pragma:
|
30
|
+
Pragma:
|
31
31
|
- no-cache
|
32
|
-
Cache-Control:
|
32
|
+
Cache-Control:
|
33
33
|
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
34
|
-
Access-Control-Allow-Origin:
|
34
|
+
Access-Control-Allow-Origin:
|
35
35
|
- "*"
|
36
|
-
body:
|
36
|
+
body:
|
37
37
|
string: "{\"exception\":\"moodle_exception\",\"errorcode\":\"invalidtoken\",\"message\":\"Invalid token - token not found\"}"
|
38
|
-
http_version:
|
38
|
+
http_version:
|
39
39
|
recorded_at: Mon, 20 Jun 2016 23:22:31 GMT
|
@@ -1,75 +1,76 @@
|
|
1
|
-
---
|
1
|
+
---
|
2
2
|
recorded_with: VCR 2.9.3
|
3
|
-
http_interactions:
|
4
|
-
- request:
|
3
|
+
http_interactions:
|
4
|
+
- request:
|
5
5
|
method: post
|
6
|
-
uri: http://localhost:8888/
|
7
|
-
|
6
|
+
uri: http://localhost:8888/moodle28/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_create_categories&wstoken=60fc9c9415259404795094957e4ab32f
|
7
|
+
uri: http://localhost:8888/moodle28/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_create_categories&wstoken=60fc9c9415259404795094957e4ab32f
|
8
|
+
body:
|
8
9
|
string: categories[0][description]=&categories[0][parent]=0&categories[0][name]=_&categories[0][idnumber]=
|
9
10
|
headers: {}
|
10
11
|
|
11
|
-
response:
|
12
|
-
status:
|
12
|
+
response:
|
13
|
+
status:
|
13
14
|
code: 200
|
14
15
|
message: OK
|
15
|
-
headers:
|
16
|
-
Server:
|
16
|
+
headers:
|
17
|
+
Server:
|
17
18
|
- 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
|
+
Access-Control-Allow-Origin:
|
19
20
|
- "*"
|
20
|
-
Content-Type:
|
21
|
+
Content-Type:
|
21
22
|
- application/json
|
22
|
-
Expires:
|
23
|
+
Expires:
|
23
24
|
- Thu, 01 Jan 1970 00:00:00 GMT
|
24
|
-
X-Powered-By:
|
25
|
+
X-Powered-By:
|
25
26
|
- PHP/5.6.2
|
26
|
-
Accept-Ranges:
|
27
|
+
Accept-Ranges:
|
27
28
|
- none
|
28
|
-
Cache-Control:
|
29
|
+
Cache-Control:
|
29
30
|
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
30
|
-
Date:
|
31
|
+
Date:
|
31
32
|
- Mon, 20 Jun 2016 23:23:47 GMT
|
32
|
-
Content-Length:
|
33
|
+
Content-Length:
|
33
34
|
- "21"
|
34
|
-
Pragma:
|
35
|
+
Pragma:
|
35
36
|
- no-cache
|
36
|
-
body:
|
37
|
+
body:
|
37
38
|
string: "[{\"id\":3,\"name\":\"_\"}]"
|
38
|
-
http_version:
|
39
|
+
http_version:
|
39
40
|
recorded_at: Mon, 20 Jun 2016 23:23:47 GMT
|
40
|
-
- request:
|
41
|
+
- request:
|
41
42
|
method: post
|
42
|
-
uri: http://localhost:8888/
|
43
|
-
body:
|
43
|
+
uri: http://localhost:8888/moodle28/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_delete_categories&wstoken=60fc9c9415259404795094957e4ab32f
|
44
|
+
body:
|
44
45
|
string: categories[0][recursive]=1&categories[0][id]=3
|
45
46
|
headers: {}
|
46
47
|
|
47
|
-
response:
|
48
|
-
status:
|
48
|
+
response:
|
49
|
+
status:
|
49
50
|
code: 200
|
50
51
|
message: OK
|
51
|
-
headers:
|
52
|
-
Server:
|
52
|
+
headers:
|
53
|
+
Server:
|
53
54
|
- 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
|
+
Access-Control-Allow-Origin:
|
55
56
|
- "*"
|
56
|
-
Content-Type:
|
57
|
+
Content-Type:
|
57
58
|
- application/json
|
58
|
-
Expires:
|
59
|
+
Expires:
|
59
60
|
- Thu, 01 Jan 1970 00:00:00 GMT
|
60
|
-
X-Powered-By:
|
61
|
+
X-Powered-By:
|
61
62
|
- PHP/5.6.2
|
62
|
-
Accept-Ranges:
|
63
|
+
Accept-Ranges:
|
63
64
|
- none
|
64
|
-
Cache-Control:
|
65
|
+
Cache-Control:
|
65
66
|
- private, must-revalidate, pre-check=0, post-check=0, max-age=0
|
66
|
-
Date:
|
67
|
+
Date:
|
67
68
|
- Mon, 20 Jun 2016 23:23:47 GMT
|
68
|
-
Content-Length:
|
69
|
+
Content-Length:
|
69
70
|
- "4"
|
70
|
-
Pragma:
|
71
|
+
Pragma:
|
71
72
|
- no-cache
|
72
|
-
body:
|
73
|
+
body:
|
73
74
|
string: "null"
|
74
|
-
http_version:
|
75
|
+
http_version:
|
75
76
|
recorded_at: Mon, 20 Jun 2016 23:23:47 GMT
|