pupilfirst_xapi 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0f3740bcc9e9972d6c1e34d9128dc2e57c04251e3205c6303c64e8b159bded6
4
- data.tar.gz: ead50ce21e470ebece32da9b2b84a0fe0da2e2134f880baad68789cf7530aa75
3
+ metadata.gz: ab3ca34388c5e492e15f05a5768d692af65e56c3f088a1a2958143ab2dcf6152
4
+ data.tar.gz: 80bf4e923f96112d5e1f175f811fcaf1dc7c27709bcd7c937b09eeae4d89c755
5
5
  SHA512:
6
- metadata.gz: b207f1ea01071c3552aefff851f96a22dd9df5e4d87338efe3d35b541db3ed4a67f06a388ee9108f5e66bc6c8f9239639b74bea5d6dce517bf1de22321d84ee3
7
- data.tar.gz: '0552814f55f835c3332924704cdb6c09ed8568a4096246d953ba349435bae03741f796e7dc31d392d34b90479b37375c2e2269b1452969cbe0c511dfc4b72357'
6
+ metadata.gz: ac920b2427236772f18041c7219405fa05812248cc0745029ab62a72896076fb6335dac990e59783b653a6c7c3c5b922610e74b442c75c7a29d9c9fc6a77cb60
7
+ data.tar.gz: 3680b27bd76f6e184ffd307dfa50e9b97e27d46f85c19d49c827e430e02a87be75d6cbff741edbb1219fc19f82d8f755165675149eb273321104fb96511f82e4
@@ -1,6 +1,7 @@
1
1
  require_relative 'objects/builder'
2
2
  require_relative 'objects/course'
3
3
  require_relative 'objects/target'
4
+ require_relative 'objects/video_start'
4
5
 
5
6
  module PupilfirstXapi
6
7
  module Objects
@@ -11,5 +12,14 @@ module PupilfirstXapi
11
12
  def self.target(target, uri_for)
12
13
  Target.new.call(target, uri_for)
13
14
  end
15
+
16
+ def self.video_start(student, video_id, uri_for)
17
+ VideoStart.new.call(student, video_id, uri_for)
18
+ end
19
+
20
+
21
+ def self.video_end(student, video_id, uri_for)
22
+ VideoEnd.new.call(student, video_id, uri_for)
23
+ end
14
24
  end
15
25
  end
@@ -0,0 +1,17 @@
1
+ module PupilfirstXapi
2
+ module Objects
3
+ class VideoEnd
4
+ def call(student, video_id, uri_for)
5
+ student_uri = uri_for.call(student)
6
+ puts video_id
7
+
8
+ Builder.new(
9
+ id: student_uri,
10
+ type: "http://activitystrea.ms/schema/1.0/event",
11
+ name: student.name,
12
+ description: "student started video #{video_id}"
13
+ ).call
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module PupilfirstXapi
2
+ module Objects
3
+ class VideoStart
4
+ def call(student, video_id, uri_for)
5
+ student_uri = uri_for.call(student)
6
+ puts video_id
7
+
8
+ Builder.new(
9
+ id: student_uri,
10
+ type: "http://activitystrea.ms/schema/1.0/event",
11
+ name: student.name,
12
+ description: "student started video #{video_id}"
13
+ ).call
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,8 @@
1
1
  require "pupilfirst_xapi/statements/course_completed"
2
2
  require "pupilfirst_xapi/statements/course_registered"
3
3
  require "pupilfirst_xapi/statements/target_completed"
4
+ require "pupilfirst_xapi/statements/video_started"
5
+ require "pupilfirst_xapi/statements/video_ended"
4
6
 
5
7
  module PupilfirstXapi
6
8
  module Statements
@@ -17,6 +19,8 @@ module PupilfirstXapi
17
19
  :student_added => CourseRegistered,
18
20
  :submission_graded => TargetCompleted,
19
21
  :submission_automatically_verified => TargetCompleted,
22
+ :video_started => VideoStarted,
23
+ :video_ended => VideoEnded
20
24
  }
21
25
  end
22
26
  end
