<commit_before># Moodle

A ruby wrapper for the Moodle REST API.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'moodle'
```

And then execute:

    $ bundle install

Or install it yourself as:

    $ gem install moodle

## Usage

### Configuration

Different ways to configure gem.

```
# Pass block to configure
 Moodle.configure do|c|
  c.host = 'http://dev.vle.getsmarter.co.za'
  c.token = '<KEY>'
  c.available_web_services = [:core_user_get_users]
end

# Set configuration values individually
Moodle.configuration.host = 'http://dev.vle.getsmarter.co.za'
Moodle.configuration.token = '<KEY>'
Moodle.configuration.available_web_services = [:core_user_get_users]

# Pass options hash to configure
Moodle.configure({host: 'http://dev.vle.getsmarter.co.za',
                  token: '<KEY>',
                  available_web_services: [:core_user_get_users]})
```

Moodle requires users to expose [web service functions](https://docs.moodle.org/dev/Web_service_API_functions) in order for them to be used. As an additional precaution `available_web_services` configuration item has been created to allow developers to control what services are available. This stores an array of web service function names as symbols.

Note if a function is not restricted in Moodle, but is in the configuration, it will not be available and visa versa.

### Calling a service

All web services are available by calling

```
Moodle.function_name_here(my_parameters)
```

New functions created in Moodle will automatically be available in the gem. Just make sure you add the name to the available_web_services in the configuration setup.

### Example

```
Moodle.configure({host: 'http://dev.vle.getsmarter.co.za',
                  token: '<KEY>',
                  available_web_services: [:core_user_get_users]})

params = { 'criteria[0][key]' => 'firstname', 'criteria[0][value]' => 'Jon' }
Moodle.core_user_get_users(params)
```

## Documentation

For documentation on all the web services check your moodle site at:
- http://my_moodle_instance.com/admin/webservice/documentation.php

Useful links:
- https://docs.moodle.org/20/en/Using_web_services#Creating_a_service
- https://docs.moodle.org/dev/Web_service_API_functions


## Development

A bundle install should get you going. Rspec, guard and vcr are leveraged for testing.

## Contributing<commit_msg>Cleaning up urls on readme<commit_after># Moodle

A ruby wrapper for the Moodle REST API.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'moodle'
```

And then execute:

    $ bundle install

Or install it yourself as:

    $ gem install moodle

## Usage

### Configuration

Different ways to configure gem.

```
# Pass block to configure
 Moodle.configure do|c|
  c.host = 'http://dev.vle.getsmarter.co.za'
  c.token = '<KEY>'
  c.available_web_services = [:core_user_get_users]
end

# Set configuration values individually
Moodle.configuration.host = 'http://dev.vle.getsmarter.co.za'
Moodle.configuration.token = '<KEY>'
Moodle.configuration.available_web_services = [:core_user_get_users]

# Pass options hash to configure
Moodle.configure({host: 'http://dev.vle.getsmarter.co.za',
                  token: '<KEY>',
                  available_web_services: [:core_user_get_users]})
```

Moodle requires users to expose [web service functions](https://docs.moodle.org/dev/Web_service_API_functions) in order for them to be used. As an additional precaution `available_web_services` configuration item has been created to allow developers to control what services are available. This stores an array of web service function names as symbols.

Note if a function is not restricted in Moodle, but is in the configuration, it will not be available and visa versa.

### Calling a service

All web services are available by calling

```
Moodle.function_name_here(my_parameters)
```

New functions created in Moodle will automatically be available in the gem. Just make sure you add the name to the available_web_services in the configuration setup.

### Example

```
Moodle.configure({host: 'http://dev.vle.getsmarter.co.za',
                  token: '<KEY>',
                  available_web_services: [:core_user_get_users]})

params = { 'criteria[0][key]' => 'firstname', 'criteria[0][value]' => 'Jon' }
Moodle.core_user_get_users(params)
```

## Documentation

For documentation on all the web services check your moodle site at:
- http://[my_moodle_instance].com/admin/webservice/documentation.php

Useful links:
- [Service creation guide](https://docs.moodle.org/20/en/Using_web_services#Creating_a_service)
- [Web Service API function reference](https://docs.moodle.org/dev/Web_service_API_functions)
- [Testing harness](https://testing.vle.getsmarter.co.za/admin/webservice/testclient.php)


## Development

A bundle install should get you going. Rspec, guard and vcr are leveraged for testing.

## Contributing
{'fraction_non_alphanumeric': 0.1048567364356838, 'fraction_numerical': 0.001625685836212152, 'mean_word_length': 4.27545551982851, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5668787', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1475, 'n_words': 465}