strongmind-platform-sdk 2.13.1 → 2.15.0

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: 1828389247058021cdf82b6c505564d60ddf0186205e57cbd4c7f6657c0e0fc7
4
- data.tar.gz: 210b3b0234e91cc1c39b5bd14c3a52b4740fcae32ab45fc0105dfdb494d2d0c7
3
+ metadata.gz: dc1ec78b01606b3ff2d580b74384babf0b5bebe6b9fd63c860604fbbe2a4c448
4
+ data.tar.gz: fd71f249ded7674968d27bd4bd9151b0f7635eaf685ab16b5bd927e87cf33010
5
5
  SHA512:
6
- metadata.gz: 0bd91bed0f709dcf9062a390f0cf07b5b99aae5f7850a95a5babb4ff4d696048acabd0c109b9f3b93ff5d534a87ce4c8ce463f3e7f17bca3ecd8aa3e285ee8ca
7
- data.tar.gz: e90cfb387adb54b28d2390cf237e2df2e7520fed4bace564c936827fac4d87346dbafff6949074f5edc31cd70e02a38c167bcd68f1b7d0a8545cfb35cbc7b0d5
6
+ metadata.gz: 6623bda6194ed932d6658a4bd906caabc590ea5e81829d3b91ac38135e259013653830abc01eed053d37901e4925d9734149e5703d745cd430936e3c9e38fb02
7
+ data.tar.gz: 24f7e8881ddc97108d52867098c05b75131943f5403d5b4fe37b0206377fc5d5391dd6134c86fc5e42092b07294839bfb93977733e226b38076b4336ad280112
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (2.13.1)
4
+ strongmind-platform-sdk (2.15.0)
5
5
  aws-sdk-secretsmanager (~> 1.66)
6
6
  devise
7
7
  faraday (~> 2.5, >= 2.5.2)
@@ -14,22 +14,22 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- actionpack (7.0.4)
18
- actionview (= 7.0.4)
19
- activesupport (= 7.0.4)
20
- rack (~> 2.0, >= 2.2.0)
17
+ actionpack (7.0.5)
18
+ actionview (= 7.0.5)
19
+ activesupport (= 7.0.5)
20
+ rack (~> 2.0, >= 2.2.4)
21
21
  rack-test (>= 0.6.3)
22
22
  rails-dom-testing (~> 2.0)
23
23
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
24
- actionview (7.0.4)
25
- activesupport (= 7.0.4)
24
+ actionview (7.0.5)
25
+ activesupport (= 7.0.5)
26
26
  builder (~> 3.1)
27
27
  erubi (~> 1.4)
28
28
  rails-dom-testing (~> 2.0)
29
29
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
30
- activemodel (7.0.4)
31
- activesupport (= 7.0.4)
32
- activesupport (7.0.4)
30
+ activemodel (7.0.5)
31
+ activesupport (= 7.0.5)
32
+ activesupport (7.0.5)
33
33
  concurrent-ruby (~> 1.0, >= 1.0.2)
34
34
  i18n (>= 1.6, < 2)
35
35
  minitest (>= 5.1)
@@ -38,21 +38,21 @@ GEM
38
38
  ast (2.4.2)
39
39
  attr_required (1.0.1)
40
40
  aws-eventstream (1.2.0)
41
- aws-partitions (1.749.0)
42
- aws-sdk-core (3.171.0)
41
+ aws-partitions (1.772.0)
42
+ aws-sdk-core (3.174.0)
43
43
  aws-eventstream (~> 1, >= 1.0.2)
44
44
  aws-partitions (~> 1, >= 1.651.0)
45
45
  aws-sigv4 (~> 1.5)
46
46
  jmespath (~> 1, >= 1.6.1)
47
- aws-sdk-secretsmanager (1.73.0)
48
- aws-sdk-core (~> 3, >= 3.165.0)
47
+ aws-sdk-secretsmanager (1.76.0)
48
+ aws-sdk-core (~> 3, >= 3.174.0)
49
49
  aws-sigv4 (~> 1.1)
50
50
  aws-sigv4 (1.5.2)
51
51
  aws-eventstream (~> 1, >= 1.0.2)
52
52
  bcrypt (3.1.18)
53
53
  bindata (2.4.15)
54
54
  builder (3.2.4)
55
- concurrent-ruby (1.1.10)
55
+ concurrent-ruby (1.2.2)
56
56
  crass (1.0.6)
