Class: Moodle2CC::CanvasCC::Models::Assignment

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

Constant Summary collapse

LAR_TYPE =
'associatedcontent/imscc_xmlv1p1/learning-application-resource'
ASSIGNMENT_SETTINGS_FILE =
'assignment_settings.xml'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAssignment

Returns a new instance of Assignment.



11
12
13
# File 'lib/moodle2cc/canvas_cc/models/assignment.rb', line 11

def initialize
  @submission_types = []
end

Instance Attribute Details

#all_dayObject

Returns the value of attribute all_day.



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

def all_day
  @all_day
end

#all_day_dateObject

Returns the value of attribute all_day_date.



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

def all_day_date
  @all_day_date
end

#assignment_group_identifier_refObject

Returns the value of attribute assignment_group_identifier_ref.



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

def assignment_group_identifier_ref
  @assignment_group_identifier_ref
end

#automatic_peer_reviewsObject

Returns the value of attribute automatic_peer_reviews.



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

def automatic_peer_reviews
  @automatic_peer_reviews
end

#bodyObject

Returns the value of attribute body.



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

def body
  @body
end

#due_atObject

Returns the value of attribute due_at.



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

def due_at
  @due_at
end

#external_tool_urlObject

Returns the value of attribute external_tool_url.



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

def external_tool_url
  @external_tool_url
end

#grade_group_students_individuallyObject

Returns the value of attribute grade_group_students_individually.



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

def grade_group_students_individually
  @grade_group_students_individually
end

#grading_typeObject

Returns the value of attribute grading_type.



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

def grading_type
  @grading_type
end

#identifierObject

Returns the value of attribute identifier.



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

def identifier
  @identifier
end

#lock_atObject

Returns the value of attribute lock_at.



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

def lock_at
  @lock_at
end

#mutedObject

Returns the value of attribute muted.



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

def muted
  @muted
end

#peer_review_countObject

Returns the value of attribute peer_review_count.



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

def peer_review_count
  @peer_review_count
end

#peer_reviewsObject

Returns the value of attribute peer_reviews.



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

def peer_reviews
  @peer_reviews
end

#peer_reviews_assignedObject

Returns the value of attribute peer_reviews_assigned.



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

def peer_reviews_assigned
  @peer_reviews_assigned
end

#peer_reviews_due_atObject

Returns the value of attribute peer_reviews_due_at.



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

def peer_reviews_due_at
  @peer_reviews_due_at
end

#points_possibleObject

Returns the value of attribute points_possible.



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

def points_possible
  @points_possible
end

#positionObject

Returns the value of attribute position.



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

def position
  @position
end

#submission_typesObject

Returns the value of attribute submission_types.



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

def submission_types
  @submission_types
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

#unlock_atObject

Returns the value of attribute unlock_at.



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

def unlock_at
  @unlock_at
end

#workflow_stateObject

Returns the value of attribute workflow_state.



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

def workflow_state
  @workflow_state
end

Instance Method Details

#assignment_resourceObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/moodle2cc/canvas_cc/models/assignment.rb', line 19

def assignment_resource
  resource = Moodle2CC::CanvasCC::Models::Resource.new
  resource.identifier = @identifier
  suffix = CGI::escape(title.downcase.gsub(/\s/, '-'))
  suffix = suffix[0, 100] if suffix.length > 100

  resource.href = "#{resource.identifier}/assignment-#{suffix}.html"
  resource.type = LAR_TYPE
  resource.files = [resource.href, "#{resource.identifier}/#{ASSIGNMENT_SETTINGS_FILE}"]

  resource
end

#resourcesObject



15
16
17
# File 'lib/moodle2cc/canvas_cc/models/assignment.rb', line 15

def resources
  [assignment_resource]
end