Class: PupilfirstXapi::Objects::Answer

Inherits:
Object
  • Object
show all
Defined in:
lib/pupilfirst_xapi/objects/answer.rb

Instance Method Summary collapse

Instance Method Details

#call(answer, uri_for) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/pupilfirst_xapi/objects/answer.rb', line 4

def call(answer, uri_for)
  target_uri = uri_for.call(answer)

  Builder.new(
    id: target_uri,
    type: 'http://adlnet.gov/expapi/activities/assessment',
    name: answer.question.description,
    description: answer.question.description
  ).with_extension('http://adlnet.gov/expapi/activities/question', answer.question.description)
  .with_extension('http://adlnet.gov/expapi/activities/answer', answer.content || answer.alternatives.as_json)
    .call
end