57
57
  date (3.3.3)
58
58
  devise (4.9.2)
@@ -67,9 +67,9 @@ GEM
67
67
  ffi (>= 1.15.0)
68
68
  factory_bot (6.2.1)
69
69
  activesupport (>= 5.0.0)
70
- faker (2.23.0)
70
+ faker (3.2.0)
71
71
  i18n (>= 1.8.11, < 2)
72
- faraday (2.7.4)
72
+ faraday (2.7.5)
73
73
  faraday-net_http (>= 2.0, < 3.1)
74
74
  ruby2_keywords (>= 0.0.4)
75
75
  faraday-follow_redirects (0.3.0)
@@ -77,11 +77,10 @@ GEM
77
77
  faraday-net_http (3.0.2)
78
78
  ffi (1.15.5)
79
79
  hashie (5.0.0)
80
- httpclient (2.8.3)
81
- i18n (1.12.0)
80
+ i18n (1.13.0)
82
81
  concurrent-ruby (~> 1.0)
83
82
  jmespath (1.6.2)
84
- json (2.6.2)
83
+ json (2.6.3)
85
84
  json-jwt (1.16.3)
86
85
  activesupport (>= 4.2)
87
86
  aes_key_wrap
@@ -89,9 +88,9 @@ GEM
89
88
  faraday (~> 2.0)
90
89
  faraday-follow_redirects
91
90
  jwt (1.5.6)
92
- loofah (2.20.0)
91
+ loofah (2.21.3)
93
92
  crass (~> 1.0.2)
94
- nokogiri (>= 1.5.9)
93
+ nokogiri (>= 1.12.0)
95
94
  mail (2.8.1)
96
95
  mini_mime (>= 0.1.1)
97
96
  net-imap
@@ -99,8 +98,8 @@ GEM
99
98
  net-smtp
100
99
  method_source (1.0.0)
101
100
  mini_mime (1.1.2)
102
- mini_portile2 (2.8.1)
103
- minitest (5.16.3)
101
+ mini_portile2 (2.8.2)
102
+ minitest (5.18.0)
104
103
  net-imap (0.3.4)
105
104
  date
106
105
  net-protocol
@@ -110,12 +109,12 @@ GEM
110
109
  timeout
111
110
  net-smtp (0.3.3)
112
111
  net-protocol
113
- nokogiri (1.14.3)
114
- mini_portile2 (~> 2.8.0)
112
+ nokogiri (1.15.2)
113
+ mini_portile2 (~> 2.8.2)
115
114
  racc (~> 1.4)
116
- nokogiri (1.14.3-x86_64-darwin)
115
+ nokogiri (1.15.2-x86_64-darwin)
117
116
  racc (~> 1.4)
118
- nokogiri (1.14.3-x86_64-linux)
117
+ nokogiri (1.15.2-x86_64-linux)
119
118
  racc (~> 1.4)
120
119
  omniauth (2.1.1)
121
120
  hashie (>= 3.4.6)
@@ -124,31 +123,34 @@ GEM
124
123
  omniauth-rails_csrf_protection (1.0.1)
125
124
  actionpack (>= 4.2)
126
125
  omniauth (~> 2.0)
127
- omniauth_openid_connect (0.6.1)
126
+ omniauth_openid_connect (0.7.1)
128
127
  omniauth (>= 1.9, < 3)
129
- openid_connect (~> 1.1)
130
- openid_connect (1.4.2)
128
+ openid_connect (~> 2.2)
129
+ openid_connect (2.2.0)
131
130
  activemodel
132
131
  attr_required (>= 1.0.0)
133
- json-jwt (>= 1.15.0)
132
+ faraday (~> 2.0)
133
+ faraday-follow_redirects
134
+ json-jwt (>= 1.16)
134
135
  net-smtp
135
- rack-oauth2 (~> 1.21)
136
- swd (~> 1.3)
136
+ rack-oauth2 (~> 2.2)
137
+ swd (~> 2.0)
137
138
  tzinfo
138
139
  validate_email
139
140
  validate_url
140
- webfinger (~> 1.2)
141
+ webfinger (~> 2.0)
141
142
  orm_adapter (0.5.0)
142
- parallel (1.22.1)
143
- parser (3.1.2.1)
143
+ parallel (1.23.0)
144
+ parser (3.2.2.1)
144
145
  ast (~> 2.4.1)
