strongmind-platform-sdk 2.16.2 → 3.0.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: 4bc72f43e4f7d4d6ff6cc05a6e400163123c4fd959ab6ffeef97b7aef283ac1a
4
- data.tar.gz: 40cda5c1d875c2b63708450aa91ce5d910515f8e87d895efc84e44f53af2d72b
3
+ metadata.gz: af0bb9bb301d3ac21ab8b51699c2b55acda385db50d9b40da2f98369c2d1fb03
4
+ data.tar.gz: 0acb9f790fb2385dd132f0c83da3210285c60320fe471b6d728b2490239de3f3
5
5
  SHA512:
6
- metadata.gz: a4462ba232eb1df20b9bcbb55d0d3d282858f6291a1808ae2ff5e91fae3826e488d1267af1ed3754db1d92bb8305649336c98a8acb13e258aa005593a91ae57b
7
- data.tar.gz: 9df84c3821ef41d726b1ba1fb859287c7fab97fcde16ce3330f0b0aeb674bd7bf7133c2c36faffe84593c881fe4473a87a5dea8e9fac0ae1827e4e7847813328
6
+ metadata.gz: 8becc23e5879eb0c645cd15b3b4780831f09337e8f01d40573abb2e5f0756ca7cfb75bc3cebd6c865995a81e8e13a928ebcdbc9339ae6e2cce18dfb25e8a6110
7
+ data.tar.gz: 336cefee6f259e50f5efef3b4d86ecb6f3778cfa3427043f86a8d5bbbebb7f2f49d59bdd652f2441b3c357cc649e1688df30c32c8c3eea6a4551d1b624ba4b80
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (2.16.2)
4
+ strongmind-platform-sdk (3.0.0)
5
5
  aws-sdk-secretsmanager (~> 1.66)
6
6
  devise
7
7
  faraday (~> 2.5, >= 2.5.2)
@@ -38,18 +38,18 @@ 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.775.0)
42
- aws-sdk-core (3.174.0)
41
+ aws-partitions (1.781.0)
42
+ aws-sdk-core (3.175.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.76.0)
47
+ aws-sdk-secretsmanager (1.77.0)
48
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
- bcrypt (3.1.18)
52
+ bcrypt (3.1.19)
53
53
  bindata (2.4.15)
54
54
  builder (3.2.4)
55
55
  concurrent-ruby (1.2.2)
@@ -69,7 +69,7 @@ GEM
69
69
  activesupport (>= 5.0.0)
70
70
  faker (3.2.0)
71
71
  i18n (>= 1.8.11, < 2)
72
- faraday (2.7.5)
72
+ faraday (2.7.7)
73
73
  faraday-net_http (>= 2.0, < 3.1)
74
74
  ruby2_keywords (>= 0.0.4)
75
75
  faraday-follow_redirects (0.3.0)
@@ -100,7 +100,7 @@ GEM
100
100
  mini_mime (1.1.2)
101
101
  mini_portile2 (2.8.2)
102
102
  minitest (5.18.0)
103
- net-imap (0.3.4)
103
+ net-imap (0.3.6)
104
104
  date
105
105
  net-protocol
106
106
  net-pop (0.1.2)
@@ -140,7 +140,7 @@ GEM
140
140
  parser (3.2.2.1)
141
141
  ast (~> 2.4.1)
142
142
  public_suffix (5.0.1)
143
- racc (1.6.2)
143
+ racc (1.7.1)
144
144
  rack (2.2.7)
145
145
  rack-oauth2 (2.2.0)
146
146
  activesupport
@@ -209,13 +209,13 @@ GEM
209
209
  faraday (~> 2.0)
210
210
  faraday-follow_redirects
211
211
  thor (1.2.2)
212
- timeout (0.3.2)
212
+ timeout (0.4.0)
213
213
  typhoeus (1.4.0)
214
214
  ethon (>= 0.9.0)
215
215
  tzinfo (2.0.6)
216
216
  concurrent-ruby (~> 1.0)
217
217
  unicode-display_width (2.4.2)
218
- uri (0.12.1)
218
+ uri (0.12.2)
219
219
  validate_email (0.1.6)
220
220
  activemodel (>= 3.0)
221
221
  mail (>= 2.2.5)
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.15.2"
14
+ gem "strongmind-platform-sdk", "~> 3.0.0"
15
15
  ```
16
16
 
17
17
  If bundler is not being used to manage dependencies, install the gem by executing:
@@ -62,42 +62,6 @@ module PlatformSdk
62
62
  body = get(path)
63
63
  models::Domain.new(body)
64
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)
100
- end
101
65
  end
102
66
  end
103
67
  end
@@ -5,7 +5,7 @@ module PlatformSdk
5
5
  module Models
6
6
  # Domain object returned by IdMapper
7
7
  class Domain
8
- attr_accessor :id, :name, :key, :secret, :is_disabled, :partner
8
+ attr_accessor :id, :name, :key, :secret, :token, :is_disabled, :partner
9
9
 
10
10
  def initialize(attributes = {})
11
11
  attributes.each do |key, value|
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
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
4
 
7
5
  module Models
8
6
 
@@ -54,13 +54,17 @@ module PlatformSdk
54
54
 
55
55
  def token_expired?(jwt)
56
56
  begin
57
- expiry_time = Time.at(JWT.decode(jwt, nil, false)[0]["exp"])
57
+ expiry_time = jwt_expiry_time(jwt)
58
58
  rescue JWT::ExpiredSignature
59
59
  return true
60
60
  end
61
61
  expiry_time <= Time.now.utc + 45
62
62
  end
63
63
 
64
+ def jwt_expiry_time(jwt)
65
+ Time.at(JWT.decode(jwt, nil, false)[0]["exp"])
66
+ end
67
+
64
68
  def refresh_token(jwt:, refresh_token:)
65
69
  raise ArgumentError if refresh_token.nil? || jwt.nil?
66
70
  return unless token_expired?(jwt)
@@ -80,6 +80,10 @@ module PlatformSdk
80
80
  case api_error.response[:status]
81
81
  when 404
82
82
  nil
83
+ when 401
84
+ jwt_expiry_time = @auth.token.present? ? @auth.jwt_expiry_time(@auth.token[:access_token]) : "No token present"
85
+ puts "Unauthorized exception when calling OneRoster resource. Current JWT expiry time = #{jwt_expiry_time}"
86
+ raise
83
87
  else
84
88
  puts "Exception when calling OneRoster resource: #{api_error}"
85
89
  raise
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = "2.16.2"
4
+ VERSION = "3.0.0"
5
5
  end
@@ -13,6 +13,8 @@ module PlatformSdk
13
13
 
14
14
  def expired?: -> bool
15
15
 
16
+ def jwt_expiry_time: -> Time
17
+
16
18
  def refresh_session: -> nil
17
19
 
18
20
  def refresh_token: -> Hash[Symbol, String]
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.16.2
4
+ version: 3.0.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-06-23 00:00:00.000000000 Z
11
+ date: 2023-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -165,8 +165,6 @@ files:
165
165
  - lib/platform_sdk/id_mapper/constants.rb
166
166
  - lib/platform_sdk/id_mapper/models.rb
167
167
  - lib/platform_sdk/id_mapper/models/domain.rb
168
- - lib/platform_sdk/id_mapper/models/domain_lti.rb
169
- - lib/platform_sdk/id_mapper/models/lti.rb
170
168
  - lib/platform_sdk/identity.rb
171
169
  - lib/platform_sdk/identity/clients.rb
172
170
  - lib/platform_sdk/one_roster.rb
@@ -1,18 +0,0 @@
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
@@ -1,18 +0,0 @@
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