strongmind-platform-sdk 3.10.1 → 3.10.3
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 +22 -22
- data/lib/platform_sdk/identity/clients.rb +29 -7
- data/lib/platform_sdk/identity.rb +3 -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: c54bdffdbc7b3419bc8098a873515ae18e3ed9a5a71e9f59779f633d029a37bd
|
4
|
+
data.tar.gz: 0a414cf9994dc87344960f47e21813c24633200c0f274bc3158a0783143959dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca18372549c1271f58322ede653e46160354d73448dab97789bc57ad8485e12f16d81378c536ae6cfb2c222cc31bdcfedce9035cf84e5b07496abd8593537600
|
7
|
+
data.tar.gz: 9747e4ca7a24f088e208ded3b9b6e3a36de49a8431946b9cdf76727ce54d4f4b031a6febaeea38c589ee74fe04496cd513aba03704e53da645afb027c6fd9662
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
strongmind-platform-sdk (3.10.
|
4
|
+
strongmind-platform-sdk (3.10.3)
|
5
5
|
aws-sdk-secretsmanager (~> 1.66)
|
6
6
|
devise
|
7
7
|
faraday (~> 2.5, >= 2.5.2)
|
@@ -19,33 +19,34 @@ PATH
|
|
19
19
|
GEM
|
20
20
|
remote: https://rubygems.org/
|
21
21
|
specs:
|
22
|
-
actionpack (7.
|
23
|
-
actionview (= 7.
|
24
|
-
activesupport (= 7.
|
25
|
-
rack (~> 2.0, >= 2.
|
22
|
+
actionpack (6.1.7.7)
|
23
|
+
actionview (= 6.1.7.7)
|
24
|
+
activesupport (= 6.1.7.7)
|
25
|
+
rack (~> 2.0, >= 2.0.9)
|
26
26
|
rack-test (>= 0.6.3)
|
27
27
|
rails-dom-testing (~> 2.0)
|
28
28
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
29
|
-
actionview (7.
|
30
|
-
activesupport (= 7.
|
29
|
+
actionview (6.1.7.7)
|
30
|
+
activesupport (= 6.1.7.7)
|
31
31
|
builder (~> 3.1)
|
32
32
|
erubi (~> 1.4)
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
34
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
35
|
-
activemodel (7.
|
36
|
-
activesupport (= 7.
|
37
|
-
activesupport (7.
|
35
|
+
activemodel (6.1.7.7)
|
36
|
+
activesupport (= 6.1.7.7)
|
37
|
+
activesupport (6.1.7.7)
|
38
38
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
39
39
|
i18n (>= 1.6, < 2)
|
40
40
|
minitest (>= 5.1)
|
41
41
|
tzinfo (~> 2.0)
|
42
|
+
zeitwerk (~> 2.3)
|
42
43
|
addressable (2.8.6)
|
43
44
|
public_suffix (>= 2.0.2, < 6.0)
|
44
45
|
aes_key_wrap (1.1.0)
|
45
46
|
ast (2.4.2)
|
46
47
|
attr_required (1.0.2)
|
47
48
|
aws-eventstream (1.3.0)
|
48
|
-
aws-partitions (1.
|
49
|
+
aws-partitions (1.896.0)
|
49
50
|
aws-sdk-core (3.191.3)
|
50
51
|
aws-eventstream (~> 1, >= 1.3.0)
|
51
52
|
aws-partitions (~> 1, >= 1.651.0)
|
@@ -61,7 +62,7 @@ GEM
|
|
61
62
|
bigdecimal (3.1.6)
|
62
63
|
bindata (2.5.0)
|
63
64
|
builder (3.2.4)
|
64
|
-
concurrent-ruby (1.2.
|
65
|
+
concurrent-ruby (1.2.3)
|
65
66
|
crack (1.0.0)
|
66
67
|
bigdecimal
|
67
68
|
rexml
|
@@ -79,9 +80,9 @@ GEM
|
|
79
80
|
erubi (1.12.0)
|
80
81
|
ethon (0.16.0)
|
81
82
|
ffi (>= 1.15.0)
|
82
|
-
factory_bot (6.
|
83
|
+
factory_bot (6.4.5)
|
83
84
|
activesupport (>= 5.0.0)
|
84
|
-
faker (
|
85
|
+
faker (2.22.0)
|
85
86
|
i18n (>= 1.8.11, < 2)
|
86
87
|
faraday (2.7.7)
|
87
88
|
faraday-net_http (>= 2.0, < 3.1)
|
@@ -94,11 +95,11 @@ GEM
|
|
94
95
|
ffi (1.15.5)
|
95
96
|
hashdiff (1.1.0)
|
96
97
|
hashie (5.0.0)
|
97
|
-
i18n (1.
|
98
|
+
i18n (1.14.1)
|
98
99
|
concurrent-ruby (~> 1.0)
|
99
100
|
jmespath (1.6.2)
|
100
101
|
json (2.6.3)
|
101
|
-
json-jwt (1.16.
|
102
|
+
json-jwt (1.16.6)
|
102
103
|
activesupport (>= 4.2)
|
103
104
|
aes_key_wrap
|
104
105
|
base64
|
@@ -119,7 +120,7 @@ GEM
|
|
119
120
|
method_source (1.0.0)
|
120
121
|
mini_mime (1.1.5)
|
121
122
|
mini_portile2 (2.8.5)
|
122
|
-
minitest (5.
|
123
|
+
minitest (5.22.2)
|
123
124
|
multi_json (1.15.0)
|
124
125
|
net-imap (0.4.10)
|
125
126
|
date
|
@@ -186,13 +187,12 @@ GEM
|
|
186
187
|
rails-html-sanitizer (1.6.0)
|
187
188
|
loofah (~> 2.21)
|
188
189
|
nokogiri (~> 1.14)
|
189
|
-
railties (7.
|
190
|
-
actionpack (= 7.
|
191
|
-
activesupport (= 7.
|
190
|
+
railties (6.1.7.7)
|
191
|
+
actionpack (= 6.1.7.7)
|
192
|
+
activesupport (= 6.1.7.7)
|
192
193
|
method_source
|
193
194
|
rake (>= 12.2)
|
194
195
|
thor (~> 1.0)
|
195
|
-
zeitwerk (~> 2.5)
|
196
196
|
rainbow (3.1.1)
|
197
197
|
rake (13.0.6)
|
198
198
|
regexp_parser (2.8.0)
|
@@ -239,7 +239,7 @@ GEM
|
|
239
239
|
faraday-follow_redirects
|
240
240
|
sys-uname (1.2.3)
|
241
241
|
ffi (~> 1.1)
|
242
|
-
thor (1.3.
|
242
|
+
thor (1.3.1)
|
243
243
|
timeout (0.4.1)
|
244
244
|
typhoeus (1.4.0)
|
245
245
|
ethon (>= 0.9.0)
|
@@ -17,7 +17,7 @@ module PlatformSdk
|
|
17
17
|
|
18
18
|
def with_rescue
|
19
19
|
yield
|
20
|
-
rescue
|
20
|
+
rescue ResourceNotFound => e
|
21
21
|
puts e
|
22
22
|
end
|
23
23
|
end
|
@@ -37,11 +37,23 @@ module PlatformSdk
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
def with_rescue
|
41
|
+
yield
|
42
|
+
rescue Faraday::ServerError => e
|
43
|
+
raise_error_with_payload(ServerError, e)
|
44
|
+
rescue Faraday::ClientError => e
|
45
|
+
raise_error_with_payload(ClientError, e)
|
46
|
+
end
|
47
|
+
|
48
|
+
def post_payload(path, body)
|
49
|
+
with_rescue do
|
50
|
+
response = @conn.post(path, body)
|
51
|
+
response.body.transform_keys!(&:to_sym)
|
44
52
|
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def auth_token
|
56
|
+
@token = post_payload("/connect/token", request_body) if expired?
|
45
57
|
|
46
58
|
@token[:access_token]
|
47
59
|
end
|
@@ -75,9 +87,8 @@ module PlatformSdk
|
|
75
87
|
def refresh_token(refresh_token)
|
76
88
|
raise ArgumentError if refresh_token.nil?
|
77
89
|
|
78
|
-
|
90
|
+
post_payload("/connect/token", request_body(
|
79
91
|
grant_type: "refresh_token", refresh_token:))
|
80
|
-
response.body.transform_keys!(&:to_sym)
|
81
92
|
end
|
82
93
|
|
83
94
|
def refresh_session(session: {})
|
@@ -92,6 +103,17 @@ module PlatformSdk
|
|
92
103
|
session[:refresh_token] = refreshed_tokens[:refresh_token]
|
93
104
|
end
|
94
105
|
|
106
|
+
def raise_error_with_payload(exception_class, error)
|
107
|
+
json_log = {
|
108
|
+
exception: exception_class.new.class.name.demodulize,
|
109
|
+
payload: error.response.dig(:request, :body),
|
110
|
+
response_body: error.response[:body],
|
111
|
+
status: error.response[:status]
|
112
|
+
}.compact
|
113
|
+
Rails.logger.info json_log.to_json if respond_to?(:Rails)
|
114
|
+
raise exception_class, error.response
|
115
|
+
end
|
116
|
+
|
95
117
|
private
|
96
118
|
|
97
119
|
def request_body(grant_type: "client_credentials", refresh_token: nil)
|
@@ -10,6 +10,8 @@ require "platform_sdk/identity/clients"
|
|
10
10
|
|
11
11
|
module PlatformSdk
|
12
12
|
module Identity
|
13
|
-
class
|
13
|
+
class ResourceNotFound < Faraday::ResourceNotFound; end
|
14
|
+
class ServerError < Faraday::ServerError; end
|
15
|
+
class ClientError < Faraday::ClientError; end
|
14
16
|
end
|
15
17
|
end
|
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.10.
|
4
|
+
version: 3.10.3
|
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-
|
11
|
+
date: 2024-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|