scorm_engine 0.6.10 → 0.7.0

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/scorm_engine/api/endpoints/courses/import.rb +5 -0
  3. data/lib/scorm_engine/api/endpoints/dispatches.rb +28 -19
  4. data/lib/scorm_engine/version.rb +1 -1
  5. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_delete_dispatch/returns_success_even_when_id_is_invalid.yml +3 -3
  6. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_delete_dispatch/works.yml +3 -3
  7. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch/fails_when_id_is_invalid.yml +3 -3
  8. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch/is_successful.yml +6 -6
  9. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch/results/sucessfully_creates_the_dispatch_attributes.yml +6 -6
  10. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_enabled/is_false_when_disabled.yml +8 -8
  11. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_enabled/is_true_when_enabled.yml +8 -8
  12. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_id.yml +3 -3
  13. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_type.yml +4 -4
  14. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works.yml +7 -7
  15. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_AICC.yml +7 -7
  16. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM12.yml +7 -7
  17. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM2004-3RD.yml +8 -8
  18. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_more_option_pagination_/returns_all_the_dispatches.yml +11 -11
  19. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_more_option_pagination_/returns_the_more_key_in_the_raw_response.yml +5 -5
  20. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_since_option/fails_when_passed_an_invalid_value.yml +3 -3
  21. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_since_option/works.yml +5 -5
  22. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/is_successful.yml +5 -5
  23. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/results/is_an_enumerator_of_dispatch_models.yml +5 -5
  24. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/results/sucessfully_creates_the_dispatch_attributes.yml +11 -11
  25. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_post_dispatch/is_successful.yml +8 -8
  26. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_post_dispatch/{is_updates_if_same_dispatch_id.yml → updates_if_same_dispatch_id.yml} +16 -16
  27. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch/is_successful.yml +4 -4
  28. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch/results/sucessfully_creates_the_dispatch_attributes.yml +10 -10
  29. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/fails_when_invalid.yml +5 -5
  30. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/works_when_false.yml +4 -4
  31. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/works_when_true.yml +4 -4
  32. data/spec/scorm_engine/api/endpoints/dispatches_spec.rb +25 -5
  33. data/spec/support/scorm_engine.rb +5 -1
  34. metadata +3 -3
@@ -2,13 +2,13 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: delete
5
- uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
5
+ uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id-2
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
10
  User-Agent:
11
- - ScormEngine Ruby Gem 0.3.0
11
+ - ScormEngine Ruby Gem 0.6.10
12
12
  Authorization:
13
13
  - Basic <BASIC_AUTH>
14
14
  response:
@@ -17,7 +17,7 @@ http_interactions:
17
17
  message: ''
18
18
  headers:
19
19
  date:
20
- - Mon, 20 Aug 2018 23:04:57 GMT
20
+ - Thu, 04 Oct 2018 21:23:10 GMT
21
21
  server:
22
22
  - nginx
23
23
  connection:
@@ -26,16 +26,16 @@ http_interactions:
26
26
  encoding: UTF-8
27
27
  string: ''
28
28
  http_version:
29
- recorded_at: Mon, 20 Aug 2018 23:04:57 GMT
29
+ recorded_at: Thu, 04 Oct 2018 21:23:11 GMT
30
30
  - request:
31
31
  method: post
32
32
  uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches
33
33
  body:
34
34
  encoding: UTF-8
35
- string: '{"dispatches":[{"id":"testing-dispatch-id","data":{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":0,"expirationDate":null,"externalConfig":null}}]}'
35
+ string: '{"dispatches":[{"id":"testing-dispatch-id-2","data":{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2018-01-01","externalConfig":null}}]}'
36
36
  headers:
37
37
  User-Agent:
38
- - ScormEngine Ruby Gem 0.3.0
38
+ - ScormEngine Ruby Gem 0.6.10
39
39
  Authorization:
40
40
  - Basic <BASIC_AUTH>
41
41
  Content-Type:
@@ -46,7 +46,7 @@ http_interactions:
46
46
  message: ''
47
47
  headers:
48
48
  date:
49
- - Mon, 20 Aug 2018 23:04:57 GMT
49
+ - Thu, 04 Oct 2018 21:23:11 GMT
50
50
  server:
51
51
  - nginx
