Module: Moodle

Defined in:
lib/moodle.rb,
lib/moodle/client.rb,
lib/moodle/helper.rb,
lib/moodle/services/user.rb,
lib/moodle/protocols/rest.rb,
lib/moodle/services/cohort.rb,
lib/moodle/services/course.rb,
lib/moodle/services/webservice.rb

Defined Under Namespace

Modules: Protocol, Service Classes: Client, Helper

Constant Summary collapse

@@config =
{
  :username => nil,
  :password => nil,
  :token => nil,
  :protocol => nil,
  :domain => nil,
  :service => nil,
  :format => 'json'
}

Class Method Summary collapse

Class Method Details

.configObject

Obtain the global configuration


36
37
38
# File 'lib/moodle.rb', line 36

def self.config
  @@config
end

.configure(options = {}) ⇒ Object

Configure at global level trough hash


25
26
27
# File 'lib/moodle.rb', line 25

def self.configure(options={})
  options.each {|k,v| @@config[k.to_sym] = v if @valid_config_keys.include? k.to_sym}
end

.configure_with(path_to_yaml_file) ⇒ Object

Configure at global level through yaml file


30
31
32
33
# File 'lib/moodle.rb', line 30

def self.configure_with(path_to_yaml_file)
  config = YAML::load(IO.read(path_to_yaml_file))
  configure(config)
end

.new(options = {}) ⇒ Object

Configuration is for the instance only


20
21
22
# File 'lib/moodle.rb', line 20

def self.new(options={})
  Moodle::Client.new(options)
end