Class: Learndot
- Inherits:
-
Object
- Object
- Learndot
- Defined in:
- lib/learndot.rb,
lib/learndot/events.rb,
lib/learndot/courses.rb,
lib/learndot/training_credits.rb,
lib/learndot/learning_components.rb
Overview
This class serves as a “wrapper” for subclasses. Each time a subclass is called, it will monkeypatch itself into this one. Then you’ll have a factory method to return a properly scoped subclass.
For example:
require ‘learndot’ require ‘learndot/events’
conditions =
'startTime' => [Learndot.timestamp(), Learndot.timestamp(3*7*24*60*60)],
'status' => ['CONFIRMED', 'TENTATIVE'],
ld = Learndot.new ld.events.retrieve(conditions)
Defined Under Namespace
Classes: API, Courses, Events, LearningComponents, TrainingCredits
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Class Method Summary collapse
Instance Method Summary collapse
- #courses ⇒ Object
- #events ⇒ Object
-
#initialize(debug = false, staging = false) ⇒ Learndot
constructor
A new instance of Learndot.
- #learning_component ⇒ Object
- #training_credits ⇒ Object
Constructor Details
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
20 21 22 |
# File 'lib/learndot.rb', line 20 def api @api end |
Class Method Details
.timestamp(time = nil) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/learndot.rb', line 26 def self.(time = nil) time ||= Time.new time = Time.new + time if time.is_a? Numeric raise "timestamp() expects a Time object or number of seconds from now as an integer." unless time.class == Time time.strftime('%Y-%m-%d %H:%M:%S') end |
Instance Method Details
#courses ⇒ Object
60 61 62 |
# File 'lib/learndot/courses.rb', line 60 def courses Learndot::Courses.new(self.api) end |
#events ⇒ Object
80 81 82 |
# File 'lib/learndot/events.rb', line 80 def events Learndot::Events.new(self.api) end |
#learning_component ⇒ Object
20 21 22 |
# File 'lib/learndot/learning_components.rb', line 20 def learning_component Learndot::LearningComponents.new(self.api) end |
#training_credits ⇒ Object
28 29 30 |
# File 'lib/learndot/training_credits.rb', line 28 def training_credits Learndot::TrainingCredits.new(self.api) end |