strongmind-platform-sdk 2.14.0 → 2.15.1

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: 87d70927837c73835df85dd3ddee8f2d40cf061989154a81eccfff4b975180f8
4
- data.tar.gz: e3ec2b74e8f71acbb39bc9f589a332ac88cf795a84c949d7187fd67c47b8c8e4
3
+ metadata.gz: f578ddf396a05c731db6eea3325b5506e3211441dbc32635cfbc51144cf53591
4
+ data.tar.gz: dfeb24568b2146d0c8af18c223bdeeca0ca01f1835d5095571acb6625176560d
5
5
  SHA512:
6
- metadata.gz: bb9b8528dd9893c93c37ca362e1042490a5a95b7ce8175525b72921bd30038af8effe31294392f5f5ff6b535737c1d77e6fa32ba343a3f074e19a6d9298d08ae
7
- data.tar.gz: 356109449dfb2c4b22b6f3ed8ed369776b15a64b6998eb471ec9411a32ad1bd2e7569ecc18b69705778f8f5efcd051e043c0cd6448034d45f632f96bc67e2f6a
6
+ metadata.gz: 9b2557b3d3fc81ed7d0de75439a5a42f9b650c3c96b75555bf7284a41169f5b672fe27563bb7f5157f2637f8b998c5de3ae4a21f8d2a92b0cb0d6d0aa54f90dd
7
+ data.tar.gz: d6ab6e50d0156a9a62dc9e525cd2114529b12eab4b9e75d85df9d169b72fe010b7feec7baa28340ffb44d0ef65b53be5a09eff534ed836565e556567765daab8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (2.14.0)
4
+ strongmind-platform-sdk (2.15.1)
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,7 +38,7 @@ 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.772.0)
41
+ aws-partitions (1.775.0)
42
42
  aws-sdk-core (3.174.0)
43
43
  aws-eventstream (~> 1, >= 1.0.2)
44
44
  aws-partitions (~> 1, >= 1.651.0)
@@ -52,7 +52,7 @@ GEM
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,7 +67,7 @@ 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
72
  faraday (2.7.5)
73
73
  faraday-net_http (>= 2.0, < 3.1)
@@ -77,10 +77,10 @@ GEM
77
77
  faraday-net_http (3.0.2)
78
78
  ffi (1.15.5)
79
79
  hashie (5.0.0)
80
- i18n (1.12.0)
80
+ i18n (1.13.0)
81
81
  concurrent-ruby (~> 1.0)
82
82
  jmespath (1.6.2)
83
- json (2.6.2)
83
+ json (2.6.3)
84
84
  json-jwt (1.16.3)
85
85
  activesupport (>= 4.2)
86
86
  aes_key_wrap
@@ -99,7 +99,7 @@ GEM
99
99
  method_source (1.0.0)
100
100
  mini_mime (1.1.2)
101
101
  mini_portile2 (2.8.2)
102
- minitest (5.16.3)
102
+ minitest (5.18.0)
103
103
  net-imap (0.3.4)
104
104
  date
105
105
  net-protocol
@@ -112,10 +112,6 @@ GEM
112
112
  nokogiri (1.15.2)
113
113
  mini_portile2 (~> 2.8.2)
114
114
  racc (~> 1.4)
115
- nokogiri (1.15.2-x86_64-darwin)
116
- racc (~> 1.4)
117
- nokogiri (1.15.2-x86_64-linux)
118
- racc (~> 1.4)
119
115
  omniauth (2.1.1)
120
116
  hashie (>= 3.4.6)
121
117
  rack (>= 2.2.3)
@@ -140,8 +136,8 @@ GEM
140
136
  validate_url
141
137
  webfinger (~> 2.0)
142
138
  orm_adapter (0.5.0)
143
- parallel (1.22.1)
144
- parser (3.1.2.1)
139
+ parallel (1.23.0)
140
+ parser (3.2.2.1)
145
141
  ast (~> 2.4.1)
146
142
  public_suffix (5.0.1)
147
143
  racc (1.6.2)
@@ -163,46 +159,46 @@ GEM
163
159
  rails-html-sanitizer (1.6.0)
164
160
  loofah (~> 2.21)
165
161
  nokogiri (~> 1.14)
166
- railties (7.0.4)
167
- actionpack (= 7.0.4)
168
- activesupport (= 7.0.4)
162
+ railties (7.0.5)
163
+ actionpack (= 7.0.5)
164
+ activesupport (= 7.0.5)
169
165
  method_source
