Class: CanvasFactory::CourseConfig
- Inherits:
-
Object
- Object
- CanvasFactory::CourseConfig
- Defined in:
- lib/japanda/canvas_factory/course_config.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#course_code ⇒ Object
Returns the value of attribute course_code.
-
#end_at ⇒ Object
Returns the value of attribute end_at.
-
#name ⇒ Object
Returns the value of attribute name.
-
#offer ⇒ Object
Returns the value of attribute offer.
-
#start_at ⇒ Object
Returns the value of attribute start_at.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ CourseConfig
constructor
A new instance of CourseConfig.
- #request_body ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ CourseConfig
Returns a new instance of CourseConfig.
5 6 7 8 9 10 11 12 13 |
# File 'lib/japanda/canvas_factory/course_config.rb', line 5 def initialize(opts = {}) course_name_code = "auto#{SecureRandom.hex}" @account_id = opts[:account_id] || CANVAS_ACCOUNT_ID @name = opts[:name] || course_name_code @course_code = opts[:course_code] || course_name_code @start_at = opts[:start_at] || Time.now @end_at = opts[:end_at] || Time.now + (30 * 24 * 60 * 60) @offer = opts[:offer] || true end |
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
3 4 5 |
# File 'lib/japanda/canvas_factory/course_config.rb', line 3 def account_id @account_id end |
#course_code ⇒ Object
Returns the value of attribute course_code.
3 4 5 |
# File 'lib/japanda/canvas_factory/course_config.rb', line 3 def course_code @course_code end |
#end_at ⇒ Object
Returns the value of attribute end_at.
3 4 5 |
# File 'lib/japanda/canvas_factory/course_config.rb', line 3 def end_at @end_at end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/japanda/canvas_factory/course_config.rb', line 3 def name @name end |
#offer ⇒ Object
Returns the value of attribute offer.
3 4 5 |
# File 'lib/japanda/canvas_factory/course_config.rb', line 3 def offer @offer end |
#start_at ⇒ Object
Returns the value of attribute start_at.
3 4 5 |
# File 'lib/japanda/canvas_factory/course_config.rb', line 3 def start_at @start_at end |
Instance Method Details
#request_body ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/japanda/canvas_factory/course_config.rb', line 15 def request_body { account_id: @account_id, course: { name: @name, course_code: @course_code, start_at: @start_at, end_at: @end_at }, offer: @offer } end |