wolf_core 0.1.38 → 0.1.39
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9993d2825db93d9add472070658ec947f669beb9d4b77c8154edc580773cfb7
|
4
|
+
data.tar.gz: 480dec8d1418deef7d29043f8cf92127942f76746310f74d98d968756bf9c60d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98431290eb6036ae6e110512166dc7686e135cda326773165847e9e38cbcf27aa64ff2793359b64a16d277172f94ce1cff403b372ec3def52db3bd673063d9d0
|
7
|
+
data.tar.gz: e246d96a114bf130c7d28db02b27a021af4b173d01f4a12bdd5efbb185f64b1f567b64a6e1c9ab45a4923d878fe670dfdea95fed4d43fbfe6b49600b073379c8
|
@@ -1,11 +1,31 @@
|
|
1
1
|
module WolfCore
|
2
2
|
module LambdaFunctionOperations
|
3
|
+
include WolfCore::ExceptionOperations
|
4
|
+
|
3
5
|
def invoke_lambda(function_name:, payload:, invocation_type: nil)
|
4
6
|
WolfCore::LambdaFunctionDataSource.invoke(
|
5
7
|
function_name: function_name, payload: payload, invocation_type: invocation_type
|
6
8
|
)
|
7
9
|
end
|
8
10
|
|
11
|
+
def validate_lambda_response(response:, message:, error_data: nil)
|
12
|
+
unless response.status_code == 200
|
13
|
+
error_data = {
|
14
|
+
message: message,
|
15
|
+
response: parse_lambda_response(response)
|
16
|
+
}.merge(error_data || {})
|
17
|
+
raise_service_error(error_data)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def parse_lambda_response(response)
|
22
|
+
payload = JSON.parse(response.payload.string) rescue response.payload
|
23
|
+
OpenStruct.new({
|
24
|
+
status_code: response.status_code,
|
25
|
+
payload: payload,
|
26
|
+
})
|
27
|
+
end
|
28
|
+
|
9
29
|
def get_event_params(event)
|
10
30
|
event_body = event['body']
|
11
31
|
return deep_parse_json(event_body) if event_body.present?
|
data/lib/wolf_core/version.rb
CHANGED