ims-lti 2.0.0.beta.40 → 2.0.0.beta.41
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe29bdb1f765a0a3bf91d6268d275f3f84a5d402
|
4
|
+
data.tar.gz: 8051d34738fcec8d0a10902492fa8f0621ab0e82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb0eaa36739ed561812ebb7dd2d715a39ee3bb4e19d6e3bf886ee572ab22502d50898e06784b34580766678e9d6da9c9431eecf522a6f94b8fb405eb2c367cd9
|
7
|
+
data.tar.gz: 8848464d689ddf0267561efc1f6c31c4bb6107018833697dc27d72b0b76cdb4c7e4f164286b165f5916d70e7db0dc516288282e45643ab2166907f7e6177c55f
|
@@ -19,12 +19,12 @@ module IMS::LTI::Models::ContentItems
|
|
19
19
|
def self.from_json(json)
|
20
20
|
data = json.is_a?(String) ? JSON.parse(json) : json
|
21
21
|
case data['@type']
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
when 'FileItem'
|
23
|
+
FileItem.new.from_json(data)
|
24
|
+
when 'LtiLinkItem', 'LtiLink'
|
25
|
+
LtiLinkItem.new.from_json(data)
|
26
|
+
else
|
27
|
+
ContentItem.new.from_json(data)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -4,8 +4,9 @@ module IMS::LTI::Models
|
|
4
4
|
LTI_VERSION_2P1 = 'LTI-2p1'.freeze
|
5
5
|
|
6
6
|
def initialize(attributes = {})
|
7
|
-
self.attributes = attributes
|
8
7
|
@ext_attributes = {}
|
8
|
+
@unknown_attributes = {}
|
9
|
+
self.attributes = attributes
|
9
10
|
end
|
10
11
|
|
11
12
|
def self.add_attributes(attribute, *attrs)
|
@@ -61,6 +62,7 @@ module IMS::LTI::Models
|
|
61
62
|
@ext_attributes[k.to_sym] = v
|
62
63
|
else
|
63
64
|
warn("Unknown attribute '#{k}'")
|
65
|
+
@unknown_attributes[k.to_sym] = v
|
64
66
|
end
|
65
67
|
end
|
66
68
|
end
|
@@ -76,6 +78,7 @@ module IMS::LTI::Models
|
|
76
78
|
json_hash[json_key(attr)] = val.as_json
|
77
79
|
end
|
78
80
|
end
|
81
|
+
json_hash = @unknown_attributes.merge(json_hash)
|
79
82
|
json_hash = @ext_attributes.merge(json_hash)
|
80
83
|
json_hash.merge! to_json_conversions
|
81
84
|
json_hash.merge! to_json_keys
|
@@ -97,8 +100,11 @@ module IMS::LTI::Models
|
|
97
100
|
end
|
98
101
|
|
99
102
|
def method_missing(meth, *args, &block)
|
100
|
-
|
101
|
-
|
103
|
+
proc = ->(attr, hash) {meth =~ /=$/ ? hash[attr] = args[0] : hash[attr] }
|
104
|
+
if (match = /^ext_([^=$]*)/.match(meth))
|
105
|
+
proc.call(match.to_s.to_sym, @ext_attributes)
|
106
|
+
elsif (match = /([^=$]*)/.match(meth))
|
107
|
+
proc.call(match.to_s.to_sym, @unknown_attributes)
|
102
108
|
else
|
103
109
|
super
|
104
110
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ims-lti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.beta.
|
4
|
+
version: 2.0.0.beta.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_oauth
|