145
146
  public_suffix (5.0.1)
146
147
  racc (1.6.2)
147
- rack (2.2.6.4)
148
- rack-oauth2 (1.21.3)
148
+ rack (2.2.7)
149
+ rack-oauth2 (2.2.0)
149
150
  activesupport
150
151
  attr_required
151
- httpclient
152
+ faraday (~> 2.0)
153
+ faraday-follow_redirects
152
154
  json-jwt (>= 1.11.0)
153
155
  rack (>= 2.1.0)
154
156
  rack-protection (3.0.6)
@@ -158,63 +160,65 @@ GEM
158
160
  rails-dom-testing (2.0.3)
159
161
  activesupport (>= 4.2.0)
160
162
  nokogiri (>= 1.6)
161
- rails-html-sanitizer (1.5.0)
162
- loofah (~> 2.19, >= 2.19.1)
163
- railties (7.0.4)
164
- actionpack (= 7.0.4)
165
- activesupport (= 7.0.4)
163
+ rails-html-sanitizer (1.6.0)
164
+ loofah (~> 2.21)
165
+ nokogiri (~> 1.14)
166
+ railties (7.0.5)
167
+ actionpack (= 7.0.5)
168
+ activesupport (= 7.0.5)
166
169
  method_source
167
170
  rake (>= 12.2)
168
171
  thor (~> 1.0)
169
172
  zeitwerk (~> 2.5)
170
173
  rainbow (3.1.1)
171
174
  rake (13.0.6)
172
- regexp_parser (2.6.0)
175
+ regexp_parser (2.8.0)
173
176
  responders (3.1.0)
174
177
  actionpack (>= 5.2)
175
178
  railties (>= 5.2)
176
179
  rexml (3.2.5)
177
- rspec (3.11.0)
178
- rspec-core (~> 3.11.0)
179
- rspec-expectations (~> 3.11.0)
180
- rspec-mocks (~> 3.11.0)
181
- rspec-core (3.11.0)
182
- rspec-support (~> 3.11.0)
183
- rspec-expectations (3.11.1)
180
+ rspec (3.12.0)
181
+ rspec-core (~> 3.12.0)
182
+ rspec-expectations (~> 3.12.0)
183
+ rspec-mocks (~> 3.12.0)
184
+ rspec-core (3.12.2)
185
+ rspec-support (~> 3.12.0)
186
+ rspec-expectations (3.12.3)
184
187
  diff-lcs (>= 1.2.0, < 2.0)
185
- rspec-support (~> 3.11.0)
186
- rspec-mocks (3.11.1)
188
+ rspec-support (~> 3.12.0)
189
+ rspec-mocks (3.12.5)
187
190
  diff-lcs (>= 1.2.0, < 2.0)
188
- rspec-support (~> 3.11.0)
189
- rspec-support (3.11.1)
190
- rubocop (1.37.0)
191
+ rspec-support (~> 3.12.0)
192
+ rspec-support (3.12.0)
193
+ rubocop (1.51.0)
191
194
  json (~> 2.3)
192
195
  parallel (~> 1.10)
193
- parser (>= 3.1.2.1)
196
+ parser (>= 3.2.0.0)
194
197
  rainbow (>= 2.2.2, < 4.0)
195
198
  regexp_parser (>= 1.8, < 3.0)
196
199
  rexml (>= 3.2.5, < 4.0)
197
- rubocop-ast (>= 1.22.0, < 2.0)
200
+ rubocop-ast (>= 1.28.0, < 2.0)
198
201
  ruby-progressbar (~> 1.7)
199
- unicode-display_width (>= 1.4.0, < 3.0)
200
- rubocop-ast (1.23.0)
201
- parser (>= 3.1.1.0)
202
- ruby-progressbar (1.11.0)
202
+ unicode-display_width (>= 2.4.0, < 3.0)
203
+ rubocop-ast (1.28.1)
204
+ parser (>= 3.2.1.0)
205
+ ruby-progressbar (1.13.0)
203
206
  ruby2_keywords (0.0.5)
204
207
  strongmind-oneroster-client (2.0.3)
205
208
  json (~> 2.1, >= 2.1.0)
206
209
  typhoeus (~> 1.0, >= 1.0.1)
207
- swd (1.3.0)
210
+ swd (2.0.2)
208
211
  activesupport (>= 3)
209
212
  attr_required (>= 0.0.5)
