Module: Moodle::Api

Defined in:
lib/moodle/api.rb,
lib/moodle/api/client.rb,
lib/moodle/api/errors.rb,
lib/moodle/api/request.rb,
lib/moodle/api/version.rb,
lib/moodle/api/configuration.rb,
lib/moodle/api/token_generator.rb

Overview

Used to determine the current version of the gem Semantic versioning is used guides.rubygems.org/patterns/#semantic-versioning

Defined Under Namespace

Classes: Client, Configuration, MoodleError, Request, TokenGenerator

Constant Summary collapse

VERSION =
'1.5'

Class Method Summary collapse

Class Method Details

.clientObject



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

def client
  @client ||= Moodle::Api::Client.new
end

.method_missing(method, *args, &block) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/moodle/api.rb', line 13

def method_missing(method, *args, &block)
  if client.respond_to?(method)
    client.send(method, *args, &block)
  else
    # assume method name is moodle external service
    client.make_request(method, args.first)
  end
end

.respond_to?(method, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/moodle/api.rb', line 22

def respond_to?(method, include_all = false)
  client.respond_to?(method, include_all) || super
end