ims-lti 2.0.0.beta.40 → 2.0.0.beta.41

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
  SHA1:
3
- metadata.gz: 2f74fbddac9cb15785f401b5de2614ccb054b62d
4
- data.tar.gz: 73d89e8edfab8bc42a6789d3293f6a167ce5469e
3
+ metadata.gz: fe29bdb1f765a0a3bf91d6268d275f3f84a5d402
4
+ data.tar.gz: 8051d34738fcec8d0a10902492fa8f0621ab0e82
5
5
  SHA512:
6
- metadata.gz: 6f9a9f3dcd4bd519e571d61d60049eff8ab18f79b49278062470523f348f83fc6bd44f48c27624a6b6a244f8678edaf8ff798d0c041302faaf90845db703310f
7
- data.tar.gz: 1b6d0c9dbf0ca89cb95f949c1c21b64516adb56d2283f95747a89eb1c43af859d04d27898ce4eb82c44603dc122fc75fe11f2168747a176ce14a1451744499ac
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
- when 'ContentItem'
23
- ContentItem.new.from_json(data)
24
- when 'FileItem'
25
- FileItem.new.from_json(data)
26
- when 'LtiLinkItem'
27
- LtiLinkItem.new.from_json(data)
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
- if match = /^ext_([^=$]*)/.match(meth)
101
- meth =~ /=$/ ? @ext_attributes[match.to_s.to_sym] = args[0] : @ext_attributes[match.to_s.to_sym]
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.40
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-09 00:00:00.000000000 Z
11
+ date: 2016-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_oauth