strongmind-platform-sdk 3.17.1 → 3.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +2 -2
- data/lib/platform_sdk/active_record/data_pipelineable.rb +3 -3
- data/lib/platform_sdk/identity/clients.rb +14 -15
- data/lib/platform_sdk/spec_support/shared_examples/data_pipelineable_examples.rb +1 -1
- data/lib/platform_sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a116ab2dded0c9438031825118549bba4f66437bba41e21a05f5b10eee34f0f9
|
4
|
+
data.tar.gz: cf95cc4393e3718a60f57a41348f11be5b2a5e7e850ba0476a69e9d0a6a604e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6789b299100a35dc404bd7d9628949efe05e12c3eedf1642f3dd22d419e43c7f16555f6ac1ffe245e338b06fbb10a22fbb4a1ef2cdec81efb44fb5272402ad55
|
7
|
+
data.tar.gz: bc04bdfc93c81a2a5c843f70b34d8dc1d7a224771bd31ed17bb3bfed3bf0c9cc60cc85f8f872f6d2e4e1eb2e7dbb11f3b1f217d6982add5599f2a230972ac102
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
strongmind-platform-sdk (3.
|
4
|
+
strongmind-platform-sdk (3.19.0)
|
5
5
|
activesupport (~> 7.1)
|
6
6
|
aws-sdk-secretsmanager (~> 1.66)
|
7
7
|
faraday (~> 2.5, >= 2.5.2)
|
@@ -95,7 +95,7 @@ GEM
|
|
95
95
|
public_suffix (>= 2.0.2, < 6.0)
|
96
96
|
ast (2.4.2)
|
97
97
|
aws-eventstream (1.3.0)
|
98
|
-
aws-partitions (1.
|
98
|
+
aws-partitions (1.931.0)
|
99
99
|
aws-sdk-cloudwatch (1.91.0)
|
100
100
|
aws-sdk-core (~> 3, >= 3.193.0)
|
101
101
|
aws-sigv4 (~> 1.1)
|
@@ -14,7 +14,7 @@ module PlatformSdk
|
|
14
14
|
|
15
15
|
def pipeline_payload(action)
|
16
16
|
{
|
17
|
-
"noun": pipeline_noun,
|
17
|
+
"noun": self.class.pipeline_noun,
|
18
18
|
"identifiers": pipeline_identifiers,
|
19
19
|
"meta": pipeline_meta,
|
20
20
|
"data": pipeline_data(action),
|
@@ -23,8 +23,8 @@ module PlatformSdk
|
|
23
23
|
}
|
24
24
|
end
|
25
25
|
|
26
|
-
def pipeline_noun
|
27
|
-
|
26
|
+
def self.pipeline_noun
|
27
|
+
raise NotImplementedError, 'You must implement the pipeline_noun class method'
|
28
28
|
end
|
29
29
|
|
30
30
|
def pipeline_identifiers
|
@@ -77,20 +77,6 @@ module PlatformSdk
|
|
77
77
|
Time.at(JWT.decode(jwt, nil, false)[0]["exp"])
|
78
78
|
end
|
79
79
|
|
80
|
-
def refresh_token_if_expired(jwt:, refresh_token:)
|
81
|
-
raise ArgumentError if refresh_token.nil? || jwt.nil?
|
82
|
-
return unless token_expired?(jwt)
|
83
|
-
|
84
|
-
refresh_token(refresh_token)
|
85
|
-
end
|
86
|
-
|
87
|
-
def refresh_token(refresh_token)
|
88
|
-
raise ArgumentError if refresh_token.nil?
|
89
|
-
|
90
|
-
post_payload("/connect/token", request_body(
|
91
|
-
grant_type: "refresh_token", refresh_token:))
|
92
|
-
end
|
93
|
-
|
94
80
|
def refresh_session(session: {})
|
95
81
|
raise ArgumentError if session[:access_token].nil? || session[:refresh_token].nil?
|
96
82
|
|
@@ -103,6 +89,19 @@ module PlatformSdk
|
|
103
89
|
session[:refresh_token] = refreshed_tokens[:refresh_token]
|
104
90
|
end
|
105
91
|
|
92
|
+
def refresh_token_if_expired(jwt:, refresh_token:)
|
93
|
+
raise ArgumentError if refresh_token.nil? || jwt.nil?
|
94
|
+
return unless token_expired?(jwt)
|
95
|
+
|
96
|
+
new_refresh_token(refresh_token)
|
97
|
+
end
|
98
|
+
|
99
|
+
def new_refresh_token(refresh_token)
|
100
|
+
raise ArgumentError if refresh_token.nil?
|
101
|
+
|
102
|
+
post_payload("/connect/token", request_body(grant_type: "refresh_token", refresh_token:))
|
103
|
+
end
|
104
|
+
|
106
105
|
def raise_error_with_payload(exception_class, error)
|
107
106
|
json_log = {
|
108
107
|
exception: exception_class.new.class.name.demodulize,
|
@@ -110,7 +109,7 @@ module PlatformSdk
|
|
110
109
|
response_body: error.response[:body],
|
111
110
|
status: error.response[:status]
|
112
111
|
}.compact
|
113
|
-
Rails.logger.info json_log.to_json if
|
112
|
+
Rails.logger.info json_log.to_json if defined?(Rails)
|
114
113
|
raise exception_class, error.response
|
115
114
|
end
|
116
115
|
|
@@ -3,7 +3,7 @@ module PlatformSdk
|
|
3
3
|
RSpec.shared_examples "DataPipelineable" do | data = nil|
|
4
4
|
let(:pipeline_payload) do
|
5
5
|
{
|
6
|
-
"noun":
|
6
|
+
"noun": described_class.pipeline_noun,
|
7
7
|
"identifiers": { "id": record.id },
|
8
8
|
"meta": { "source": 'strongmind-central' },
|
9
9
|
"data": data || default_data,
|
data/lib/platform_sdk/version.rb
CHANGED
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: 3.
|
4
|
+
version: 3.19.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: 2024-05-
|
11
|
+
date: 2024-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|