class Learndot
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)
Attributes
api[R]
Public Class Methods
new(debug = false, staging = false)
click to toggle source
# File lib/learndot.rb, line 22 def initialize(debug = false, staging = false) debug ||= false staging ||= false @api = Learndot::API.new(nil, debug, staging) end
timestamp(time = nil)
click to toggle source
# File lib/learndot.rb, line 28 def self.timestamp(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
Public Instance Methods
courses()
click to toggle source
# File lib/learndot/courses.rb, line 60 def courses Learndot::Courses.new(self.api) end
entity()
click to toggle source
# File lib/learndot/entity.rb, line 20 def entity Learndot::Entity.new(self.api) end
events()
click to toggle source
# File lib/learndot/events.rb, line 80 def events Learndot::Events.new(self.api) end
learning_component()
click to toggle source
# File lib/learndot/learning_components.rb, line 20 def learning_component Learndot::LearningComponents.new(self.api) end
training_credits()
click to toggle source
# File lib/learndot/training_credits.rb, line 28 def training_credits Learndot::TrainingCredits.new(self.api) end