domoscio_rails 0.4.4 → 0.4.6.2

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: '0081b12374fec380802cdc569ddf193600cb69ffdb8f30b131c60de9a6d62e31'
4
- data.tar.gz: 5e6cf77d9d451dbf4e7bc3f482a1f1d0a4d169735487cc1c9c02fe0a2943d7ed
3
+ metadata.gz: 89f4a573a069c4acbf2d5c7d3ae5d977ba13587fbcd7ce2def3f546d0db7acdd
4
+ data.tar.gz: d46161a1cddf1ff3fccc4282a32226c939dc50deaac62c1f73c917e77ee4b58d
5
5
  SHA512:
6
- metadata.gz: ae1e92b8fd9d428b3ba6115a7c2d2e04c2f6cb457fdc8e1ab0ac83c1aa06dd975752682a806470615a7ee513569885a2fc126076c7467fa54c93fa9f72f8a4fe
7
- data.tar.gz: 9936df32392eaa36359f82bbeebf506e77d7e6d98d4cdf5f66237b0b22eecbf81b52e1ed663cd0256d08dbc2b6ad1e0d2c73a88dbc76367870cd21fad3dc3b99
6
+ metadata.gz: 593431c7f5f4c4dd7710bf0a16e0203661304b74efd812ad482b021f25d7a4e1d95c2f9849afe95497cfef464bcc02772958029eb4c89d3f29e4ec7d208af752
7
+ data.tar.gz: '081da9e5e0bbc103795af2c7ae325ff32018b008d962fd082eed4342245fb5cf2615b31c685964bef64f5847a57780103aab4701821bc7bc3681e0e7769816d0'
@@ -0,0 +1,5 @@
1
+ module DomoscioRails
2
+ class Scorm < Resource
3
+ include DomoscioRails::HTTPCalls::Create
4
+ end
5
+ end
@@ -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
@@ -0,0 +1,8 @@
1
+ module DomoscioRails
2
+ class KnowledgeGraphScale < Resource
3
+ include DomoscioRails::HTTPCalls::Create
4
+ include DomoscioRails::HTTPCalls::Fetch
5
+ include DomoscioRails::HTTPCalls::Destroy
6
+ include DomoscioRails::HTTPCalls::Update
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module DomoscioRails
2
+ class Scale < Resource
3
+ include DomoscioRails::HTTPCalls::Create
4
+ include DomoscioRails::HTTPCalls::Fetch
5
+ include DomoscioRails::HTTPCalls::Destroy
6
+ include DomoscioRails::HTTPCalls::Update
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module DomoscioRails
2
+ class LearningProgramStudent < Resource
3
+ include DomoscioRails::HTTPCalls::Create
4
+ include DomoscioRails::HTTPCalls::Fetch
5
+ include DomoscioRails::HTTPCalls::Destroy
6
+ include DomoscioRails::HTTPCalls::Update
7
+ end
8
+ 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, on_self = 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
- unless on_self
13
- build_url << "/#{underscore(class_name)}s"
14
- build_url << "/#{util_name}" if util_name
15
- build_url << "/#{CGI.escape(id.to_s)}" if id
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')
@@ -0,0 +1,6 @@
1
+ module DomoscioRails
2
+ class Lxp < Resource
3
+ include DomoscioRails::HTTPCalls::Raw
4
+ include DomoscioRails::HTTPCalls::Util
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module DomoscioRails
2
- VERSION = '0.4.4'.freeze
2
+ VERSION = '0.4.6.2'.freeze
3
3
  end
@@ -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
- data = DomoscioRails::JSON.load(response.body.nil? ? '' : response.body)
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
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-03-28 00:00:00.000000000 Z
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