210
- httpclient (>= 2.4)
211
- thor (1.2.1)
213
+ faraday (~> 2.0)
214
+ faraday-follow_redirects
215
+ thor (1.2.2)
212
216
  timeout (0.3.2)
213
217
  typhoeus (1.4.0)
214
218
  ethon (>= 0.9.0)
215
- tzinfo (2.0.5)
219
+ tzinfo (2.0.6)
216
220
  concurrent-ruby (~> 1.0)
217
- unicode-display_width (2.3.0)
221
+ unicode-display_width (2.4.2)
218
222
  uri (0.12.1)
219
223
  validate_email (0.1.6)
220
224
  activemodel (>= 3.0)
@@ -224,10 +228,11 @@ GEM
224
228
  public_suffix
225
229
  warden (1.2.9)
226
230
  rack (>= 2.0.9)
227
- webfinger (1.2.0)
231
+ webfinger (2.1.2)
228
232
  activesupport
229
- httpclient (>= 2.4)
230
- zeitwerk (2.6.7)
233
+ faraday (~> 2.0)
234
+ faraday-follow_redirects
235
+ zeitwerk (2.6.8)
231
236
 
232
237
  PLATFORMS
233
238
  ruby
@@ -22,8 +22,15 @@
22
22
  IDENTITY_CLIENT_ID=
23
23
  IDENTITY_CLIENT_SECRET=