52
52
  connection:
@@ -55,5 +55,5 @@ http_interactions:
55
55
  encoding: UTF-8
56
56
  string: ''
57
57
  http_version:
58
- recorded_at: Mon, 20 Aug 2018 23:04:57 GMT
58
+ recorded_at: Thu, 04 Oct 2018 21:23:11 GMT
59
59
  recorded_with: VCR 4.0.0
@@ -2,13 +2,13 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
5
+ uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id-2
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
10
  User-Agent:
11
- - ScormEngine Ruby Gem 0.6.6
11
+ - ScormEngine Ruby Gem 0.6.10
12
12
  Authorization:
13
13
  - Basic <BASIC_AUTH>
14
14
  response:
@@ -19,29 +19,29 @@ http_interactions:
19
19
  content-type:
20
20
  - application/json
21
21
  date:
22
- - Mon, 17 Sep 2018 22:04:10 GMT
22
+ - Thu, 04 Oct 2018 21:23:08 GMT
23
23
  server:
24
24
  - nginx
25
25
  vary:
26
26
  - Accept-Encoding
27
27
  content-length:
28
- - '178'
28
+ - '199'
29
29
  connection:
30
30
  - Close
31
31
  body:
32
32
  encoding: ASCII-8BIT
33
- string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":0,"expirationDate":"none","externalConfig":"scormenginegemtesting-default","enabled":true,"registrationCount":0,"registrationResetDate":"none"}'
33
+ string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2018-01-01T00:00:00Z","externalConfig":"scormenginegemtesting-default","enabled":true,"registrationCount":0,"registrationResetDate":"none"}'
34
34
  http_version:
35
- recorded_at: Mon, 17 Sep 2018 22:04:10 GMT
35
+ recorded_at: Thu, 04 Oct 2018 21:23:08 GMT
36
36
  - request:
37
37
  method: post
38
38
  uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches
39
39
  body:
40
40
  encoding: UTF-8
41
- string: '{"dispatches":[{"id":"testing-dispatch-id","data":{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":0,"expirationDate":"2030-01-01","externalConfig":null}}]}'
41
+ string: '{"dispatches":[{"id":"testing-dispatch-id-2","data":{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2030-01-01","externalConfig":null}}]}'
42
42
  headers:
43
43
  User-Agent:
44
- - ScormEngine Ruby Gem 0.6.6
44
+ - ScormEngine Ruby Gem 0.6.10
45
45
  Authorization:
46
46
  - Basic <BASIC_AUTH>
47
47
  Content-Type:
@@ -52,7 +52,7 @@ http_interactions:
52
52
  message: ''
53
53
  headers:
54
54
  date:
55
- - Mon, 17 Sep 2018 22:04:11 GMT
55
+ - Thu, 04 Oct 2018 21:23:08 GMT
56
56
  server:
57
57
  - nginx
58
58
  connection:
@@ -61,16 +61,16 @@ http_interactions:
61
61
  encoding: UTF-8
62
62
  string: ''
63
63
  http_version:
64
- recorded_at: Mon, 17 Sep 2018 22:04:11 GMT
64
+ recorded_at: Thu, 04 Oct 2018 21:23:08 GMT
65
65
  - request:
66
66
  method: get
67
- uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
67
+ uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id-2
68
68
  body:
69
69
  encoding: US-ASCII
70
70
  string: ''
71
71
  headers:
72
72
  User-Agent:
73
- - ScormEngine Ruby Gem 0.6.6
73
+ - ScormEngine Ruby Gem 0.6.10
74
74
  Authorization:
75
75
  - Basic <BASIC_AUTH>
76
76
  response:
@@ -81,18 +81,18 @@ http_interactions:
81
81
  content-type:
82
82
  - application/json
83
83
  date:
84
- - Mon, 17 Sep 2018 22:04:11 GMT
84
+ - Thu, 04 Oct 2018 21:23:08 GMT
85
85
  server:
86
86
  - nginx
87
87
  vary:
88
88
  - Accept-Encoding
89
89
  content-length:
90
- - '196'
90
+ - '198'
91
91
  connection:
92
92
  - Close
93
93
  body:
94
94
  encoding: ASCII-8BIT
