pupilfirst_xapi 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pupilfirst_xapi/objects.rb +5 -4
- data/lib/pupilfirst_xapi/objects/video_end.rb +5 -6
- data/lib/pupilfirst_xapi/objects/video_start.rb +5 -6
- data/lib/pupilfirst_xapi/statements/video_ended.rb +2 -1
- data/lib/pupilfirst_xapi/statements/video_started.rb +2 -1
- data/lib/pupilfirst_xapi/version.rb +1 -1
- data/spec/integration_spec.rb +8 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f5c38a8fbf57be11cda1429b9cffc1ed6d818ca11a69d220305a2cd0e954125
|
4
|
+
data.tar.gz: c018dae18cd439930c6d70eba6fb60bafe8014d01a5ce2ae5be6ca3d5556f88c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3d62b03c85f3610a50d7cb3aa0bbbed2fad9ad4d6c3c9aa67fac48f972a64e9a08fdc6d59cc38a7b75e2400efecd2f555d2d6d960c7c889be617432ea347800
|
7
|
+
data.tar.gz: e525ac790f096b0b70a82727901cc88bacee1aeff9b44ecbca7e227e7d0e52bb2aeb39a3007af0b22b3345f05c54204d930523ec9f374f8d8fdde4650ecc246e
|
@@ -2,6 +2,7 @@ require_relative 'objects/builder'
|
|
2
2
|
require_relative 'objects/course'
|
3
3
|
require_relative 'objects/target'
|
4
4
|
require_relative 'objects/video_start'
|
5
|
+
require_relative 'objects/video_end'
|
5
6
|
|
6
7
|
module PupilfirstXapi
|
7
8
|
module Objects
|
@@ -13,13 +14,13 @@ module PupilfirstXapi
|
|
13
14
|
Target.new.call(target, uri_for)
|
14
15
|
end
|
15
16
|
|
16
|
-
def self.video_start(
|
17
|
-
VideoStart.new.call(
|
17
|
+
def self.video_start(target, uri_for)
|
18
|
+
VideoStart.new.call(target, uri_for)
|
18
19
|
end
|
19
20
|
|
20
21
|
|
21
|
-
def self.video_end(
|
22
|
-
VideoEnd.new.call(
|
22
|
+
def self.video_end(target, uri_for)
|
23
|
+
VideoEnd.new.call(target, uri_for)
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module PupilfirstXapi
|
2
2
|
module Objects
|
3
3
|
class VideoEnd
|
4
|
-
def call(
|
5
|
-
|
6
|
-
puts video_id
|
4
|
+
def call(target, uri_for)
|
5
|
+
target_uri = uri_for.call(target)
|
7
6
|
|
8
7
|
Builder.new(
|
9
|
-
id:
|
8
|
+
id: target_uri,
|
10
9
|
type: "http://activitystrea.ms/schema/1.0/event",
|
11
|
-
name:
|
12
|
-
description:
|
10
|
+
name: "video in #{target.title}",
|
11
|
+
description: target.description
|
13
12
|
).call
|
14
13
|
end
|
15
14
|
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module PupilfirstXapi
|
2
2
|
module Objects
|
3
3
|
class VideoStart
|
4
|
-
def call(
|
5
|
-
|
6
|
-
puts video_id
|
4
|
+
def call(target, uri_for)
|
5
|
+
target_uri = uri_for.call(target)
|
7
6
|
|
8
7
|
Builder.new(
|
9
|
-
id:
|
8
|
+
id: target_uri,
|
10
9
|
type: "http://activitystrea.ms/schema/1.0/event",
|
11
|
-
name:
|
12
|
-
description:
|
10
|
+
name: "video in #{target.title}",
|
11
|
+
description: target.description
|
13
12
|
).call
|
14
13
|
end
|
15
14
|
end
|
@@ -8,10 +8,11 @@ module PupilfirstXapi
|
|
8
8
|
|
9
9
|
def call(actor_id:, resource_id:)
|
10
10
|
actor = @repository.call(:user, actor_id)
|
11
|
+
target = @repository.call(:target, resource_id)
|
11
12
|
Xapi.create_statement(
|
12
13
|
actor: Actors.agent(actor),
|
13
14
|
verb: Verbs::VIDEO_ENDED,
|
14
|
-
object: Objects.video_end(
|
15
|
+
object: Objects.video_end(target, @uri_for)
|
15
16
|
)
|
16
17
|
end
|
17
18
|
end
|
@@ -8,10 +8,11 @@ module PupilfirstXapi
|
|
8
8
|
|
9
9
|
def call(actor_id:, resource_id:)
|
10
10
|
actor = @repository.call(:user, actor_id)
|
11
|
+
target = @repository.call(:target, resource_id)
|
11
12
|
Xapi.create_statement(
|
12
13
|
actor: Actors.agent(actor),
|
13
14
|
verb: Verbs::VIDEO_STARTED,
|
14
|
-
object: Objects.video_start(
|
15
|
+
object: Objects.video_start(target, @uri_for)
|
15
16
|
)
|
16
17
|
end
|
17
18
|
end
|
data/spec/integration_spec.rb
CHANGED
@@ -108,12 +108,14 @@ RSpec.describe "#xapi", type: :job, perform_jobs: true do
|
|
108
108
|
resource_id: ror_guides.id,
|
109
109
|
actor_id: john.id,
|
110
110
|
)
|
111
|
-
expect(PupilfirstXapi::Outbox::Job).to have_been_performed.with(
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
111
|
+
expect(PupilfirstXapi::Outbox::Job).to have_been_performed.with(
|
112
|
+
hash_including({
|
113
|
+
event_type: :course_completed,
|
114
|
+
actor_id: 123,
|
115
|
+
resource_id: 1234,
|
116
|
+
})
|
117
|
+
)
|
118
|
+
|
117
119
|
expect(request).to have_been_requested
|
118
120
|
end
|
119
121
|
end
|