Class: Senkyoshi::Course

Inherits:
FileResource show all
Defined in:
lib/senkyoshi/models/course.rb

Instance Attribute Summary

Attributes inherited from FileResource

#id

Instance Method Summary collapse

Methods inherited from FileResource

from

Methods inherited from Resource

#_find_directories, #_fix_path, #_matches_directory_xid?, #_search_and_replace, #cleanup, #fix_html, get_pre_data, #matches_xid?, #strip_xid

Constructor Details

#initialize(resource_id = nil) ⇒ Course

This class represents a reader for one zip file, and allows the usage of individual files within zip file



9
10
11
12
13
14
15
16
17
# File 'lib/senkyoshi/models/course.rb', line 9

def initialize(resource_id = nil)
  super(resource_id)
  @course_code = ""
  @title = ""
  @description = ""
  @is_public = false
  @start_at = ""
  @conclude_at = ""
end

Instance Method Details

#canvas_conversion(course, _resources = nil) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/senkyoshi/models/course.rb', line 28

def canvas_conversion(course, _resources = nil)
  course.identifier = @id
  course.title = @title
  course.description = @description
  course.is_public = @is_public
  course.start_at = @start_at
  course.conclude_at = @conclude_at
  course
end

#iterate_xml(data, _) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/senkyoshi/models/course.rb', line 19

def iterate_xml(data, _)
  @title = Senkyoshi.get_attribute_value(data, "TITLE")
  @description = Senkyoshi.get_description(data)
  @is_public = Senkyoshi.get_attribute_value(data, "ISAVAILABLE")
  @start_at = Senkyoshi.get_attribute_value(data, "COURSESTART")
  @conclude_at = Senkyoshi.get_attribute_value(data, "COURSEEND")
  self
end