strongmind-platform-sdk 3.19.9 → 3.19.10
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/platform_sdk/identity/clients.rb +9 -6
- 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: 10187a8eb94f16ef74713d4ebc7050e2b26dd3765fd0833f27aa9c9f2ffbe620
|
4
|
+
data.tar.gz: 29525b19fec16e6369fe505b2597be11a7a065392c09197c8f39c199aca70196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2d1bd26b0775c4317629bb9429de29ab1838cff997e0a343e9c2229aa95442701ccb545f5c047ffce0cad2701ab5887c1692d95f21e26f6e0d8c9fc753c9606
|
7
|
+
data.tar.gz: 137bd7142f18e0350d2a6441d16f06b7ff9e2c0831b22d48e8def53efc57007955affee28d141e4236eaa4f5a6c8e4c50a8e5a39921082062fa98b6509dd78d6
|
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ module PlatformSdk
|
|
8
8
|
@auth = auth_client.nil? ? AuthClient.new(identity_base_url, client_id, client_secret) : auth_client
|
9
9
|
|
10
10
|
@conn = Faraday.new(identity_base_url) do |conn|
|
11
|
-
conn.request :authorization,
|
11
|
+
conn.request :authorization, 'Bearer', -> { @auth.auth_token }
|
12
12
|
conn.request :retry
|
13
13
|
conn.response :json
|
14
14
|
conn.adapter :net_http
|
@@ -50,12 +50,15 @@ module PlatformSdk
|
|
50
50
|
def post_payload(path, body)
|
51
51
|
with_rescue do
|
52
52
|
response = @conn.post(path, body)
|
53
|
-
response.body
|
53
|
+
response_body = response.body
|
54
|
+
return if response_body == ''
|
55
|
+
|
56
|
+
response_body.transform_keys!(&:to_sym)
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
57
60
|
def auth_token
|
58
|
-
@token = post_payload(
|
61
|
+
@token = post_payload('/connect/token', request_body) if expired?
|
59
62
|
|
60
63
|
@token[:access_token]
|
61
64
|
end
|
@@ -76,7 +79,7 @@ module PlatformSdk
|
|
76
79
|
end
|
77
80
|
|
78
81
|
def jwt_expiry_time(jwt)
|
79
|
-
Time.at(JWT.decode(jwt, nil, false)[0][
|
82
|
+
Time.at(JWT.decode(jwt, nil, false)[0]['exp'])
|
80
83
|
end
|
81
84
|
|
82
85
|
def refresh_session(session: {})
|
@@ -101,7 +104,7 @@ module PlatformSdk
|
|
101
104
|
def new_refresh_token(refresh_token)
|
102
105
|
raise ArgumentError if refresh_token.nil?
|
103
106
|
|
104
|
-
post_payload(
|
107
|
+
post_payload('/connect/token', request_body(grant_type: 'refresh_token', refresh_token:))
|
105
108
|
end
|
106
109
|
|
107
110
|
def raise_error_with_payload(exception_class, error)
|
@@ -117,7 +120,7 @@ module PlatformSdk
|
|
117
120
|
|
118
121
|
private
|
119
122
|
|
120
|
-
def request_body(grant_type:
|
123
|
+
def request_body(grant_type: 'client_credentials', refresh_token: nil)
|
121
124
|
return { grant_type:, client_id: @client_id, client_secret: @client_secret } if refresh_token.nil?
|
122
125
|
|
123
126
|
{ grant_type:, client_id: @client_id, client_secret: @client_secret, refresh_token: }
|
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.19.
|
4
|
+
version: 3.19.10
|
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-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|