Class: GithubToCanvasQuiz::Builder::Quiz

Inherits:
Object
  • Object
show all
Defined in:
lib/github_to_canvas_quiz/builder/quiz.rb

Overview

Create markdown files from a Canvas Quiz

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, course_id, quiz_id, path) ⇒ Quiz

Returns a new instance of Quiz.



10
11
12
13
14
15
# File 'lib/github_to_canvas_quiz/builder/quiz.rb', line 10

def initialize(client, course_id, quiz_id, path)
  @path = path
  @client = client
  @course_id = course_id
  @quiz_id = quiz_id
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/github_to_canvas_quiz/builder/quiz.rb', line 8

def client
  @client
end

#course_idObject (readonly)

Returns the value of attribute course_id.



8
9
10
# File 'lib/github_to_canvas_quiz/builder/quiz.rb', line 8

def course_id
  @course_id
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/github_to_canvas_quiz/builder/quiz.rb', line 8

def path
  @path
end

#quiz_idObject (readonly)

Returns the value of attribute quiz_id.



8
9
10
# File 'lib/github_to_canvas_quiz/builder/quiz.rb', line 8

def quiz_id
  @quiz_id
end

Instance Method Details

#buildObject



17
18
19
20
21
22
23
# File 'lib/github_to_canvas_quiz/builder/quiz.rb', line 17

def build
  prepare_directory!
  save_quiz!
  save_questions!
  backup_canvas_to_json!
  commit!
end