Class: CanvasFactory::Assignment
- Inherits:
-
Object
- Object
- CanvasFactory::Assignment
- Defined in:
- lib/japanda/canvas_factory/assignment.rb
Instance Attribute Summary collapse
-
#course_id ⇒ Object
readonly
Returns the value of attribute course_id.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#due_at ⇒ Object
readonly
Returns the value of attribute due_at.
-
#grading_type ⇒ Object
readonly
Returns the value of attribute grading_type.
-
#html_url ⇒ Object
readonly
Returns the value of attribute html_url.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#published ⇒ Object
readonly
Returns the value of attribute published.
Instance Method Summary collapse
- #create_assignment(course_id, assignment_config) ⇒ Object
-
#initialize(course_id, assignment_config = CanvasFactory::AssignmentConfig.new) ⇒ Assignment
constructor
A new instance of Assignment.
Constructor Details
#initialize(course_id, assignment_config = CanvasFactory::AssignmentConfig.new) ⇒ Assignment
Returns a new instance of Assignment.
6 7 8 9 10 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 6 def initialize(course_id, assignment_config = CanvasFactory::AssignmentConfig.new) fail 'invalid course_id' if course_id.nil? @course_id = course_id create_assignment course_id, assignment_config end |
Instance Attribute Details
#course_id ⇒ Object (readonly)
Returns the value of attribute course_id.
4 5 6 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 4 def course_id @course_id end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 4 def created_at @created_at end |
#due_at ⇒ Object (readonly)
Returns the value of attribute due_at.
4 5 6 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 4 def due_at @due_at end |
#grading_type ⇒ Object (readonly)
Returns the value of attribute grading_type.
4 5 6 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 4 def grading_type @grading_type end |
#html_url ⇒ Object (readonly)
Returns the value of attribute html_url.
4 5 6 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 4 def html_url @html_url end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 4 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 4 def name @name end |
#published ⇒ Object (readonly)
Returns the value of attribute published.
4 5 6 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 4 def published @published end |
Instance Method Details
#create_assignment(course_id, assignment_config) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/japanda/canvas_factory/assignment.rb', line 12 def create_assignment(course_id, assignment_config) assign_end_point = "#{CANVAS_API_V1}/courses/#{course_id}/assignments" response = CanvasFactory.perform_post(assign_end_point, assignment_config.request_body) @id = response['id'] @name = response['name'] @html_url = response['html_url'] @grading_type = response['grading_type'] @published = response['published'] @created_at = response['created_at'] @due_at = response['due_at'] self end |