Class: Senkyoshi::Module

Inherits:
Resource show all
Defined in:
lib/senkyoshi/models/module.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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(title, identifier) ⇒ Module

Returns a new instance of Module.



22
23
24
25
26
# File 'lib/senkyoshi/models/module.rb', line 22

def initialize(title, identifier)
  @identifier = identifier
  @title = title
  @module_items = []
end

Instance Attribute Details

#module_itemsObject

Returns the value of attribute module_items.



20
21
22
# File 'lib/senkyoshi/models/module.rb', line 20

def module_items
  @module_items
end

Class Method Details

.find_module_from_item_id(modules, id) ⇒ Object



28
29
30
31
32
# File 'lib/senkyoshi/models/module.rb', line 28

def self.find_module_from_item_id(modules, id)
  modules.detect do |mod|
    mod.module_items.detect { |item| item.identifierref == id }
  end
end

Instance Method Details

#canvas_conversionObject



34
35
36
37
38
39
40
41
# File 'lib/senkyoshi/models/module.rb', line 34

def canvas_conversion(*)
  CanvasCc::CanvasCC::Models::CanvasModule.new.tap do |cc_module|
    cc_module.identifier = @identifier
    cc_module.title = @title
    cc_module.workflow_state = "published"
    cc_module.module_items = @module_items
  end
end