ims-lti 2.0.0.beta.28 → 2.0.0.beta.29

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: 28f95792a5114c70ded6b2de1ba194a9441e3b57
4
- data.tar.gz: 9142eb85489ee801ce9f5a2daffcdeb87c1351f2
3
+ metadata.gz: d34295d75aca72702d27339dca8e30bcfc4b5f42
4
+ data.tar.gz: e346638b48ba8f6bb59e3ef619702cfba4ff3a3d
5
5
  SHA512:
6
- metadata.gz: 308f9481a96751413cd6799b29c0a724d06e3c3272582111703279fcf632aa0fb84584e03722cc8307e5eab087677ac5eaaed2af4660727134c653418fea3e14
7
- data.tar.gz: 0eaafd723767d089620816a1b444563246c2a47387a95facf774292bcae6c7b35da5465b9f0482fb2bfdeabf9d3c1bb551dee6df5640fb4952cab6b765004696
6
+ metadata.gz: 80193d854a2508f0a684157315f3be2d64f86da6045bed665dc66d8d74e146964c33d1fcb7fca18d971421cbf3134b1a0b4904f9ac8e649862082ff8b0c7cfc6
7
+ data.tar.gz: 129464c6b469f478fba49a837674ef62d36932f4f2b480de8efe05b2e1aa053abdbd93661197e3ad3a9f3a90e7983035bb77a60baaa0e02f069761c7e47768a6
@@ -88,7 +88,7 @@ module IMS::LTI::Models
88
88
  def from_json(json)
89
89
  data = json.is_a?(String) ? JSON.parse(json) : json
90
90
  if data.is_a? Array
91
- data.map { |hash| self.class.new.from_json(hash.to_json) }
91
+ data.map { |hash| self.class.from_json(hash.to_json) }
92
92
  else
93
93
  process_json_hash(data)
94
94
  end
@@ -6,5 +6,6 @@ module IMS::LTI::Models
6
6
  require_relative 'messages/basic_lti_launch_request'
7
7
  require_relative 'messages/content_item_selection_request'
8
8
  require_relative 'messages/content_item_selection'
9
+ require_relative 'messages/tool_proxy_reregistration_request'
9
10
  end
10
11
  end
@@ -35,6 +35,16 @@ module IMS::LTI::Models::Messages
35
35
  add_params('@deprecated_params', param, *params)
36
36
  end
37
37
 
38
+ def inherited(klass)
39
+ @descendants ||= Set.new
40
+ @descendants << klass
41
+ superclass.inherited(klass) unless(self == Message)
42
+ end
43
+
44
+ def descendants
45
+ @descendants || Set.new
46
+ end
47
+
38
48
  private
39
49
 
40
50
  def add_params(instance_variable, param, *params)
@@ -58,6 +68,8 @@ module IMS::LTI::Models::Messages
58
68
 
59
69
  end
60
70
 
71
+ MESSAGE_TYPE = "".freeze
72
+
61
73
  LAUNCH_TARGET_IFRAME = 'iframe'
62
74
  LAUNCH_TARGET_WINDOW = 'window'
63
75
 
@@ -73,18 +85,8 @@ module IMS::LTI::Models::Messages
73
85
  add_required_params :lti_message_type, :lti_version
74
86
 
75
87
  def self.generate(params)
76
- case params['lti_message_type']
77
- when BasicLTILaunchRequest::MESSAGE_TYPE
78
- BasicLTILaunchRequest.new(params)
79
- when RegistrationRequest::MESSAGE_TYPE
80
- RegistrationRequest.new(params)
81
- when ContentItemSelectionRequest::MESSAGE_TYPE
82
- ContentItemSelectionRequest.new(params)
83
- when ContentItemSelection::MESSAGE_TYPE
84
- ContentItemSelection.new(params)
85
- else
86
- self.new(params)
87
- end
88
+ klass = self.descendants.select{|d| d::MESSAGE_TYPE == params['lti_message_type']}.first
89
+ klass ? klass.new(params) : Message.new(params)
88
90
  end
89
91
 
90
92
  def initialize(attrs = {})
@@ -3,6 +3,7 @@ module IMS::LTI::Models::Messages
3
3
 
4
4
  add_required_params :reg_key, :reg_password, :tc_profile_url, :launch_presentation_return_url
5
5
 
6
+
6
7
  MESSAGE_TYPE = 'ToolProxyRegistrationRequest'
7
8
 
8
9
  def initialize(attrs = {})
@@ -0,0 +1,15 @@
1
+ module IMS::LTI::Models::Messages
2
+ class ToolProxyReregistrationRequest < RequestMessage
3
+
4
+ add_required_params :tc_profile_url, :launch_presentation_return_url
5
+
6
+
7
+ MESSAGE_TYPE = 'ToolProxyReregistrationRequest'
8
+
9
+ def initialize(attrs = {})
10
+ super(attrs)
11
+ self.lti_message_type = MESSAGE_TYPE
12
+ end
13
+
14
+ end
15
+ 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.28
4
+ version: 2.0.0.beta.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-17 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_oauth
@@ -94,6 +94,48 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.2.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.13.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.13.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 4.6.4
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 4.6.4
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.10.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.10.1
97
139
  description:
98
140
  email:
99
141
  executables: []
@@ -134,6 +176,7 @@ files:
134
176
  - lib/ims/lti/models/messages/message.rb
135
177
  - lib/ims/lti/models/messages/registration_request.rb
136
178
  - lib/ims/lti/models/messages/request_message.rb
179
+ - lib/ims/lti/models/messages/tool_proxy_reregistration_request.rb
137
180
  - lib/ims/lti/models/parameter.rb
138
181
  - lib/ims/lti/models/product_family.rb
139
182
  - lib/ims/lti/models/product_info.rb