Class: CanvasFactory::Quiz
- Inherits:
-
Object
- Object
- CanvasFactory::Quiz
- Defined in:
- lib/japanda/canvas_factory/quiz.rb
Overview
Quiz class
Instance Attribute Summary collapse
-
#course_id ⇒ Object
readonly
Returns the value of attribute course_id.
-
#due_at ⇒ Object
readonly
Returns the value of attribute due_at.
-
#html_url ⇒ Object
readonly
Returns the value of attribute html_url.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#published ⇒ Object
readonly
Returns the value of attribute published.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(course_id, opts = {}, merge = true) ⇒ Quiz
constructor
A new instance of Quiz.
Constructor Details
#initialize(course_id, opts = {}, merge = true) ⇒ Quiz
Returns a new instance of Quiz.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/japanda/canvas_factory/quiz.rb', line 7 def initialize(course_id, opts = {}, merge = true) @course_id = course_id @request = { quiz: { title: "quiz-#{Time.now.to_i}", description: 'api created quiz', quiz_type: %w(practice_quiz assignment graded_survey survey).sample, assignment_group_id: nil, time_limit: nil, shuffle_answers: true, hide_results: %w(always until_after_last_attempt).sample, show_correct_answers: true, show_correct_answers_last_attempt: true, hide_correct_answers_at: true, allowed_attempts: 1, scoring_policy: %w(keep_highest keep_latest).sample, one_question_at_a_time: false, cant_go_back: false, access_code: nil, ip_filter: nil, due_at: (DateTime.now + 10).iso8601, lock_at: (DateTime.now + 10).iso8601, unlock_at: (DateTime.now).iso8601, published: true, one_time_results: false } } @request = Mergie.deep_merge(@request, opts, merge) create_quiz self end |
Instance Attribute Details
#course_id ⇒ Object (readonly)
Returns the value of attribute course_id.
4 5 6 |
# File 'lib/japanda/canvas_factory/quiz.rb', line 4 def course_id @course_id end |
#due_at ⇒ Object (readonly)
Returns the value of attribute due_at.
4 5 6 |
# File 'lib/japanda/canvas_factory/quiz.rb', line 4 def due_at @due_at end |
#html_url ⇒ Object (readonly)
Returns the value of attribute html_url.
4 5 6 |
# File 'lib/japanda/canvas_factory/quiz.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/quiz.rb', line 4 def id @id end |
#published ⇒ Object (readonly)
Returns the value of attribute published.
4 5 6 |
# File 'lib/japanda/canvas_factory/quiz.rb', line 4 def published @published end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
4 5 6 |
# File 'lib/japanda/canvas_factory/quiz.rb', line 4 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/japanda/canvas_factory/quiz.rb', line 4 def response @response end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/japanda/canvas_factory/quiz.rb', line 4 def title @title end |