95
- string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":0,"expirationDate":"2030-01-01T00:00:00Z","externalConfig":"scormenginegemtesting-default","enabled":true,"registrationCount":0,"registrationResetDate":"none"}'
95
+ string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2030-01-01T00:00:00Z","externalConfig":"scormenginegemtesting-default","enabled":true,"registrationCount":0,"registrationResetDate":"none"}'
96
96
  http_version:
97
- recorded_at: Mon, 17 Sep 2018 22:04:11 GMT
97
+ recorded_at: Thu, 04 Oct 2018 21:23:09 GMT
98
98
  recorded_with: VCR 4.0.0
@@ -2,13 +2,13 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: put
5
- uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
5
+ uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id-2
6
6
  body:
7
7
  encoding: UTF-8
8
8
  string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2018-01-01","externalConfig":null}'
9
9
  headers:
10
10
  User-Agent:
11
- - ScormEngine Ruby Gem 0.3.0
11
+ - ScormEngine Ruby Gem 0.6.10
12
12
  Authorization:
13
13
  - Basic <BASIC_AUTH>
14
14
  Content-Type:
@@ -19,7 +19,7 @@ http_interactions:
19
19
  message: ''
20
20
  headers:
21
21
  date:
22
- - Mon, 20 Aug 2018 23:04:42 GMT
22
+ - Thu, 04 Oct 2018 21:21:44 GMT
23
23
  server:
24
24
  - nginx
25
25
  connection:
@@ -28,5 +28,5 @@ http_interactions:
28
28
  encoding: UTF-8
29
29
  string: ''
30
30
  http_version:
31
- recorded_at: Mon, 20 Aug 2018 23:04:42 GMT
31
+ recorded_at: Thu, 04 Oct 2018 21:21:44 GMT
32
32
  recorded_with: VCR 4.0.0
@@ -2,13 +2,13 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: put
5
- uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
5
+ uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id-2
6
6
  body:
7
7
  encoding: UTF-8
8
8
  string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2018-01-01","externalConfig":null}'
9
9
  headers:
10
10
  User-Agent:
11
- - ScormEngine Ruby Gem 0.3.0
11
+ - ScormEngine Ruby Gem 0.6.10
12
12
  Authorization:
13
13
  - Basic <BASIC_AUTH>
14
14
  Content-Type:
@@ -19,7 +19,7 @@ http_interactions:
19
19
  message: ''
20
20
  headers:
21
21
  date:
22
- - Mon, 20 Aug 2018 23:04:44 GMT
22
+ - Thu, 04 Oct 2018 21:21:56 GMT
23
23
  server:
24
24
  - nginx
25
25
  connection:
@@ -28,16 +28,16 @@ http_interactions:
28
28
  encoding: UTF-8
29
29
  string: ''
30
30
  http_version:
31
- recorded_at: Mon, 20 Aug 2018 23:04:44 GMT
31
+ recorded_at: Thu, 04 Oct 2018 21:21:56 GMT
32
32
  - request:
33
33
  method: get
34
- uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
34
+ uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id-2
35
35
  body:
36
36
  encoding: US-ASCII
37
37
  string: ''
38
38
  headers:
39
39
  User-Agent:
40
- - ScormEngine Ruby Gem 0.3.0
40
+ - ScormEngine Ruby Gem 0.6.10
41
41
  Authorization:
42
42
  - Basic <BASIC_AUTH>
43
43
  response:
@@ -48,18 +48,18 @@ http_interactions:
48
48
  content-type:
49
49
  - application/json
50
50
  date:
51
- - Mon, 20 Aug 2018 23:04:44 GMT
51
+ - Thu, 04 Oct 2018 21:21:56 GMT
52
52
  server:
53
53
  - nginx
54
54
  vary:
55
55
  - Accept-Encoding
56
56
  content-length:
57
- - '199'
57
+ - '196'
58
58
  connection:
59
59
  - Close
60
60
  body:
61
61
  encoding: ASCII-8BIT
62
- string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2018-01-01T00:00:00Z","externalConfig":"scormenginegemtesting-default","enabled":true,"registrationCount":0,"registrationResetDate":"none"}'
62
+ string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2018-01-01T00:00:00Z","externalConfig":"scormenginegemtesting-default","enabled":false,"registrationCount":0,"registrationResetDate":"none"}'
63
63
  http_version:
