scorm_engine 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scorm_engine/api/endpoints.rb +12 -2
- data/lib/scorm_engine/api/endpoints/destinations.rb +225 -0
- data/lib/scorm_engine/api/endpoints/dispatches.rb +301 -0
- data/lib/scorm_engine/faraday/connection.rb +0 -1
- data/lib/scorm_engine/models.rb +3 -0
- data/lib/scorm_engine/models/destination.rb +27 -0
- data/lib/scorm_engine/models/dispatch.rb +51 -0
- data/lib/scorm_engine/models/dispatch_zip.rb +18 -0
- data/lib/scorm_engine/version.rb +1 -1
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_delete_destination/raises_ArgumentError_when_destination_id_is_missing.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_delete_destination/returns_success_even_when_id_is_invalid.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_delete_destination/works.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination/fails_when_id_is_invalid.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination/is_successful.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination/results/sucessfully_creates_the_destination_attributes.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination_dispatches_registration_count/fails_when_invalid.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination_dispatches_registration_count/works.yml +36 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/_more_option_pagination_/returns_all_the_destinations.yml +73 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/_more_option_pagination_/returns_the_more_key_in_the_raw_response.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/_since_option/fails_when_passed_an_invalid_value.yml +37 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/_since_option/works.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/is_successful.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/results/is_an_enumerator_of_Destination_models.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/results/sucessfully_creates_the_Destination_attributes.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination/is_successful.yml +61 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination/is_successful_even_if_the_destination_id_is_not_unique.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_enabled/fails_when_invalid.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_enabled/works_when_false.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_enabled/works_when_true.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_registration_instancing/fails_when_invalid.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_registration_instancing/works_when_false.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_registration_instancing/works_when_true.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_put_destination/is_successful.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_put_destination/results/sucessfully_creates_the_destination_attributes.yml +67 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_delete_dispatch/returns_success_even_when_id_is_invalid.yml +30 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_delete_dispatch/works.yml +30 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch/fails_when_id_is_invalid.yml +36 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch/is_successful.yml +36 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch/results/sucessfully_creates_the_dispatch_attributes.yml +36 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_enabled/is_false_when_disabled.yml +63 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_enabled/is_true_when_enabled.yml +63 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_id.yml +36 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_type.yml +34 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works.yml +37 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_AICC.yml +37 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM12.yml +37 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM20043RDEDITION.yml +35 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_more_option_pagination_/returns_all_the_dispatches.yml +69 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_more_option_pagination_/returns_the_more_key_in_the_raw_response.yml +36 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_since_option/fails_when_passed_an_invalid_value.yml +35 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_since_option/works.yml +36 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/is_successful.yml +36 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/results/is_an_enumerator_of_dispatch_models.yml +36 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/results/sucessfully_creates_the_dispatch_attributes.yml +69 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_post_dispatch/is_successful.yml +59 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch/is_successful.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch/results/sucessfully_creates_the_dispatch_attributes.yml +65 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/fails_when_invalid.yml +38 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/works_when_false.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/works_when_true.yml +32 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/is_successful_even_when_given_a_UTF8/slashed_username.yml +97 -0
- data/spec/scorm_engine/api/endpoints/destinations_spec.rb +215 -0
- data/spec/scorm_engine/api/endpoints/dispatches_spec.rb +286 -0
- data/spec/scorm_engine/api/endpoints/registrations_spec.rb +12 -0
- data/spec/scorm_engine/models/destination_spec.rb +21 -0
- data/spec/scorm_engine/models/dispatch_spec.rb +85 -0
- data/spec/scorm_engine/models/dispatch_zip_spec.rb +18 -0
- data/spec/support/scorm_engine.rb +21 -0
- metadata +78 -2
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ScormEngine Ruby Gem 0.3.0
|
12
|
+
Authorization:
|
13
|
+
- Basic <BASIC_AUTH>
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: ''
|
18
|
+
headers:
|
19
|
+
content-type:
|
20
|
+
- application/json
|
21
|
+
date:
|
22
|
+
- Mon, 20 Aug 2018 23:05:21 GMT
|
23
|
+
server:
|
24
|
+
- nginx
|
25
|
+
vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
content-length:
|
28
|
+
- '373'
|
29
|
+
connection:
|
30
|
+
- Close
|
31
|
+
body:
|
32
|
+
encoding: ASCII-8BIT
|
33
|
+
string: '{"dispatches":[{"id":"paginated-dispatch-0","data":{"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"}},{"id":"paginated-dispatch-1","data":{"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"}},{"id":"paginated-dispatch-2","data":{"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"}},{"id":"paginated-dispatch-3","data":{"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"}},{"id":"paginated-dispatch-4","data":{"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"}},{"id":"paginated-dispatch-5","data":{"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"}},{"id":"paginated-dispatch-6","data":{"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"}},{"id":"paginated-dispatch-7","data":{"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"}},{"id":"paginated-dispatch-8","data":{"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"}},{"id":"paginated-dispatch-9","data":{"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"}}],"more":"https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/scormenginegemtesting-default/dispatches?configuration=ScormEngineGemTesting-default&more=AAABZVly6mAAAAAL"}'
|
34
|
+
http_version:
|
35
|
+
recorded_at: Mon, 20 Aug 2018 23:05:21 GMT
|
36
|
+
- request:
|
37
|
+
method: get
|
38
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/scormenginegemtesting-default/dispatches?configuration=ScormEngineGemTesting-default&more=AAABZVly6mAAAAAL
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ''
|
42
|
+
headers:
|
43
|
+
User-Agent:
|
44
|
+
- ScormEngine Ruby Gem 0.3.0
|
45
|
+
Authorization:
|
46
|
+
- Basic <BASIC_AUTH>
|
47
|
+
response:
|
48
|
+
status:
|
49
|
+
code: 200
|
50
|
+
message: ''
|
51
|
+
headers:
|
52
|
+
content-type:
|
53
|
+
- application/json
|
54
|
+
date:
|
55
|
+
- Mon, 20 Aug 2018 23:05:21 GMT
|
56
|
+
server:
|
57
|
+
- nginx
|
58
|
+
vary:
|
59
|
+
- Accept-Encoding
|
60
|
+
content-length:
|
61
|
+
- '245'
|
62
|
+
connection:
|
63
|
+
- Close
|
64
|
+
body:
|
65
|
+
encoding: ASCII-8BIT
|
66
|
+
string: '{"dispatches":[{"id":"paginated-dispatch-10","data":{"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"}},{"id":"dispatch-to-be-deleted","data":{"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"}},{"id":"testing-dispatch-id","data":{"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"}}]}'
|
67
|
+
http_version:
|
68
|
+
recorded_at: Mon, 20 Aug 2018 23:05:21 GMT
|
69
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ScormEngine Ruby Gem 0.3.0
|
12
|
+
Authorization:
|
13
|
+
- Basic <BASIC_AUTH>
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 204
|
17
|
+
message: ''
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 20 Aug 2018 23:04:57 GMT
|
21
|
+
server:
|
22
|
+
- nginx
|
23
|
+
connection:
|
24
|
+
- Close
|
25
|
+
body:
|
26
|
+
encoding: UTF-8
|
27
|
+
string: ''
|
28
|
+
http_version:
|
29
|
+
recorded_at: Mon, 20 Aug 2018 23:04:57 GMT
|
30
|
+
- request:
|
31
|
+
method: post
|
32
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches
|
33
|
+
body:
|
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}}]}'
|
36
|
+
headers:
|
37
|
+
User-Agent:
|
38
|
+
- ScormEngine Ruby Gem 0.3.0
|
39
|
+
Authorization:
|
40
|
+
- Basic <BASIC_AUTH>
|
41
|
+
Content-Type:
|
42
|
+
- application/json
|
43
|
+
response:
|
44
|
+
status:
|
45
|
+
code: 204
|
46
|
+
message: ''
|
47
|
+
headers:
|
48
|
+
date:
|
49
|
+
- Mon, 20 Aug 2018 23:04:57 GMT
|
50
|
+
server:
|
51
|
+
- nginx
|
52
|
+
connection:
|
53
|
+
- Close
|
54
|
+
body:
|
55
|
+
encoding: UTF-8
|
56
|
+
string: ''
|
57
|
+
http_version:
|
58
|
+
recorded_at: Mon, 20 Aug 2018 23:04:57 GMT
|
59
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2018-01-01","externalConfig":null}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ScormEngine Ruby Gem 0.3.0
|
12
|
+
Authorization:
|
13
|
+
- Basic <BASIC_AUTH>
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 204
|
19
|
+
message: ''
|
20
|
+
headers:
|
21
|
+
date:
|
22
|
+
- Mon, 20 Aug 2018 23:04:42 GMT
|
23
|
+
server:
|
24
|
+
- nginx
|
25
|
+
connection:
|
26
|
+
- Close
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: ''
|
30
|
+
http_version:
|
31
|
+
recorded_at: Mon, 20 Aug 2018 23:04:42 GMT
|
32
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"destinationId":"testing-golf-club","courseId":"testing-golf-explained","allowNewRegistrations":false,"instanced":false,"registrationCap":123,"expirationDate":"2018-01-01","externalConfig":null}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ScormEngine Ruby Gem 0.3.0
|
12
|
+
Authorization:
|
13
|
+
- Basic <BASIC_AUTH>
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 204
|
19
|
+
message: ''
|
20
|
+
headers:
|
21
|
+
date:
|
22
|
+
- Mon, 20 Aug 2018 23:04:44 GMT
|
23
|
+
server:
|
24
|
+
- nginx
|
25
|
+
connection:
|
26
|
+
- Close
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: ''
|
30
|
+
http_version:
|
31
|
+
recorded_at: Mon, 20 Aug 2018 23:04:44 GMT
|
32
|
+
- request:
|
33
|
+
method: get
|
34
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: ''
|
38
|
+
headers:
|
39
|
+
User-Agent:
|
40
|
+
- ScormEngine Ruby Gem 0.3.0
|
41
|
+
Authorization:
|
42
|
+
- Basic <BASIC_AUTH>
|
43
|
+
response:
|
44
|
+
status:
|
45
|
+
code: 200
|
46
|
+
message: ''
|
47
|
+
headers:
|
48
|
+
content-type:
|
49
|
+
- application/json
|
50
|
+
date:
|
51
|
+
- Mon, 20 Aug 2018 23:04:44 GMT
|
52
|
+
server:
|
53
|
+
- nginx
|
54
|
+
vary:
|
55
|
+
- Accept-Encoding
|
56
|
+
content-length:
|
57
|
+
- '199'
|
58
|
+
connection:
|
59
|
+
- Close
|
60
|
+
body:
|
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"}'
|
63
|
+
http_version:
|
64
|
+
recorded_at: Mon, 20 Aug 2018 23:04:44 GMT
|
65
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id/enabled
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: oops
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ScormEngine Ruby Gem 0.3.0
|
12
|
+
Authorization:
|
13
|
+
- Basic <BASIC_AUTH>
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 400
|
19
|
+
message: ''
|
20
|
+
headers:
|
21
|
+
content-type:
|
22
|
+
- text/plain
|
23
|
+
date:
|
24
|
+
- Mon, 20 Aug 2018 23:04:49 GMT
|
25
|
+
server:
|
26
|
+
- nginx
|
27
|
+
content-length:
|
28
|
+
- '198'
|
29
|
+
connection:
|
30
|
+
- Close
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: |-
|
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]
|
36
|
+
http_version:
|
37
|
+
recorded_at: Mon, 20 Aug 2018 23:04:49 GMT
|
38
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id/enabled
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: 'false'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ScormEngine Ruby Gem 0.3.0
|
12
|
+
Authorization:
|
13
|
+
- Basic <BASIC_AUTH>
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 204
|
19
|
+
message: ''
|
20
|
+
headers:
|
21
|
+
date:
|
22
|
+
- Mon, 20 Aug 2018 23:04:47 GMT
|
23
|
+
server:
|
24
|
+
- nginx
|
25
|
+
connection:
|
26
|
+
- Close
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: ''
|
30
|
+
http_version:
|
31
|
+
recorded_at: Mon, 20 Aug 2018 23:04:47 GMT
|
32
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/dispatches/testing-dispatch-id/enabled
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: 'true'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- ScormEngine Ruby Gem 0.3.0
|
12
|
+
Authorization:
|
13
|
+
- Basic <BASIC_AUTH>
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 204
|
19
|
+
message: ''
|
20
|
+
headers:
|
21
|
+
date:
|
22
|
+
- Mon, 20 Aug 2018 23:04:46 GMT
|
23
|
+
server:
|
24
|
+
- nginx
|
25
|
+
connection:
|
26
|
+
- Close
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: ''
|
30
|
+
http_version:
|
31
|
+
recorded_at: Mon, 20 Aug 2018 23:04:46 GMT
|
32
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,97 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/registrations/testing-golf-explained-registration-1
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
User-Agent:
|
13
|
+
- ScormEngine Ruby Gem 0.3.0
|
14
|
+
Authorization:
|
15
|
+
- Basic <BASIC_AUTH>
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 204
|
19
|
+
message: ''
|
20
|
+
headers:
|
21
|
+
date:
|
22
|
+
- Fri, 17 Aug 2018 21:40:15 GMT
|
23
|
+
server:
|
24
|
+
- nginx
|
25
|
+
connection:
|
26
|
+
- Close
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: ''
|
30
|
+
http_version:
|
31
|
+
recorded_at: Fri, 17 Aug 2018 21:40:15 GMT
|
32
|
+
- request:
|
33
|
+
method: post
|
34
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/registrations
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"courseId":"testing-golf-explained","registrationId":"testing-golf-explained-registration-1","learner":{"id":"testing-golf-explained-learner-1","firstName":"Släshy","lastName":"Mc/SláshFacę"}}'
|
38
|
+
headers:
|
39
|
+
Content-Type:
|
40
|
+
- application/json
|
41
|
+
User-Agent:
|
42
|
+
- ScormEngine Ruby Gem 0.3.0
|
43
|
+
Authorization:
|
44
|
+
- Basic <BASIC_AUTH>
|
45
|
+
response:
|
46
|
+
status:
|
47
|
+
code: 204
|
48
|
+
message: ''
|
49
|
+
headers:
|
50
|
+
date:
|
51
|
+
- Fri, 17 Aug 2018 21:40:15 GMT
|
52
|
+
server:
|
53
|
+
- nginx
|
54
|
+
connection:
|
55
|
+
- Close
|
56
|
+
body:
|
57
|
+
encoding: UTF-8
|
58
|
+
string: ''
|
59
|
+
http_version:
|
60
|
+
recorded_at: Fri, 17 Aug 2018 21:40:15 GMT
|
61
|
+
- request:
|
62
|
+
method: get
|
63
|
+
uri: https://<SCORM_ENGINE_HOST>/ScormEngineInterface/api/v1/ScormEngineGemTesting-default/registrations?learnerId=testing-golf-explained-learner-1
|
64
|
+
body:
|
65
|
+
encoding: US-ASCII
|
66
|
+
string: ''
|
67
|
+
headers:
|
68
|
+
Content-Type:
|
69
|
+
- application/json
|
70
|
+
User-Agent:
|
71
|
+
- ScormEngine Ruby Gem 0.3.0
|
72
|
+
Authorization:
|
73
|
+
- Basic <BASIC_AUTH>
|
74
|
+
response:
|
75
|
+
status:
|
76
|
+
code: 200
|
77
|
+
message: ''
|
78
|
+
headers:
|
79
|
+
content-type:
|
80
|
+
- application/json
|
81
|
+
date:
|
82
|
+
- Fri, 17 Aug 2018 21:40:16 GMT
|
83
|
+
server:
|
84
|
+
- nginx
|
85
|
+
vary:
|
86
|
+
- Accept-Encoding
|
87
|
+
content-length:
|
88
|
+
- '369'
|
89
|
+
connection:
|
90
|
+
- Close
|
91
|
+
body:
|
92
|
+
encoding: ASCII-8BIT
|
93
|
+
string: !binary |-
|
94
|
+
eyJyZWdpc3RyYXRpb25zIjpbeyJpZCI6InRlc3RpbmctZ29sZi1leHBsYWluZWQtcmVnaXN0cmF0aW9uLTEiLCJpbnN0YW5jZSI6MCwidXBkYXRlZCI6IjIwMTgtMDgtMTdUMjE6NDA6MTYuMDAwWiIsInJlZ2lzdHJhdGlvbkNvbXBsZXRpb24iOiJVTktOT1dOIiwicmVnaXN0cmF0aW9uU3VjY2VzcyI6IlVua25vd24iLCJ0b3RhbFNlY29uZHNUcmFja2VkIjowLjAsImxhc3RBY2Nlc3NEYXRlIjoiMjAxOC0wOC0xN1QyMTo0MDoxNi4wMDBaIiwiY3JlYXRlZERhdGUiOiIyMDE4LTA4LTE3VDIxOjQwOjE2LjAwMFoiLCJjb3Vyc2UiOnsiaWQiOiJ0ZXN0aW5nLWdvbGYtZXhwbGFpbmVkIiwidmVyc2lvbiI6MCwidGl0bGUiOiJHb2xmIEV4cGxhaW5lZCAtIFJ1bi10aW1lIEJhc2ljIENhbGxzIiwiY291cnNlTGVhcm5pbmdTdGFuZGFyZCI6IlNDT1JNXzIwMDRfM1JEX0VESVRJT04iLCJyZWdpc3RyYXRpb25Db3VudCI6MSwidXBkYXRlZCI6IjIwMTgtMDgtMTVUMjM6MTk6NDkuMDAwWiJ9LCJsZWFybmVyIjp7ImlkIjoidGVzdGluZy1nb2xmLWV4cGxhaW5lZC1sZWFybmVyLTEiLCJmaXJzdE5hbWUiOiJTbMOkc2h5IiwibGFzdE5hbWUiOiJNYy9TbMOhc2hGYWPEmSJ9LCJnbG9iYWxPYmplY3RpdmVzIjpbXSwic2hhcmVkRGF0YSI6W119XX0=
|
95
|
+
http_version:
|
96
|
+
recorded_at: Fri, 17 Aug 2018 21:40:16 GMT
|
97
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,215 @@
|
|
1
|
+
RSpec.describe ScormEngine::Api::Endpoints::Destinations do
|
2
|
+
let(:subject) { scorm_engine_client }
|
3
|
+
|
4
|
+
let(:destination_options) { {
|
5
|
+
destination_id: "testing-golf-club",
|
6
|
+
name: "Golf Club",
|
7
|
+
} }
|
8
|
+
|
9
|
+
before do
|
10
|
+
against_real_scorm_engine do
|
11
|
+
ensure_destination_exists(destination_options.merge(client: subject))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#get_destinations" do
|
16
|
+
let(:destinations) { subject.get_destinations }
|
17
|
+
|
18
|
+
it "is successful" do
|
19
|
+
expect(destinations.success?).to eq true
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "results" do
|
23
|
+
it "is an enumerator of Destination models" do
|
24
|
+
expect(destinations.results).to be_a Enumerator
|
25
|
+
expect(destinations.results.first).to be_a ScormEngine::Models::Destination
|
26
|
+
end
|
27
|
+
|
28
|
+
it "sucessfully creates the Destination attributes" do
|
29
|
+
aggregate_failures do
|
30
|
+
destination = destinations.results.detect { |c| c.id == destination_options[:destination_id] }
|
31
|
+
expect(destination.name).to eq destination_options[:name]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe ":since option" do
|
37
|
+
it "works" do
|
38
|
+
destinations = subject.get_destinations(since: Time.parse("2000-01-1 00:00:00 UTC"))
|
39
|
+
aggregate_failures do
|
40
|
+
expect(destinations.success?).to eq true
|
41
|
+
expect(destinations.results.to_a.size).to be >= 0
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "fails when passed an invalid value" do
|
46
|
+
destinations = subject.get_destinations(since: "invalid")
|
47
|
+
aggregate_failures do
|
48
|
+
expect(destinations.success?).to eq false
|
49
|
+
expect(destinations.status).to eq 400
|
50
|
+
expect(destinations.results.to_a).to eq []
|
51
|
+
expect(destinations.message).to match(/'invalid' is either not a timestamp or seems to be not formatted according to ISO 8601/)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe ":more option (pagination)" do
|
57
|
+
before do
|
58
|
+
against_real_scorm_engine do
|
59
|
+
11.times do |idx|
|
60
|
+
ensure_destination_exists(client: subject, destination_id: "paginated-destination-#{idx}")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it "returns the :more key in the raw response" do
|
66
|
+
expect(subject.get_destinations.raw_response.body["more"]).to match(%r{https?://.*&more=.+})
|
67
|
+
end
|
68
|
+
|
69
|
+
it "returns all the destinations" do
|
70
|
+
expect(subject.get_destinations.results.to_a.size).to be >= 11 # there may be other ones beyond those we just added
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "#post_destination" do
|
76
|
+
it "is successful" do
|
77
|
+
subject.delete_destination(destination_options)
|
78
|
+
response = subject.post_destination(destination_options)
|
79
|
+
aggregate_failures do
|
80
|
+
expect(response.success?).to eq true
|
81
|
+
expect(response.status).to eq 204
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it "is successful even if the destination_id is not unique" do
|
86
|
+
response = subject.post_destination(destination_options)
|
87
|
+
aggregate_failures do
|
88
|
+
expect(response.success?).to eq true
|
89
|
+
expect(response.status).to eq 204
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe "#get_destination" do
|
95
|
+
let(:response) { subject.get_destination(destination_id: destination_options[:destination_id]) }
|
96
|
+
|
97
|
+
it "is successful" do
|
98
|
+
expect(response.success?).to eq true
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "results" do
|
102
|
+
it "sucessfully creates the destination attributes" do
|
103
|
+
aggregate_failures do
|
104
|
+
destination = response.result
|
105
|
+
expect(destination.name).to eq destination_options[:name]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
it "fails when id is invalid" do
|
111
|
+
response = subject.get_destination(destination_id: "nonexistent-destination")
|
112
|
+
expect(response.success?).to eq false
|
113
|
+
expect(response.status).to eq 404
|
114
|
+
expect(response.message).to match(/No destinations found with ID: nonexistent-destination/)
|
115
|
+
expect(response.result).to eq nil
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "#put_destination" do
|
120
|
+
let(:response) { subject.put_destination(destination_options.merge(name: "Golf & Country Club")) }
|
121
|
+
|
122
|
+
it "is successful" do
|
123
|
+
expect(response.success?).to eq true
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "results" do
|
127
|
+
it "sucessfully creates the destination attributes" do
|
128
|
+
response # trigger the put
|
129
|
+
response = subject.get_destination(destination_id: destination_options[:destination_id])
|
130
|
+
destination = response.result
|
131
|
+
expect(destination.name).to eq "Golf & Country Club"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe "#delete_destination" do
|
137
|
+
before do
|
138
|
+
against_real_scorm_engine do
|
139
|
+
ensure_destination_exists(client: subject, destination_id: "destination-to-be-deleted")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
it "works" do
|
144
|
+
response = subject.delete_destination(destination_id: "destination-to-be-deleted")
|
145
|
+
expect(response.success?).to eq true
|
146
|
+
expect(response.status).to eq 204
|
147
|
+
end
|
148
|
+
|
149
|
+
it "raises ArgumentError when :destination_id is missing" do
|
150
|
+
expect { subject.delete_destination }.to raise_error(ArgumentError, /destination_id missing/)
|
151
|
+
end
|
152
|
+
|
153
|
+
it "returns success even when id is invalid" do
|
154
|
+
response = subject.delete_destination(destination_id: "nonexistent-destination")
|
155
|
+
expect(response.success?).to eq true
|
156
|
+
expect(response.status).to eq 204
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
describe "#post_destination_dispatches_enabled" do
|
161
|
+
it "works when true" do
|
162
|
+
response = subject.post_destination_dispatches_enabled(destination_id: destination_options[:destination_id], enabled: true)
|
163
|
+
expect(response.success?).to eq true
|
164
|
+
expect(response.status).to eq 204
|
165
|
+
end
|
166
|
+
|
167
|
+
it "works when false" do
|
168
|
+
response = subject.post_destination_dispatches_enabled(destination_id: destination_options[:destination_id], enabled: false)
|
169
|
+
expect(response.success?).to eq true
|
170
|
+
expect(response.status).to eq 204
|
171
|
+
end
|
172
|
+
|
173
|
+
it "fails when invalid" do
|
174
|
+
response = subject.post_destination_dispatches_enabled(destination_id: destination_options[:destination_id], enabled: "oops")
|
175
|
+
expect(response.success?).to eq false
|
176
|
+
expect(response.status).to eq 400
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe "#post_destination_dispatches_registration_instancing" do
|
181
|
+
it "works when true" do
|
182
|
+
response = subject.post_destination_dispatches_registration_instancing(destination_id: destination_options[:destination_id], enabled: true)
|
183
|
+
expect(response.success?).to eq true
|
184
|
+
expect(response.status).to eq 204
|
185
|
+
end
|
186
|
+
|
187
|
+
it "works when false" do
|
188
|
+
response = subject.post_destination_dispatches_registration_instancing(destination_id: destination_options[:destination_id], enabled: false)
|
189
|
+
expect(response.success?).to eq true
|
190
|
+
expect(response.status).to eq 204
|
191
|
+
end
|
192
|
+
|
193
|
+
it "fails when invalid" do
|
194
|
+
response = subject.post_destination_dispatches_registration_instancing(destination_id: destination_options[:destination_id], enabled: "oops")
|
195
|
+
expect(response.success?).to eq false
|
196
|
+
expect(response.status).to eq 400
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe "#get_destination_dispatches_registration_count" do
|
201
|
+
it "works" do
|
202
|
+
response = subject.get_destination_dispatches_registration_count(destination_id: destination_options[:destination_id])
|
203
|
+
expect(response.success?).to eq true
|
204
|
+
expect(response.status).to eq 200
|
205
|
+
expect(response.result).to be >= 0
|
206
|
+
end
|
207
|
+
|
208
|
+
it "fails when invalid" do
|
209
|
+
response = subject.get_destination_dispatches_registration_count(destination_id: "nonexistent-destination")
|
210
|
+
expect(response.success?).to eq false
|
211
|
+
expect(response.status).to eq 404
|
212
|
+
expect(response.message).to match(/No destinations found with ID: nonexistent-destination/)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|