Class: Moodle2CC::CanvasCC::Models::Discussion

Inherits:
Object
  • Object
show all
Defined in:
lib/moodle2cc/canvas_cc/models/discussion.rb

Constant Summary collapse

DISCUSSION_ID_POSTFIX =
'_DISCUSSION'
DISCUSSION_META_POSTFIX =
'_meta'
IMSDT_TYPE =
'imsdt_xmlv1p1'
LAR_TYPE =
'associatedcontent/imscc_xmlv1p1/learning-application-resource'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#discussion_typeObject

Returns the value of attribute discussion_type.



3
4
5
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 3

def discussion_type
  @discussion_type
end

#identifierObject

Returns the value of attribute identifier.



3
4
5
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 3

def identifier
  @identifier
end

#is_announcementObject

Returns the value of attribute is_announcement.



3
4
5
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 3

def is_announcement
  @is_announcement
end

#points_possibleObject

Returns the value of attribute points_possible.



3
4
5
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 3

def points_possible
  @points_possible
end

#require_initial_postObject

Returns the value of attribute require_initial_post.



3
4
5
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 3

def require_initial_post
  @require_initial_post
end

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 3

def text
  @text
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 3

def title
  @title
end

#workflow_stateObject

Returns the value of attribute workflow_state.



3
4
5
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 3

def workflow_state
  @workflow_state
end

Instance Method Details

#discussion_resourceObject



14
15
16
17
18
19
20
21
22
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 14

def discussion_resource
  resource = Moodle2CC::CanvasCC::Models::Resource.new
  resource.identifier = @identifier
  resource.dependencies << resource.identifier + DISCUSSION_META_POSTFIX
  resource.type = IMSDT_TYPE
  resource.files << resource.identifier + '.xml'

  resource
end

#meta_resourceObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 24

def meta_resource
  resource = Moodle2CC::CanvasCC::Models::Resource.new
  resource.identifier = @identifier + DISCUSSION_META_POSTFIX
  resource.type = LAR_TYPE
  file_name = resource.identifier + '.xml'
  resource.href = file_name
  resource.files << file_name

  resource
end

#resourcesObject



9
10
11
12
# File 'lib/moodle2cc/canvas_cc/models/discussion.rb', line 9

def resources
  #generate_meta_resource
  [discussion_resource, meta_resource]
end