64
- recorded_at: Mon, 20 Aug 2018 23:04:44 GMT
64
+ recorded_at: Thu, 04 Oct 2018 21:21:56 GMT
65
65
  recorded_with: VCR 4.0.0
@@ -2,13 +2,13 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: put
5
- uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id/enabled
5
+ uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id-2/enabled
6
6
  body:
7
7
  encoding: UTF-8
8
8
  string: oops
9
9
  headers:
10
10
  User-Agent:
11
- - ScormEngine Ruby Gem 0.3.0
11
+ - ScormEngine Ruby Gem 0.6.10
12
12
  Authorization:
13
13
  - Basic <BASIC_AUTH>
14
14
  Content-Type:
@@ -21,7 +21,7 @@ http_interactions:
21
21
  content-type:
22
22
  - text/plain
23
23
  date:
24
- - Mon, 20 Aug 2018 23:04:49 GMT
24
+ - Thu, 04 Oct 2018 21:22:30 GMT
25
25
  server:
26
26
  - nginx
27
27
  content-length:
@@ -32,7 +32,7 @@ http_interactions:
32
32
  encoding: UTF-8
33
33
  string: |-
34
34
  Unrecognized token 'oops': was expecting ('true', 'false' or 'null')
35
- at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@7e3cc9a0; line: 1, column: 9]
35
+ at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@57adebb3; line: 1, column: 9]
36
36
  http_version:
37
- recorded_at: Mon, 20 Aug 2018 23:04:49 GMT
37
+ recorded_at: Thu, 04 Oct 2018 21:22:30 GMT
38
38
  recorded_with: VCR 4.0.0
@@ -2,13 +2,13 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: put
5
- uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id/enabled
5
+ uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id-2/enabled
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: 'false'
9
9
  headers:
10
10
  User-Agent:
11
- - ScormEngine Ruby Gem 0.3.0
11
+ - ScormEngine Ruby Gem 0.6.10
12
12
  Authorization:
13
13
  - Basic <BASIC_AUTH>
14
14
  Content-Type:
@@ -19,7 +19,7 @@ http_interactions:
19
19
  message: ''
20
20
  headers:
21
21
  date:
22
- - Mon, 20 Aug 2018 23:04:47 GMT
22
+ - Thu, 04 Oct 2018 21:22:32 GMT
23
23
  server:
24
24
  - nginx
25
25
  connection:
@@ -28,5 +28,5 @@ http_interactions:
28
28
  encoding: UTF-8
29
29
  string: ''
30
30
  http_version:
31
- recorded_at: Mon, 20 Aug 2018 23:04:47 GMT
31
+ recorded_at: Thu, 04 Oct 2018 21:22:32 GMT
32
32
  recorded_with: VCR 4.0.0
@@ -2,13 +2,13 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: put
5
- uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id/enabled
5
+ uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id-2/enabled
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: 'true'
9
9
  headers:
10
10
  User-Agent:
11
- - ScormEngine Ruby Gem 0.3.0
11
+ - ScormEngine Ruby Gem 0.6.10
12
12
  Authorization:
13
13
  - Basic <BASIC_AUTH>
14
14
  Content-Type:
@@ -19,7 +19,7 @@ http_interactions:
19
19
  message: ''
20
20
  headers:
21
21
  date:
22
- - Mon, 20 Aug 2018 23:04:46 GMT
22
+ - Thu, 04 Oct 2018 21:22:34 GMT
23
23
  server:
24
24
  - nginx
25
25
  connection:
@@ -28,5 +28,5 @@ http_interactions:
28
28
  encoding: UTF-8
29
29
  string: ''
30
30
  http_version:
31
- recorded_at: Mon, 20 Aug 2018 23:04:46 GMT
31
+ recorded_at: Thu, 04 Oct 2018 21:22:34 GMT
32
32
  recorded_with: VCR 4.0.0
@@ -15,7 +15,11 @@ RSpec.describe ScormEngine::Api::Endpoints::Dispatches do
15
15
  let(:dispatch_options) { {
16
16
  destination_id: destination_options[:destination_id],
17
17
  course_id: course_options[:course_id],
18
- dispatch_id: "testing-dispatch-id",
18
+ dispatch_id: "testing-dispatch-id-2",
19
+ allow_new_registrations: false,
20
+ instanced: false,
21
+ registration_cap: 123,
22
+ expiration_date: "2018-01-01",
19
23
  } }