24
24
  ```
25
-
26
- 1. If you want user sessions to persist across restarts of your server in dev, and you aren't using redis in dev, add `config.cache_store = :file_store` to `config/environments/development.rb`
25
+ 1. For local development, run this to enable caching:
26
+ ```
27
+ rails dev:cache
28
+ ```
29
+ This will create a file `tmp/caching-dev.txt` that you can delete to disable caching.
30
+ 1. If you want user sessions to persist across restarts of your server in dev, and you aren't using redis in dev, add this to `config/environments/development.rb` (instead of `:memory_store`):
31
+ ```
32
+ config.cache_store = :file_store, "#{Rails.root}/tmp/cache/"
33
+ ```
27
34
 
28
35
  1. Do you want all pages to require authentication?
29
36
  - If yes, add this to `app/controllers/application_controller.rb` right under the class declaration:
@@ -4,8 +4,9 @@ module Users
4
4
  class OmniauthCallbacksController < Devise::OmniauthCallbacksController
5
5
 
6
6
  def strongmind
7
- # Sign in the user
8
- @user = User.from_omniauth(request.env['omniauth.auth'])
7
+ auth = request.env['omniauth.auth']
8
+ @user = User.from_omniauth(auth)
9
+ session[:full_name] = "#{auth.extra.raw_info['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname']} #{auth.extra.raw_info['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname']}"
9
10
  sign_in_and_redirect @user
10
11
  end
11
12
 
@@ -1,3 +1,8 @@
1
- Hi <%= current_user.auth.extra.raw_info['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname'] %>
2
- <%= current_user.auth.extra.raw_info['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname'] %>!
3
- <%= button_to 'Sign out', '/users/sign_out', style: 'display:inline' %>
1
+ <div>
2
+ <div>
3
+ Hi <%= session[:full_name] %>!
4
+ </div>
5
+ <div>
6
+ <%= button_to 'Sign out', '/users/sign_out', style: 'display:inline' %>
7
+ </div>
8
+ </div>
@@ -20,19 +20,83 @@ module PlatformSdk
20
20
  end
21
21
  end
22
22
 
23
+ private
24
+ def models
25
+ PlatformSdk::IdMapper::Models
26
+ end
27
+
28
+ def get(path, params = nil)
29
+ response = @conn.get(path, params)
30
+ response.body
31
+ end
32
+
33
+ def headers
34
+ { "Authorization" => "Token #{@token}" }
35
+ end
36
+
37
+ def list_of_models(model, list)
38
+ list.map do |item|
39
+ model.new(item)
40
+ end
41
+ end
42
+
43
+ public
44
+
23
45
  def pairs(guid)
46
+ path = "api/v1/pairs/#{guid}/"
24
47
  begin
25
- response = @conn.get("api/v1/pairs/#{guid}")
48
+ get(path)
26
49
  rescue Faraday::ResourceNotFound
27
50
  raise PlatformSdk::IdMapper::PairNotFoundError, msg = guid
28
51
  end
29
- response.body
30
52
  end
31
53
 
32
- private
54
+ def domains(**params)
55
+ path = 'api/v1/domains/'
56
+ body = get(path, params)
57
+ list_of_models(models::Domain, body)
58
+ end
33
59
 
34
- def headers
35
- { "Authorization" => "Token #{@token}" }
60
+ def domain_by_name(name)
61
+ path = "api/v1/domains/#{name}/"
62
+ body = get(path)
63
+ models::Domain.new(body)
64
+ end
65
+
66
+ def domain_ltis(**params)
67
+ path = 'api/v1/domainLtis/'
68
+ body = get(path, params)
69
+ list_of_models(models::DomainLti, body)
70
+ end
71
+
72
+ def domain_ltis_by_domain(domain_name)
73
+ path = "api/v1/domains/#{domain_name}/ltis/"
74
+ body = get(path)
75
+ list_of_models(models::DomainLti, body)
76
+ end
77
+
78
+ def domain_ltis_by_lti(lti_identifier)
79
+ path = "api/v1/domainLtis/?lti__identifier=#{lti_identifier}"
80
+ body = get(path)
81
+ list_of_models(models::DomainLti, body)
82
+ end
83
+
84
+ def domain_lti_by_domain_and_lti(domain_name, lti_identifier)
85
+ path = "api/v1/domains/#{domain_name}/ltis/#{lti_identifier}/"
86
+ body = get(path)
87
+ list_of_models(models::DomainLti, body)
88
+ end
89
+
90
+ def ltis(**params)
91
+ path = 'api/v1/ltis/'
92
+ body = get(path, params)
93
+ list_of_models(models::Lti, body)
94
+ end
95
+
96
+ def lti_by_identifier(identifier)
97
+ path = "api/v1/ltis/#{identifier}/"
98
+ body = get(path)
99
+ models::Lti.new(body)
36
100
  end
37
101
  end
38
102
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformSdk
4
+ module IdMapper
5
+ module Models
6
+ # Domain object returned by IdMapper
7
+ class Domain
8
+ attr_accessor :id, :name, :key, :secret, :is_disabled, :partner
9
+
10
+ def initialize(attributes = {})
11
+ attributes.each do |key, value|
12
+ instance_variable_set("@#{key}", value)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformSdk
4
+ module IdMapper
5
+ module Models
6
+ # DomainLti object returned by IdMapper
7
+ class DomainLti
8
+ attr_accessor :key, :secret, :is_disabled, :domain, :domain_name, :lti, :lti_title, :lti_identifier, :lti_is_disabled
9
+
10
+ def initialize(attributes = {})
11
+ attributes.each do |key, value|
12
+ instance_variable_set("@#{key}", value)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformSdk
4
+ module IdMapper
5
+ module Models
6
+ # Lti object returned by IdMapper
7
+ class Lti
8
+ attr_accessor :id, :title, :identifier, :is_disabled
9
+
10
+ def initialize(attributes = {})
11
+ attributes.each do |key, value|
12
+ send("#{key}=", value)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'platform_sdk/id_mapper/models/domain'
4
+ require 'platform_sdk/id_mapper/models/domain_lti'
5
+ require 'platform_sdk/id_mapper/models/lti'
6
+
7
+ module Models
8
+
9
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'platform_sdk/id_mapper/client'
3
+ require 'platform_sdk/id_mapper/models'
3
4
  require 'platform_sdk/id_mapper/constants'
4
5
 
5
6
  module PlatformSdk
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = "2.13.1"
4
+ VERSION = "2.15.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-platform-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.1
4
+ version: 2.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platform Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-18 00:00:00.000000000 Z
11
+ date: 2023-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -161,6 +161,10 @@ files:
161
161
  - lib/platform_sdk/id_mapper.rb
162
162
  - lib/platform_sdk/id_mapper/client.rb
163
163
  - lib/platform_sdk/id_mapper/constants.rb
164
+ - lib/platform_sdk/id_mapper/models.rb
165
+ - lib/platform_sdk/id_mapper/models/domain.rb
166
+ - lib/platform_sdk/id_mapper/models/domain_lti.rb
167
+ - lib/platform_sdk/id_mapper/models/lti.rb
164
168
  - lib/platform_sdk/identity.rb
165
169
  - lib/platform_sdk/identity/clients.rb
166
170
  - lib/platform_sdk/one_roster.rb