moodle_rb 1.0.4 → 1.2.0
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 +78 -2
- data/docker-compose.yml +6 -0
- data/lib/moodle_rb/courses.rb +48 -2
- data/lib/moodle_rb/enrolments.rb +30 -1
- data/lib/moodle_rb/users.rb +16 -0
- data/lib/moodle_rb/version.rb +1 -1
- data/moodle_rb.gemspec +2 -3
- 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 +88 -8
- data/spec/lib/moodle_rb/enrolments_spec.rb +39 -4
- 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 +118 -136
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c24b87d882e5df0daac0aef1915eea376a0870c8f01b2472166ea8774f63e207
|
4
|
+
data.tar.gz: 1deb290c7d76b1b29ffd84d8b62d8c20d8c5992a8aa2fb9c6b56b1362bd67145
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0c061f236ff7982cc418458c88c37f00890b1f84982e1f33335905fdccb50198fa7fa5b13205e3f548fd067b2314f2f3403df5b24053e36056dcfc0ef8bebc61
|
7
|
+
data.tar.gz: a0a7d9d39cda28af8c4aa12a56f3850a2cfe198406c95934c4e87af1e1ae14ebf5867213ab6c1bb0b8685f104d1984938098d0bcc496b465d590b12ad0d4d31b
|
@@ -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
|
@@ -23,7 +28,9 @@ moodle.courses.create(
|
|
23
28
|
:full_name => 'My Course',
|
24
29
|
:short_name => 'MyC',
|
25
30
|
:parent_category => 5,
|
26
|
-
:idnumber => 'ExtRef'
|
31
|
+
:idnumber => 'ExtRef',
|
32
|
+
:startdate => 1646312400,
|
33
|
+
:enddate => 1646398800
|
27
34
|
)
|
28
35
|
```
|
29
36
|
|
@@ -42,6 +49,21 @@ Delete a course
|
|
42
49
|
moodle.courses.destroy(course_id)
|
43
50
|
```
|
44
51
|
|
52
|
+
Get course grades
|
53
|
+
```
|
54
|
+
moodle.courses.grade_items(course_id)
|
55
|
+
```
|
56
|
+
|
57
|
+
Get course contents
|
58
|
+
```
|
59
|
+
moodle.courses.contents(course_id)
|
60
|
+
```
|
61
|
+
|
62
|
+
Get course module
|
63
|
+
```
|
64
|
+
moodle.courses.module(course_module_id)
|
65
|
+
```
|
66
|
+
|
45
67
|
### Categories
|
46
68
|
|
47
69
|
Create a category
|
@@ -68,7 +90,7 @@ moodle.categories.destroy(category_id)
|
|
68
90
|
|
69
91
|
### Enrolments
|
70
92
|
|
71
|
-
Create
|
93
|
+
Create a student enrolment
|
72
94
|
```
|
73
95
|
moodle.enrolments.create(
|
74
96
|
:user_id => user_id,
|
@@ -76,6 +98,25 @@ moodle.enrolments.create(
|
|
76
98
|
)
|
77
99
|
```
|
78
100
|
|
101
|
+
Create a teacher enrolment
|
102
|
+
```
|
103
|
+
moodle.enrolments.create(
|
104
|
+
:user_id => user_id,
|
105
|
+
:course_id => course_id,
|
106
|
+
:role_id => 3,
|
107
|
+
:timestart=> 1646312400,
|
108
|
+
:timeend=> 1646398800
|
109
|
+
)
|
110
|
+
```
|
111
|
+
|
112
|
+
Delete an enrolment
|
113
|
+
```
|
114
|
+
moodle.enrolments.destroy(
|
115
|
+
:user_id => user_id,
|
116
|
+
:course_id => course_id
|
117
|
+
)
|
118
|
+
```
|
119
|
+
|
79
120
|
View enrolled users by course
|
80
121
|
```
|
81
122
|
moodle.courses.enrolled_users(course_id)
|
@@ -114,16 +155,51 @@ Search for a user
|
|
114
155
|
moodle.users.search(:email => 'admin@localhost')
|
115
156
|
```
|
116
157
|
|
158
|
+
Search for a user via identity
|
159
|
+
```
|
160
|
+
moodle.users.search_identity('admin@localhost')
|
161
|
+
```
|
162
|
+
|
117
163
|
Update a user
|
118
164
|
```
|
119
165
|
moodle.users.update(:id => 4, :email => 'bwayne@wayneenterprises.com')
|
120
166
|
```
|
121
167
|
|
168
|
+
## Development
|
169
|
+
|
170
|
+
To start development, spin up a container
|
171
|
+
|
172
|
+
```
|
173
|
+
docker build -t moodle .
|
174
|
+
```
|
175
|
+
|
176
|
+
To run the test suite with docker
|
177
|
+
|
178
|
+
|
179
|
+
```
|
180
|
+
docker run -v "$(pwd):/app" --rm moodle rspec spec
|
181
|
+
```
|
182
|
+
|
183
|
+
Docker compose
|
184
|
+
|
185
|
+
```
|
186
|
+
docker-compose build
|
187
|
+
docker-compose run app bundle exec rspec spec
|
188
|
+
```
|
189
|
+
|
122
190
|
## Tests
|
123
191
|
|
192
|
+
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.
|
193
|
+
|
124
194
|
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
195
|
|
126
196
|
```
|
127
197
|
export MOODLE_URL=http://localhost:8888/moodle29/
|
128
198
|
export MOODLE_TOKEN=87b95af2df709fa60b395b5c59a3fc2e
|
129
199
|
```
|
200
|
+
|
201
|
+
## Deployment
|
202
|
+
|
203
|
+
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
|
204
|
+
|
205
|
+
- Jordan Huizenga (jordan.huizenga@readytech.io)
|
data/docker-compose.yml
ADDED
data/lib/moodle_rb/courses.rb
CHANGED
@@ -42,8 +42,10 @@ module MoodleRb
|
|
42
42
|
:fullname => params[:full_name],
|
43
43
|
:shortname => params[:short_name],
|
44
44
|
:categoryid => params[:parent_category],
|
45
|
-
:idnumber => params[:idnumber]
|
46
|
-
|
45
|
+
:idnumber => params[:idnumber],
|
46
|
+
:startdate => params[:start_date],
|
47
|
+
:enddate => params[:end_date]
|
48
|
+
}.select {|k, v| v }
|
47
49
|
}
|
48
50
|
}
|
49
51
|
}.merge(query_options)
|
@@ -99,5 +101,49 @@ module MoodleRb
|
|
99
101
|
check_for_errors(response)
|
100
102
|
response.parsed_response
|
101
103
|
end
|
104
|
+
|
105
|
+
def grade_items(course_id, user_id=0, group_id=0)
|
106
|
+
response = self.class.post(
|
107
|
+
'/webservice/rest/server.php',
|
108
|
+
{
|
109
|
+
:query => query_hash('gradereport_user_get_grade_items', token),
|
110
|
+
:body => {
|
111
|
+
:courseid => course_id,
|
112
|
+
:userid => user_id,
|
113
|
+
:groupid => group_id
|
114
|
+
}
|
115
|
+
}.merge(query_options)
|
116
|
+
)
|
117
|
+
check_for_errors(response)
|
118
|
+
response.parsed_response['usergrades']
|
119
|
+
end
|
120
|
+
|
121
|
+
def contents(course_id)
|
122
|
+
response = self.class.post(
|
123
|
+
'/webservice/rest/server.php',
|
124
|
+
{
|
125
|
+
:query => query_hash('core_course_get_contents', token),
|
126
|
+
:body => {
|
127
|
+
:courseid => course_id
|
128
|
+
}
|
129
|
+
}.merge(query_options)
|
130
|
+
)
|
131
|
+
check_for_errors(response)
|
132
|
+
response.parsed_response[0]
|
133
|
+
end
|
134
|
+
|
135
|
+
def module(course_module_id)
|
136
|
+
response = self.class.post(
|
137
|
+
'/webservice/rest/server.php',
|
138
|
+
{
|
139
|
+
:query => query_hash('core_course_get_course_module', token),
|
140
|
+
:body => {
|
141
|
+
:cmid => course_module_id
|
142
|
+
}
|
143
|
+
}.merge(query_options)
|
144
|
+
)
|
145
|
+
check_for_errors(response)
|
146
|
+
response.parsed_response['cm']
|
147
|
+
end
|
102
148
|
end
|
103
149
|
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,33 @@ 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
|
+
:timestart => params[:time_start],
|
32
|
+
:timeend => params[:time_end]
|
33
|
+
}.select {|k, v| v }
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}.merge(query_options)
|
37
|
+
)
|
38
|
+
check_for_errors(response)
|
39
|
+
response.code == 200 && response.parsed_response.nil?
|
40
|
+
end
|
41
|
+
|
42
|
+
# required params:
|
43
|
+
# user_id course_id
|
44
|
+
# optional params:
|
45
|
+
# role_id - defaults to student role id
|
46
|
+
def destroy(params)
|
47
|
+
response = self.class.post(
|
48
|
+
'/webservice/rest/server.php',
|
49
|
+
{
|
50
|
+
:query => query_hash('enrol_manual_unenrol_users', token),
|
51
|
+
:body => {
|
52
|
+
:enrolments => {
|
53
|
+
'0' => {
|
54
|
+
:userid => params[:user_id],
|
55
|
+
:courseid => params[:course_id],
|
56
|
+
:roleid => params[:role_id] || STUDENT_ROLE_ID
|
28
57
|
}
|
29
58
|
}
|
30
59
|
}
|
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,11 +17,10 @@ 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
|
-
spec.add_dependency 'httparty', '
|
25
|
+
spec.add_dependency 'httparty', '>= 0.11.0'
|
27
26
|
end
|
@@ -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
|