170
166
  rake (>= 12.2)
171
167
  thor (~> 1.0)
172
168
  zeitwerk (~> 2.5)
173
169
  rainbow (3.1.1)
174
170
  rake (13.0.6)
175
- regexp_parser (2.6.0)
171
+ regexp_parser (2.8.0)
176
172
  responders (3.1.0)
177
173
  actionpack (>= 5.2)
178
174
  railties (>= 5.2)
179
175
  rexml (3.2.5)
180
- rspec (3.11.0)
181
- rspec-core (~> 3.11.0)
182
- rspec-expectations (~> 3.11.0)
183
- rspec-mocks (~> 3.11.0)
184
- rspec-core (3.11.0)
185
- rspec-support (~> 3.11.0)
186
- rspec-expectations (3.11.1)
176
+ rspec (3.12.0)
177
+ rspec-core (~> 3.12.0)
178
+ rspec-expectations (~> 3.12.0)
179
+ rspec-mocks (~> 3.12.0)
180
+ rspec-core (3.12.2)
181
+ rspec-support (~> 3.12.0)
182
+ rspec-expectations (3.12.3)
187
183
  diff-lcs (>= 1.2.0, < 2.0)
188
- rspec-support (~> 3.11.0)
189
- rspec-mocks (3.11.1)
184
+ rspec-support (~> 3.12.0)
185
+ rspec-mocks (3.12.5)
190
186
  diff-lcs (>= 1.2.0, < 2.0)
191
- rspec-support (~> 3.11.0)
192
- rspec-support (3.11.1)
193
- rubocop (1.37.0)
187
+ rspec-support (~> 3.12.0)
188
+ rspec-support (3.12.0)
189
+ rubocop (1.51.0)
194
190
  json (~> 2.3)
195
191
  parallel (~> 1.10)
196
- parser (>= 3.1.2.1)
192
+ parser (>= 3.2.0.0)
197
193
  rainbow (>= 2.2.2, < 4.0)
198
194
  regexp_parser (>= 1.8, < 3.0)
199
195
  rexml (>= 3.2.5, < 4.0)
200
- rubocop-ast (>= 1.22.0, < 2.0)
196
+ rubocop-ast (>= 1.28.0, < 2.0)
201
197
  ruby-progressbar (~> 1.7)
202
- unicode-display_width (>= 1.4.0, < 3.0)
203
- rubocop-ast (1.23.0)
204
- parser (>= 3.1.1.0)
205
- ruby-progressbar (1.11.0)
198
+ unicode-display_width (>= 2.4.0, < 3.0)
199
+ rubocop-ast (1.28.1)
200
+ parser (>= 3.2.1.0)
201
+ ruby-progressbar (1.13.0)
206
202
  ruby2_keywords (0.0.5)
207
203
  strongmind-oneroster-client (2.0.3)
208
204
  json (~> 2.1, >= 2.1.0)
@@ -216,9 +212,9 @@ GEM
216
212
  timeout (0.3.2)
217
213
  typhoeus (1.4.0)
218
214
  ethon (>= 0.9.0)
219
- tzinfo (2.0.5)
215
+ tzinfo (2.0.6)
220
216
  concurrent-ruby (~> 1.0)
221
- unicode-display_width (2.3.0)
217
+ unicode-display_width (2.4.2)
222
218
  uri (0.12.1)
223
219
  validate_email (0.1.6)
224
220
  activemodel (>= 3.0)
data/README.md CHANGED
@@ -11,7 +11,7 @@ First [configure your GitHub credentials](#configure-github-credentials)
11
11
  Install the gem and add to the application's Gemfile by executing:
12
12
 
13
13
  ```
14
- gem "strongmind-platform-sdk", "~> 2.13.1"
14
+ gem "strongmind-platform-sdk", "~> 2.15.1"
15
15
  ```
16
16
 
17
17
  If bundler is not being used to manage dependencies, install the gem by executing:
@@ -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
@@ -58,7 +58,7 @@ module PlatformSdk
58
58
  rescue JWT::ExpiredSignature
59
59
  return true
60
60
  end
61
- expiry_time <= Time.now.utc + 30
61
+ expiry_time <= Time.now.utc + 45
62
62
  end
63
63
 
64
64
  def refresh_token(jwt:, refresh_token:)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = "2.14.0"
4
+ VERSION = "2.15.1"
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.14.0
4
+ version: 2.15.1
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-06-01 00:00:00.000000000 Z
11
+ date: 2023-06-06 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