Class: CanvasFactory::CourseConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/japanda/canvas_factory/course_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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] || 
  @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_idObject

Returns the value of attribute account_id.



3
4
5
# File 'lib/japanda/canvas_factory/course_config.rb', line 3

def 
  @account_id
end

#course_codeObject

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_atObject

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

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/japanda/canvas_factory/course_config.rb', line 3

def name
  @name
end

#offerObject

Returns the value of attribute offer.



3
4
5
# File 'lib/japanda/canvas_factory/course_config.rb', line 3

def offer
  @offer
end

#start_atObject

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_bodyObject



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