@@ -0,0 +1,19 @@
1
+ module PupilfirstXapi
2
+ module Statements
3
+ class VideoEnded
4
+ def initialize(repository, uri_for)
5
+ @repository = repository
6
+ @uri_for = uri_for
7
+ end
8
+
9
+ def call(actor_id:, resource_id:)
10
+ actor = @repository.call(:user, actor_id)
11
+ Xapi.create_statement(
12
+ actor: Actors.agent(actor),
13
+ verb: Verbs::VIDEO_ENDED,
14
+ object: Objects.video_end(actor, resource_id, @uri_for)
15
+ )
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module PupilfirstXapi
2
+ module Statements
3
+ class VideoStarted
4
+ def initialize(repository, uri_for)
5
+ @repository = repository
6
+ @uri_for = uri_for
7
+ end
8
+
9
+ def call(actor_id:, resource_id:)
10
+ actor = @repository.call(:user, actor_id)
11
+ Xapi.create_statement(
12
+ actor: Actors.agent(actor),
13
+ verb: Verbs::VIDEO_STARTED,
14
+ object: Objects.video_start(actor, resource_id, @uri_for)
15
+ )
16
+ end
17
+ end
18
+ end
19
+ end
@@ -3,5 +3,7 @@ module PupilfirstXapi
3
3
  COMPLETED = Xapi.create_verb(id: 'http://adlnet.gov/expapi/verbs/completed', name: 'completed')
4
4
  COMPLETED_ASSIGNMENT = Xapi.create_verb(id: 'https://w3id.org/xapi/dod-isd/verbs/completed-assignment', name: 'completed assignment')
5
5
  REGISTERED = Xapi.create_verb(id: 'http://adlnet.gov/expapi/verbs/registered', name: 'registered')
6
+ VIDEO_STARTED = Xapi.create_verb(id: 'http://activitystrea.ms/schema/1.0/start', name: 'start')
7
+ VIDEO_ENDED = Xapi.create_verb(id: 'http://activitystrea.ms/schema/1.0/consume', name: 'consumed')
6
8
  end
7
9
  end
@@ -1,3 +1,3 @@
1
1
  module PupilfirstXapi
2
- VERSION = '0.3.3'
2
+ VERSION = '0.3.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pupilfirst_xapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GrowthTribe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-09 00:00:00.000000000 Z
11
+ date: 2021-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description:
83
+ description:
84
84
  email:
85
85
  - devs@growthtribe.io
86
86
  executables: []
@@ -97,11 +97,15 @@ files:
97
97
  - lib/pupilfirst_xapi/objects/builder.rb
98
98
  - lib/pupilfirst_xapi/objects/course.rb
99
99
  - lib/pupilfirst_xapi/objects/target.rb
100
+ - lib/pupilfirst_xapi/objects/video_end.rb
101
+ - lib/pupilfirst_xapi/objects/video_start.rb
100
102
  - lib/pupilfirst_xapi/outbox.rb
101
103
  - lib/pupilfirst_xapi/statements.rb
102
104
  - lib/pupilfirst_xapi/statements/course_completed.rb
103
105
  - lib/pupilfirst_xapi/statements/course_registered.rb
104
106
  - lib/pupilfirst_xapi/statements/target_completed.rb
107
+ - lib/pupilfirst_xapi/statements/video_ended.rb
108
+ - lib/pupilfirst_xapi/statements/video_started.rb
105
109
  - lib/pupilfirst_xapi/verbs.rb
106
110
  - lib/pupilfirst_xapi/version.rb
107
111
  - spec/integration_spec.rb
@@ -120,7 +124,7 @@ metadata:
120
124
  homepage_uri: https://github.com/growthtribeacademy/pupilfirst-xapi
121
125
  source_code_uri: https://github.com/growthtribeacademy/pupilfirst-xapi/pupilfirst_xapi
122
126
  changelog_uri: https://github.com/growthtribeacademy/pupilfirst-xapi/pupilfirst_xapi/CHANGELOG.md
123
- post_install_message:
127
+ post_install_message:
124
128
  rdoc_options: []
125
129
  require_paths:
126
130
  - lib
@@ -135,17 +139,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
139
  - !ruby/object:Gem::Version
136
140
  version: '0'
137
141
  requirements: []
138
- rubygems_version: 3.2.3
139
- signing_key:
142
+ rubygems_version: 3.1.6
143
+ signing_key:
140
144
  specification_version: 4
141
145
  summary: XAPI statements generator and publisher to LRS for Pupilfirst
142
146
  test_files:
143
- - spec/integration_spec.rb
144
147
  - spec/objects/builder_spec.rb
145
- - spec/outbox_job_spec.rb
146
- - spec/outbox_spec.rb
147
148
  - spec/rails_helper.rb
148
- - spec/spec_helper.rb
149
+ - spec/statements/target_completed_spec.rb
149
150
  - spec/statements/course_completed_spec.rb
150
151
  - spec/statements/course_registered_spec.rb
151
- - spec/statements/target_completed_spec.rb
152
+ - spec/spec_helper.rb
153
+ - spec/outbox_spec.rb
154
+ - spec/integration_spec.rb
155
+ - spec/outbox_job_spec.rb