setsuzoku 0.14.6 → 0.14.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -13
- data/lib/setsuzoku/api_response.rb +5 -0
- data/lib/setsuzoku/api_strategy.rb +3 -2
- data/lib/setsuzoku/rspec/dynamic_spec_helper.rb +1 -1
- data/lib/setsuzoku/service/web_service/api_strategies/rest_strategy.rb +2 -2
- data/lib/setsuzoku/service/web_service/auth_strategies/strategy_can_use_tokens.rb +2 -0
- data/lib/setsuzoku/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ebd323b4c61479bb8a3dba4b979ddf121a1492b5aab8393f5fabd42c02a9755
|
4
|
+
data.tar.gz: 4ddfb9aecd477c2c418766cb5415498324ecfbe48e37fc1ebd005a0b54feade2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c0ee8c5930e4bdb6eb5ea4f7ef4f75febeea48e73ddde381b4f43d278d69aa9557f2111ab1c53a0dc986b1ae9053dea4e1ccab9711354ecc1f7c741bac19b68
|
7
|
+
data.tar.gz: 96a6814e10c5aef72829216c7b69869811c5ab7db98f1762b2c35658af7356675cde516d232d5367f2ed30a10b15031817879539dba897d244f7005dec053593
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
setsuzoku (0.14.
|
4
|
+
setsuzoku (0.14.9)
|
5
5
|
activesupport (>= 5.0, < 7)
|
6
6
|
faraday (~> 0.11)
|
7
7
|
nokogiri (~> 1.10)
|
@@ -10,7 +10,7 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (6.1.
|
13
|
+
activesupport (6.1.6)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
@@ -18,21 +18,23 @@ GEM
|
|
18
18
|
zeitwerk (~> 2.3)
|
19
19
|
addressable (2.7.0)
|
20
20
|
public_suffix (>= 2.0.2, < 5.0)
|
21
|
-
concurrent-ruby (1.1.
|
21
|
+
concurrent-ruby (1.1.10)
|
22
22
|
crack (0.4.3)
|
23
23
|
safe_yaml (~> 1.0.0)
|
24
24
|
diff-lcs (1.4.2)
|
25
|
-
faraday (0.17.
|
25
|
+
faraday (0.17.5)
|
26
26
|
multipart-post (>= 1.2, < 3)
|
27
27
|
hashdiff (1.0.1)
|
28
|
-
i18n (1.
|
28
|
+
i18n (1.10.0)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
|
-
|
30
|
+
mini_portile2 (2.8.0)
|
31
|
+
minitest (5.15.0)
|
31
32
|
multipart-post (2.1.1)
|
32
|
-
nokogiri (1.
|
33
|
+
nokogiri (1.13.6)
|
34
|
+
mini_portile2 (~> 2.8.0)
|
33
35
|
racc (~> 1.4)
|
34
36
|
public_suffix (4.0.5)
|
35
|
-
racc (1.
|
37
|
+
racc (1.6.0)
|
36
38
|
rake (10.5.0)
|
37
39
|
rspec (3.8.0)
|
38
40
|
rspec-core (~> 3.8.0)
|
@@ -48,17 +50,17 @@ GEM
|
|
48
50
|
rspec-support (~> 3.8.0)
|
49
51
|
rspec-support (3.8.3)
|
50
52
|
safe_yaml (1.0.5)
|
51
|
-
sorbet (0.5.
|
52
|
-
sorbet-static (= 0.5.
|
53
|
-
sorbet-runtime (0.5.
|
54
|
-
sorbet-static (0.5.
|
53
|
+
sorbet (0.5.10030)
|
54
|
+
sorbet-static (= 0.5.10030)
|
55
|
+
sorbet-runtime (0.5.10030)
|
56
|
+
sorbet-static (0.5.10030-universal-darwin-14)
|
55
57
|
tzinfo (2.0.4)
|
56
58
|
concurrent-ruby (~> 1.0)
|
57
59
|
webmock (3.8.0)
|
58
60
|
addressable (>= 2.3.6)
|
59
61
|
crack (>= 0.3.2)
|
60
62
|
hashdiff (>= 0.4.0, < 2.0.0)
|
61
|
-
zeitwerk (2.4
|
63
|
+
zeitwerk (2.5.4)
|
62
64
|
|
63
65
|
PLATFORMS
|
64
66
|
ruby
|
@@ -4,8 +4,13 @@
|
|
4
4
|
module Setsuzoku
|
5
5
|
# The generic API response object that all API responses should return.
|
6
6
|
class ApiResponse < T::Struct
|
7
|
+
# the formatted response object for use in the application.
|
7
8
|
prop :data, T.nilable(T.untyped), default: {}
|
9
|
+
# whether the API request "succeeded" -- atm this is simply whether we hit the 3rd-party and received any kind of response.
|
8
10
|
prop :success, T::Boolean, default: false
|
11
|
+
# the error from the request -- this needs to manage codes and error messages in the future.
|
9
12
|
prop :error, T.nilable(String), default: nil
|
13
|
+
# the full object of the request/response. this is primarily for debugging purposes.
|
14
|
+
prop :full_object, T::Hash[T.untyped, T.untyped], default: {}
|
10
15
|
end
|
11
16
|
end
|
@@ -70,6 +70,7 @@ module Setsuzoku
|
|
70
70
|
self.current_action = request.action
|
71
71
|
formatted_response = T.let(nil, T.nilable(T::Hash[Symbol, T.untyped]))
|
72
72
|
success = T.let(false, T::Boolean)
|
73
|
+
full_object = {}
|
73
74
|
exception = T.let(nil, T.nilable(Setsuzoku::Exception))
|
74
75
|
action_details = case strategy
|
75
76
|
when :auth
|
@@ -99,7 +100,7 @@ module Setsuzoku
|
|
99
100
|
)
|
100
101
|
end
|
101
102
|
|
102
|
-
{
|
103
|
+
full_object = {
|
103
104
|
success: success,
|
104
105
|
plugin: self.plugin,
|
105
106
|
request: request,
|
@@ -110,7 +111,7 @@ module Setsuzoku
|
|
110
111
|
}
|
111
112
|
end
|
112
113
|
self.current_action = nil
|
113
|
-
ApiResponse.new(data: formatted_response, success: success)
|
114
|
+
ApiResponse.new(data: formatted_response, success: success, full_object: full_object)
|
114
115
|
end
|
115
116
|
|
116
117
|
# Parse the response from the API for the given request.
|
@@ -126,8 +126,8 @@ module Setsuzoku
|
|
126
126
|
# Faraday expects get requests params to be a hash
|
127
127
|
params
|
128
128
|
elsif request_properties[:req_params].empty?
|
129
|
-
if request_properties[:request_method]
|
130
|
-
params.to_json # Faraday doesn't support an empty hash for PUT requests
|
129
|
+
if %i[put patch post].include?(request_properties[:request_method])
|
130
|
+
params.to_json # Faraday doesn't support an empty hash for PUT/PATCH/POST requests
|
131
131
|
else
|
132
132
|
params # Faraday supports empty hashes for other request types...
|
133
133
|
end
|
@@ -138,6 +138,8 @@ module Setsuzoku
|
|
138
138
|
def get_token!(body, action)
|
139
139
|
success = false
|
140
140
|
without_headers = self.credential.auth_actions[action].has_key?(:without_headers) ? self.credential.auth_actions[action][:without_headers] : true
|
141
|
+
body.merge!(self.credential.auth_actions[action][:body]) if self.credential.auth_actions[action].has_key?(:body)
|
142
|
+
|
141
143
|
request = self.api_strategy.request_class.new(action: action, body: body, without_headers: without_headers)
|
142
144
|
|
143
145
|
resp = self.api_strategy.call_external_api(request: request, strategy: :auth)
|
data/lib/setsuzoku/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: setsuzoku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Stadtler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -227,7 +227,7 @@ homepage: https://github.com/rocketreferrals/setsuzoku
|
|
227
227
|
licenses:
|
228
228
|
- MIT
|
229
229
|
metadata: {}
|
230
|
-
post_install_message:
|
230
|
+
post_install_message:
|
231
231
|
rdoc_options: []
|
232
232
|
require_paths:
|
233
233
|
- lib
|
@@ -242,8 +242,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
242
|
- !ruby/object:Gem::Version
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
|
-
rubygems_version: 3.0.1
|
246
|
-
signing_key:
|
245
|
+
rubygems_version: 3.0.3.1
|
246
|
+
signing_key:
|
247
247
|
specification_version: 4
|
248
248
|
summary: Extensible 3rd-party interface and functionality plugins
|
249
249
|
test_files: []
|