20
24
 
21
25
  before do
@@ -100,9 +104,15 @@ RSpec.describe ScormEngine::Api::Endpoints::Dispatches do
100
104
  end
101
105
  end
102
106
 
103
- it "is updates if same dispatch_id" do
107
+ it "raises ArgumentError when :expiration_date is invalid string" do
108
+ expect {
109
+ subject.post_dispatch(dispatch_options.merge(expiration_date: "not-a-parsable-date"))
110
+ }.to raise_error(ArgumentError, /Invalid option expiration_date/)
111
+ end
112
+
113
+ it "updates if same dispatch_id" do
104
114
  response = subject.get_dispatch(dispatch_id: dispatch_options[:dispatch_id])
105
- expect(response.result.expiration_date).to eq nil
115
+ expect(response.result.expiration_date.to_date).to eq Date.new(2018, 1, 1)
106
116
 
107
117
  response = subject.post_dispatch(dispatch_options.merge(expiration_date: Date.new(2030, 1, 1)))
108
118
  aggregate_failures do
@@ -148,7 +158,17 @@ RSpec.describe ScormEngine::Api::Endpoints::Dispatches do
148
158
  end
149
159
 
150
160
  describe "#put_dispatch" do
151
- let(:response) { subject.put_dispatch(dispatch_options.merge(allow_new_registrations: false, instanced: false, registration_cap: 123, expiration_date: "2018-01-01")) }
161
+ let(:response) { subject.put_dispatch(dispatch_options) }
162
+
163
+ %i[
164
+ dispatch_id destination_id course_id allow_new_registrations
165
+ instanced registration_cap expiration_date
166
+ ].each do |arg|
167
+ it "raises ArgumentError when :#{arg} is missing" do
168
+ dispatch_options.delete(arg)
169
+ expect { subject.put_dispatch(dispatch_options) }.to raise_error(ArgumentError, /#{arg} missing/)
170
+ end
171
+ end
152
172
 
153
173
  it "is successful" do
154
174
  expect(response.success?).to eq true
@@ -243,7 +263,7 @@ RSpec.describe ScormEngine::Api::Endpoints::Dispatches do
243
263
  expect(response.status).to eq 200
244
264
  expect(response.result.dispatch_id).to eq dispatch_options[:dispatch_id]
245
265
  expect(response.result.type).to eq "SCORM12"
246
- expect(response.result.filename).to end_with("golf_club_dispatch_testing-dispatch-id.zip")
266
+ expect(response.result.filename).to end_with("golf_club_dispatch_testing-dispatch-id-2.zip")
247
267
 
248
268
  zip_contents = Zip::File.open_buffer(StringIO.new(response.result.body)).each_entry.map(&:name)
249
269
  expect(zip_contents).to include("blank.html", "configuration.js", "dispatch.html", "goodbye.html") # sampling
@@ -92,7 +92,11 @@ module ScormEngineHelpers
92
92
  #
93
93
  def ensure_dispatch_exists(options = {})
94
94
  response = options[:client].get_dispatch(dispatch_id: options[:dispatch_id])
95
- options[:client].post_dispatch(options) if response&.result.nil?
95
+ if response&.result.nil?
96
+ options[:client].post_dispatch(options)
97
+ else
98
+ options[:client].put_dispatch(options)
99
+ end
96
100
  end
97
101
 
98
102
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorm_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.10
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Hallstrom
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-27 00:00:00.000000000 Z
11
+ date: 2018-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -295,7 +295,7 @@ files:
295
295
  - spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/results/is_an_enumerator_of_dispatch_models.yml
296
296
  - spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/results/sucessfully_creates_the_dispatch_attributes.yml
297
297
  - spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_post_dispatch/is_successful.yml
298
- - spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_post_dispatch/is_updates_if_same_dispatch_id.yml
298
+ - spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_post_dispatch/updates_if_same_dispatch_id.yml
299
299
  - spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch/is_successful.yml
300
300
  - spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch/results/sucessfully_creates_the_dispatch_attributes.yml
301
301
  - spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/fails_when_invalid.yml