Class: PupilfirstXapi::Objects::Target

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

Instance Method Summary collapse

Instance Method Details

#call(target, uri_for) ⇒ Object



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

def call(target, uri_for)
  course = target.course
  target_uri = uri_for.call(target)

  Builder.new(
    id: target_uri,
    type: "http://activitystrea.ms/schema/1.0/task",
    name: target.title,
    description: target.description
  ).tap do |obj|
    obj.with_extension('http://id.tincanapi.com/extension/host', Objects.course(course, uri_for).as_json)
    obj.with_extension('http://id.tincanapi.com/extension/position', target.sort_index)
  end.call
end