WebService::Moodle::Simple - API client for Stripe
version 0.06
./bin/moodlews --help
Example
$ ./bin/moodlews add_user -u freddy -f Fred -l Flintstone -e freddy09@example.com -o 0123456789abcdef -p ff1234 -d moodle.example.com -t local_wssetup { id => 57, ok => 1, username => "freddy09" }
use WebService::Moodle::Simple; my $moodle = WebService::Moodle::Simple->new( domain => 'moodle.example.edu', port => 80, # default 443 timeout => 100, # default 1000 scheme => 'http', # default 'https' target => 'example_webservice' token => '0123456789abcdef', );
WebService::Moodle::Simple is Client API and CLI for Moodle Web Services
__THIS IS A DEVELOPMENT RELEASE. API MAY CHANGE WITHOUT NOTICE__.
WebService::Moodle::Simple - Client API and CLI for Moodle Web Services
Get instructions on CLI usage
moodlews
Retrieve the user list using the token
moodlews get_users -o becac8d120119eb2a312a385644eb709 -d moodle.example.edu -t example_webservice
prove -rlv t
TEST_WSMS_SCHEME=https \ TEST_WSMS_PORT=443 \ TEST_WSMS_DOMAIN=moodle.example.com \ TEST_WSMS_TARGET=example_webservice \ TEST_WSMS_TOKEN=0123456789abcdef \ TEST_WSMS_COURSE=example-short-course-name \ prove -rlv t/
__NOTE: Full unit tests write to Moodle Database - only run them against a test Moodle server__.
add_user
$OBJ->add_user( firstname => <str>, lastname => <str>, email => <str>, username => <str>, password => <str>, token => <str>, );
On failure, returns a hashref of the form
{ ok => 0, msg => <str>, }
or
{ ok => 1, id => <int>, username => <str>, }
check_password
$OBJ->check_password( username => <str>, password => <str>, )
Returns
{ msg => <str>, ok => <bool> }
set_password
$OBJ->set_password( username => <str>, password => <str>, )
{ ok => <bool> }
get_user
$OBJ->get_user( username => <str>, )
{ username => <str>, id => <int>, suspended => <JSON::PP::Boolean>, ... }
enrol_student
$OBJ->enrol_student( username => <str>, course => <str>, )
{ ok => <bool>, msg => <str> }
get_course_id
$OBJ->get_course_id( short_cname => <str>, )
Returns an integer
suspend_user
$OBJ->suspend_user( username => <str>, suspend => <bool default TRUE> )
Always returns undef
If suspend is true/nonzero (which is the default) it kills the user's session and suspends their account preventing them from logging in. If suspend is false they are given permission to login.
Andrew Solomon <andrew@geekuni.com>
Copyright 2014- Andrew Solomon
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Andrew Solomon
This software is copyright (c) 2014 by Copyright 2014- Andrew Solomon.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WebService::Moodle::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Moodle::Simple
CPAN shell
perl -MCPAN -e shell install WebService::Moodle::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.