domoscio_rails 0.4.4 → 0.4.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/domoscio_rails/data/scorm.rb +5 -0
- data/lib/domoscio_rails/http_calls.rb +17 -0
- data/lib/domoscio_rails/knowledge/knowledge_graph_scale.rb +8 -0
- data/lib/domoscio_rails/knowledge/scale.rb +8 -0
- data/lib/domoscio_rails/objective/learning_program_student.rb +8 -0
- data/lib/domoscio_rails/resource.rb +21 -6
- data/lib/domoscio_rails/utils/lxp.rb +6 -0
- data/lib/domoscio_rails/version.rb +1 -1
- data/lib/domoscio_rails.rb +14 -2
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89f4a573a069c4acbf2d5c7d3ae5d977ba13587fbcd7ce2def3f546d0db7acdd
|
4
|
+
data.tar.gz: d46161a1cddf1ff3fccc4282a32226c939dc50deaac62c1f73c917e77ee4b58d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 593431c7f5f4c4dd7710bf0a16e0203661304b74efd812ad482b021f25d7a4e1d95c2f9849afe95497cfef464bcc02772958029eb4c89d3f29e4ec7d208af752
|
7
|
+
data.tar.gz: '081da9e5e0bbc103795af2c7ae325ff32018b008d962fd082eed4342245fb5cf2615b31c685964bef64f5847a57780103aab4701821bc7bc3681e0e7769816d0'
|
@@ -76,5 +76,22 @@ module DomoscioRails
|
|
76
76
|
base.extend(ClassMethods)
|
77
77
|
end
|
78
78
|
end
|
79
|
+
|
80
|
+
# Raw module allow calls not to be scoped by instance
|
81
|
+
module Raw
|
82
|
+
module ClassMethods
|
83
|
+
def raw_util(util_name = nil, params = {})
|
84
|
+
DomoscioRails.request(:get, raw_url(util_name), raw_params(params))
|
85
|
+
end
|
86
|
+
|
87
|
+
def raw_util_post(util_name = nil, params = {})
|
88
|
+
DomoscioRails.request(:post, raw_url(util_name), raw_params(params))
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.included(base)
|
93
|
+
base.extend(ClassMethods)
|
94
|
+
end
|
95
|
+
end
|
79
96
|
end
|
80
97
|
end
|
@@ -5,18 +5,33 @@ module DomoscioRails
|
|
5
5
|
name.split('::')[-1]
|
6
6
|
end
|
7
7
|
|
8
|
-
def url(id = nil, util_name = nil
|
8
|
+
def url(id = nil, util_name = nil)
|
9
9
|
raise NotImplementedError, 'Resource is an abstract class. Do not use it directly.' if self == Resource
|
10
10
|
|
11
11
|
build_url = "/v#{DomoscioRails.configuration.version}/instances/#{DomoscioRails.configuration.client_id}"
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
12
|
+
build_url << "/#{underscore(class_name)}s"
|
13
|
+
build_url << "/#{util_name}" if util_name
|
14
|
+
build_url << "/#{CGI.escape(id.to_s)}" if id
|
15
|
+
|
17
16
|
build_url
|
18
17
|
end
|
19
18
|
|
19
|
+
def raw_url(util_name)
|
20
|
+
raise NotImplementedError, 'Resource is an abstract class. Do not use it directly.' if self == Resource
|
21
|
+
|
22
|
+
build_url = "/v#{DomoscioRails.configuration.version}"
|
23
|
+
build_url << "/#{underscore(class_name)}s"
|
24
|
+
build_url << "/#{util_name}" if util_name
|
25
|
+
|
26
|
+
build_url
|
27
|
+
end
|
28
|
+
|
29
|
+
def raw_params(params = {})
|
30
|
+
params.merge({
|
31
|
+
instance_id: DomoscioRails.configuration.client_id
|
32
|
+
})
|
33
|
+
end
|
34
|
+
|
20
35
|
def underscore(string)
|
21
36
|
string.gsub(/::/, '/')
|
22
37
|
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
data/lib/domoscio_rails.rb
CHANGED
@@ -14,13 +14,17 @@ require 'domoscio_rails/data/event'
|
|
14
14
|
require 'domoscio_rails/data/instance'
|
15
15
|
require 'domoscio_rails/data/recommendation'
|
16
16
|
require 'domoscio_rails/data/learning_session'
|
17
|
+
require 'domoscio_rails/data/scorm'
|
17
18
|
require 'domoscio_rails/data/student'
|
18
19
|
require 'domoscio_rails/data/student_group'
|
19
20
|
require 'domoscio_rails/knowledge/knowledge_edge'
|
20
21
|
require 'domoscio_rails/knowledge/knowledge_graph'
|
22
|
+
require 'domoscio_rails/knowledge/scale'
|
23
|
+
require 'domoscio_rails/knowledge/knowledge_graph_scale'
|
21
24
|
require 'domoscio_rails/knowledge/knowledge_node_content'
|
22
25
|
require 'domoscio_rails/knowledge/knowledge_node_student'
|
23
26
|
require 'domoscio_rails/knowledge/knowledge_node'
|
27
|
+
require 'domoscio_rails/objective/learning_program_student'
|
24
28
|
require 'domoscio_rails/objective/learning_program'
|
25
29
|
require 'domoscio_rails/objective/objective_knowledge_node_student'
|
26
30
|
require 'domoscio_rails/objective/objective_knowledge_node'
|
@@ -35,6 +39,7 @@ require 'domoscio_rails/utils/gameplay_util'
|
|
35
39
|
require 'domoscio_rails/utils/recommendation_util'
|
36
40
|
require 'domoscio_rails/utils/review_util'
|
37
41
|
require 'domoscio_rails/utils/stats_util'
|
42
|
+
require 'domoscio_rails/utils/lxp'
|
38
43
|
|
39
44
|
module DomoscioRails
|
40
45
|
# Configurable attributes and default values
|
@@ -73,7 +78,8 @@ module DomoscioRails
|
|
73
78
|
# Raises DomoscioRails::ResponseError on Adaptive Error Status
|
74
79
|
# Raises DomoscioRails::ProcessingError on Internal Error
|
75
80
|
#
|
76
|
-
def self.request(method, url, params={})
|
81
|
+
def self.request(method, url, params = {})
|
82
|
+
params ||= {}
|
77
83
|
store_tokens, headers = request_headers
|
78
84
|
params.merge!({ 'per_page': 1000 }) unless params[:per_page]
|
79
85
|
uri = api_uri(url)
|
@@ -82,7 +88,13 @@ module DomoscioRails
|
|
82
88
|
|
83
89
|
begin
|
84
90
|
raise_http_failure(uri, response, params)
|
85
|
-
|
91
|
+
|
92
|
+
if response['Content-Type'] == 'application/zip'
|
93
|
+
data = response
|
94
|
+
else
|
95
|
+
data = DomoscioRails::JSON.load(response.body.nil? ? '' : response.body)
|
96
|
+
end
|
97
|
+
|
86
98
|
if store_tokens
|
87
99
|
DomoscioRails::AuthorizationToken::Manager.storage.store({
|
88
100
|
access_token: response['Accesstoken'],
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domoscio_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoit Praly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/domoscio_rails/data/instance.rb
|
57
57
|
- lib/domoscio_rails/data/learning_session.rb
|
58
58
|
- lib/domoscio_rails/data/recommendation.rb
|
59
|
+
- lib/domoscio_rails/data/scorm.rb
|
59
60
|
- lib/domoscio_rails/data/student.rb
|
60
61
|
- lib/domoscio_rails/data/student_group.rb
|
61
62
|
- lib/domoscio_rails/errors.rb
|
@@ -63,10 +64,13 @@ files:
|
|
63
64
|
- lib/domoscio_rails/json.rb
|
64
65
|
- lib/domoscio_rails/knowledge/knowledge_edge.rb
|
65
66
|
- lib/domoscio_rails/knowledge/knowledge_graph.rb
|
67
|
+
- lib/domoscio_rails/knowledge/knowledge_graph_scale.rb
|
66
68
|
- lib/domoscio_rails/knowledge/knowledge_node.rb
|
67
69
|
- lib/domoscio_rails/knowledge/knowledge_node_content.rb
|
68
70
|
- lib/domoscio_rails/knowledge/knowledge_node_student.rb
|
71
|
+
- lib/domoscio_rails/knowledge/scale.rb
|
69
72
|
- lib/domoscio_rails/objective/learning_program.rb
|
73
|
+
- lib/domoscio_rails/objective/learning_program_student.rb
|
70
74
|
- lib/domoscio_rails/objective/objective.rb
|
71
75
|
- lib/domoscio_rails/objective/objective_knowledge_node.rb
|
72
76
|
- lib/domoscio_rails/objective/objective_knowledge_node_student.rb
|
@@ -78,6 +82,7 @@ files:
|
|
78
82
|
- lib/domoscio_rails/tag/tag_set.rb
|
79
83
|
- lib/domoscio_rails/tag/tagging.rb
|
80
84
|
- lib/domoscio_rails/utils/gameplay_util.rb
|
85
|
+
- lib/domoscio_rails/utils/lxp.rb
|
81
86
|
- lib/domoscio_rails/utils/recommendation_util.rb
|
82
87
|
- lib/domoscio_rails/utils/review_util.rb
|
83
88
|
- lib/domoscio_rails/utils/stats_util.rb
|