setsuzoku 0.14.7 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -16
- 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 +7 -4
- 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: 113d13e0305fa193bb0a433ff116d5c0edb874eb8fe4f2cf29e67ee94aef5c35
|
4
|
+
data.tar.gz: cc375d2b21ec798a44759ffde0949a389cdf982dfb89046b98e48b19b5abe416
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f178c75650965ab61a221ac0f6c89d4664536e311545f7b85e7e8f687e30cf7ea53f434ad0d129fffd7f04a8e7ac21641e0be5b588a60dc713e2a3f5c5f6905b
|
7
|
+
data.tar.gz: dffed87de3ee9c1e622d03bba857c5e21048585a5c64ebec3281c7e804e7abf312c5bac335cf8fb600a37fcc46f34259cfa82ed4e1da7e7f24ee0d5f95c35d6f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
setsuzoku (0.
|
4
|
+
setsuzoku (0.15.0)
|
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,23 +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
|
-
mini_portile2 (2.
|
31
|
-
minitest (5.
|
32
|
-
multipart-post (2.
|
33
|
-
nokogiri (1.
|
34
|
-
mini_portile2 (~> 2.
|
30
|
+
mini_portile2 (2.8.0)
|
31
|
+
minitest (5.16.1)
|
32
|
+
multipart-post (2.2.3)
|
33
|
+
nokogiri (1.13.6)
|
34
|
+
mini_portile2 (~> 2.8.0)
|
35
35
|
racc (~> 1.4)
|
36
36
|
public_suffix (4.0.5)
|
37
|
-
racc (1.
|
37
|
+
racc (1.6.0)
|
38
38
|
rake (10.5.0)
|
39
39
|
rspec (3.8.0)
|
40
40
|
rspec-core (~> 3.8.0)
|
@@ -50,17 +50,17 @@ GEM
|
|
50
50
|
rspec-support (~> 3.8.0)
|
51
51
|
rspec-support (3.8.3)
|
52
52
|
safe_yaml (1.0.5)
|
53
|
-
sorbet (0.5.
|
54
|
-
sorbet-static (= 0.5.
|
55
|
-
sorbet-runtime (0.5.
|
56
|
-
sorbet-static (0.5.
|
53
|
+
sorbet (0.5.10030)
|
54
|
+
sorbet-static (= 0.5.10030)
|
55
|
+
sorbet-runtime (0.5.10125)
|
56
|
+
sorbet-static (0.5.10030-universal-darwin-14)
|
57
57
|
tzinfo (2.0.4)
|
58
58
|
concurrent-ruby (~> 1.0)
|
59
59
|
webmock (3.8.0)
|
60
60
|
addressable (>= 2.3.6)
|
61
61
|
crack (>= 0.3.2)
|
62
62
|
hashdiff (>= 0.4.0, < 2.0.0)
|
63
|
-
zeitwerk (2.
|
63
|
+
zeitwerk (2.6.0)
|
64
64
|
|
65
65
|
PLATFORMS
|
66
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.
|
@@ -57,11 +57,13 @@ module Setsuzoku
|
|
57
57
|
end
|
58
58
|
faraday.adapter Faraday.default_adapter
|
59
59
|
end
|
60
|
-
|
61
|
-
if
|
60
|
+
attachment_urls = options[:attachment_url] || options[:attachment_urls]
|
61
|
+
if attachment_urls.present?
|
62
62
|
resp = @faraday.post do |req|
|
63
63
|
payload = {}
|
64
|
-
|
64
|
+
# create an array to just iterate over for 1 or many urls
|
65
|
+
attachment_urls = [attachment_urls] if options[:attachment_url]
|
66
|
+
attachments = attachment_urls.map do |url|
|
65
67
|
image = open(url, 'rb')
|
66
68
|
Faraday::UploadIO.new(image, T.must(image).content_type, File.basename(url))
|
67
69
|
end
|
@@ -70,7 +72,8 @@ module Setsuzoku
|
|
70
72
|
else
|
71
73
|
payload.merge!(full_request)
|
72
74
|
end
|
73
|
-
|
75
|
+
# if using the singular "attachment_url" key pull out the first item
|
76
|
+
payload[options[:attachment_url_key]] = options[:attachment_url] ? attachments.first : attachments
|
74
77
|
req.body = payload
|
75
78
|
end
|
76
79
|
else
|
@@ -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.
|
4
|
+
version: 0.15.0
|
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-06-27 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: []
|