Class: CanvasFactory::AssignmentConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/japanda/canvas_factory/assignment_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ AssignmentConfig

Returns a new instance of AssignmentConfig.



5
6
7
8
9
10
11
12
# File 'lib/japanda/canvas_factory/assignment_config.rb', line 5

def initialize(opts = {})
  @name = opts[:name] || "Assignment-#{Time.now.to_i}"
  @grading_type = opts[:grading_type] || %w(pass_fail percent letter_grade gpa_scale points).sample
  @submission_types = opts[:submission_types] || ['online_text_entry']
  @points_possible = opts[:points_possible] || 10
  @due_at = opts[:due_at] || (DateTime.now + 1).iso8601
  @published = opts[:published] || true
end

Instance Attribute Details

#due_atObject

Returns the value of attribute due_at.



3
4
5
# File 'lib/japanda/canvas_factory/assignment_config.rb', line 3

def due_at
  @due_at
end

#grading_typeObject

Returns the value of attribute grading_type.



3
4
5
# File 'lib/japanda/canvas_factory/assignment_config.rb', line 3

def grading_type
  @grading_type
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/japanda/canvas_factory/assignment_config.rb', line 3

def name
  @name
end

#points_possibleObject

Returns the value of attribute points_possible.



3
4
5
# File 'lib/japanda/canvas_factory/assignment_config.rb', line 3

def points_possible
  @points_possible
end

#publishedObject

Returns the value of attribute published.



3
4
5
# File 'lib/japanda/canvas_factory/assignment_config.rb', line 3

def published
  @published
end

#submission_typesObject

Returns the value of attribute submission_types.



3
4
5
# File 'lib/japanda/canvas_factory/assignment_config.rb', line 3

def submission_types
  @submission_types
end

Instance Method Details

#request_bodyObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/japanda/canvas_factory/assignment_config.rb', line 14

def request_body
  {
    assignment: {
      name: @name,
      grading_type: @grading_type,
      submission_types: @submission_types,
      points_possible: @points_possible,
      due_at: @due_at,
      published: @published
    }
  }
end