Class: Moodle::Api::TokenGenerator
- Inherits:
-
Object
- Object
- Moodle::Api::TokenGenerator
- Defined in:
- lib/moodle/api/token_generator.rb
Overview
Generates tokens using username, password and service Used for accessing Moodle API
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(configuration) ⇒ TokenGenerator
constructor
A new instance of TokenGenerator.
Constructor Details
#initialize(configuration) ⇒ TokenGenerator
Returns a new instance of TokenGenerator.
8 9 10 |
# File 'lib/moodle/api/token_generator.rb', line 8 def initialize(configuration) @configuration = configuration end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
6 7 8 |
# File 'lib/moodle/api/token_generator.rb', line 6 def configuration @configuration end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/moodle/api/token_generator.rb', line 12 def call if raise_token_exception? fail ArgumentError, 'Username and password are required to generate a token' end generate_token end |