Class: GithubToCanvasQuiz::Parser::Canvas::Quiz

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/github_to_canvas_quiz/parser/canvas/quiz.rb

Overview

Parses a quiz from the Canvas API and returns a Quiz

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#choose_text, #clean_html, #remove_canvas_cruft

Constructor Details

#initialize(data) ⇒ Quiz

Returns a new instance of Quiz.



12
13
14
# File 'lib/github_to_canvas_quiz/parser/canvas/quiz.rb', line 12

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



10
11
12
# File 'lib/github_to_canvas_quiz/parser/canvas/quiz.rb', line 10

def data
  @data
end

Instance Method Details

#parseObject



16
17
18
19
20
21
22
23
24
# File 'lib/github_to_canvas_quiz/parser/canvas/quiz.rb', line 16

def parse
  Model::Quiz.new(
    course_id: data['course_id'],
    id: data['id'],
    repo: repo,
    title: data['title'],
    description: description
  )
end