forest_admin_datasource_rpc 1.30.6 → 1.30.7
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c5a03f300fb8dab7a351c182080c1cfa5d1e6caf146c8dc51946215abaeab12
|
|
4
|
+
data.tar.gz: b4fbee23d1fa05eb3f253c9941a88ccc05e6271f8c3cf2bab2886c3d447d3ab4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e57a128b27f532b16d95ab6d2e85ddb6b2f58edf0cec6e1f5a3496c9ea908bc0f319d951a702abe015a16f50a55810ae1e02837ff464f86dbc93c79e66338535
|
|
7
|
+
data.tar.gz: a3b3c92cea985dca4205cc77628e13778d86b3e15295c0230c43aa99a280c5ab9251f7eb8f764d71539528cdfbcee14f2a613b4864f59a416deb5ad45bb5f79b
|
|
@@ -32,16 +32,26 @@ module ForestAdminDatasourceRpc
|
|
|
32
32
|
|
|
33
33
|
# rubocop:disable Metrics/ParameterLists
|
|
34
34
|
def call_rpc(endpoint, caller: nil, method: :get, payload: nil, symbolize_keys: false, if_none_match: nil)
|
|
35
|
+
resp = call_rpc_raw(endpoint, caller: caller, method: method, payload: payload,
|
|
36
|
+
symbolize_keys: symbolize_keys, if_none_match: if_none_match)
|
|
37
|
+
return resp if resp == NotModified
|
|
38
|
+
|
|
39
|
+
resp.body
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def call_rpc_raw(endpoint, caller: nil, method: :get, payload: nil, symbolize_keys: false, if_none_match: nil)
|
|
35
43
|
response = make_request(endpoint, caller: caller, method: method, payload: payload,
|
|
36
44
|
symbolize_keys: symbolize_keys, if_none_match: if_none_match)
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
return NotModified if response.status == HTTP_NOT_MODIFIED
|
|
46
|
+
|
|
47
|
+
raise_appropriate_error(response) unless response.success?
|
|
39
48
|
|
|
49
|
+
response
|
|
50
|
+
end
|
|
40
51
|
# rubocop:enable Metrics/ParameterLists
|
|
41
52
|
|
|
42
53
|
def fetch_schema(endpoint, if_none_match: nil)
|
|
43
|
-
|
|
44
|
-
handle_response(response)
|
|
54
|
+
call_rpc(endpoint, method: :get, symbolize_keys: true, if_none_match: if_none_match)
|
|
45
55
|
end
|
|
46
56
|
|
|
47
57
|
private
|
|
@@ -111,13 +121,6 @@ module ForestAdminDatasourceRpc
|
|
|
111
121
|
OpenSSL::HMAC.hexdigest('SHA256', @auth_secret, timestamp)
|
|
112
122
|
end
|
|
113
123
|
|
|
114
|
-
def handle_response(response)
|
|
115
|
-
return response.body if response.success?
|
|
116
|
-
return NotModified if response.status == HTTP_NOT_MODIFIED
|
|
117
|
-
|
|
118
|
-
raise_appropriate_error(response)
|
|
119
|
-
end
|
|
120
|
-
|
|
121
124
|
def raise_appropriate_error(response)
|
|
122
125
|
error_body = parse_error_body(response)
|
|
123
126
|
status = response.status
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
require 'base64'
|
|
2
|
+
require 'cgi'
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'stringio'
|
|
2
5
|
|
|
3
6
|
module ForestAdminDatasourceRpc
|
|
4
7
|
class Collection < ForestAdminDatasourceToolkit::Collection
|
|
@@ -127,7 +130,12 @@ module ForestAdminDatasourceRpc
|
|
|
127
130
|
"Forwarding '#{@name}' action #{name} call to the Rpc agent on #{url}."
|
|
128
131
|
)
|
|
129
132
|
|
|
130
|
-
@client.
|
|
133
|
+
response = @client.call_rpc_raw(url, caller: caller, method: :post, payload: params,
|
|
134
|
+
symbolize_keys: true)
|
|
135
|
+
|
|
136
|
+
return build_file_result(response) if response.headers['x-forest-action-type'] == 'File'
|
|
137
|
+
|
|
138
|
+
response.body
|
|
131
139
|
end
|
|
132
140
|
|
|
133
141
|
def get_form(caller, name, data = nil, filter = nil, metas = nil)
|
|
@@ -176,5 +184,20 @@ module ForestAdminDatasourceRpc
|
|
|
176
184
|
end
|
|
177
185
|
end
|
|
178
186
|
end
|
|
187
|
+
|
|
188
|
+
def build_file_result(response)
|
|
189
|
+
response_headers_header = response.headers['x-forest-action-response-headers']
|
|
190
|
+
file_name_header = response.headers['x-forest-action-file-name']
|
|
191
|
+
|
|
192
|
+
result = {
|
|
193
|
+
type: 'File',
|
|
194
|
+
mime_type: response.headers['content-type'],
|
|
195
|
+
name: CGI.unescape(file_name_header.to_s),
|
|
196
|
+
stream: response.body.to_s
|
|
197
|
+
}
|
|
198
|
+
result[:response_headers] = JSON.parse(response_headers_header) if response_headers_header
|
|
199
|
+
|
|
200
|
+
result
|
|
201
|
+
end
|
|
179
202
|
end
|
|
180
203
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_datasource_rpc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.30.
|
|
4
|
+
version: 1.30.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthieu
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-05-
|
|
12
|
+
date: 2026-05-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: base64
|