ims-lti 2.0.0.beta.7 → 2.0.0.beta.8

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: a4b75c3659bf81408dbd99525354825059501e09
4
- data.tar.gz: 2c5f25d5f7b46e70accb7342489f9fc3feb610ce
3
+ metadata.gz: 470901be5d078035d8d652194c97082c60c5c5df
4
+ data.tar.gz: 41c6440032084cbc2f6b6fd5c84965e9b01474b8
5
5
  SHA512:
6
- metadata.gz: 2a9572e9e28d1f59228e84a8b43045fd1a0554568ebd700940b2fa6e32142ea5eed7772abdc191e2c805b1c129be48e54efef7cf0d2bb53b9fc4735153c83e1a
7
- data.tar.gz: 199eaf90fab3d9a37b805947c359fc440ad43e18b30b9c6269b025015e3f2f6b8c29395fd32b6dca9ffe82d245b35e3370cc8b4964845697c1fdbd6c5fd21a8e
6
+ metadata.gz: 05ed9cd89b2b949cdc351ff79d26ebafaeda77df2d25b41c13ab5438a0a1d4775ebaed924379ad03cd091be8caa4e95960cf2a0e97c3dcd2393f2801ccb7ea74
7
+ data.tar.gz: e51238d0b05b1adfb8569ba79379546deedbadbdced899980fe413a3cbb4d0709104d73e403a3e495dbf84c3f10a32340bd736ef50796694fe80a12dbd1c2d6e
@@ -5,6 +5,7 @@ module IMS::LTI::Models
5
5
  def initialize(default_value = nil, key = nil)
6
6
  @default_value = default_value
7
7
  @key = key
8
+ super()
8
9
  end
9
10
 
10
11
  end
@@ -3,6 +3,7 @@ module IMS::LTI::Models
3
3
  add_attributes :default_value, :key
4
4
 
5
5
  def initialize(default_value = nil, key = nil)
6
+ super()
6
7
  @default_value = default_value
7
8
  @key = key
8
9
  end
@@ -4,6 +4,7 @@ module IMS::LTI::Models
4
4
 
5
5
  def initialize(attributes = {})
6
6
  self.attributes = attributes
7
+ @ext_attributes = {}
7
8
  end
8
9
 
9
10
  def self.add_attributes(attribute, *attrs)
@@ -48,6 +49,8 @@ module IMS::LTI::Models
48
49
  attrs.each do |k, v|
49
50
  if self.class.attributes.include?(k.to_sym)
50
51
  instance_variable_set("@#{k.to_s}", v)
52
+ elsif k.to_s =~ /^ext_/
53
+ @ext_attributes[k.to_sym] = v
51
54
  else
52
55
  warn("Unknown attribute '#{k}'")
53
56
  end
@@ -61,6 +64,7 @@ module IMS::LTI::Models
61
64
  val = attributes[attr.to_s]
62
65
  json_hash[json_key(attr)] = val.as_json if val
63
66
  end
67
+ json_hash = @ext_attributes.merge(json_hash)
64
68
  json_hash.merge! to_json_conversions
65
69
  json_hash.merge! to_json_keys
66
70
  json_hash
@@ -79,6 +83,14 @@ module IMS::LTI::Models
79
83
  end
80
84
  end
81
85
 
86
+ def method_missing(meth, *args, &block)
87
+ if match = /^ext_([^=$]*)/.match(meth)
88
+ meth =~ /=$/ ? @ext_attributes[match.to_s.to_sym] = args[0] : @ext_attributes[match.to_s.to_sym]
89
+ else
90
+ super
91
+ end
92
+ end
93
+
82
94
  private
83
95
 
84
96
  def process_json_hash(hash)
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.7
4
+ version: 2.0.0.beta.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-28 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_oauth