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: 8fd059415a17d9534e3ab85a15f4d42c7f270e12bbf50b3cbf8e1e9d16313b7a
4
- data.tar.gz: 64b7c124929f4885e36e0147c98e04cb08a60917688d5e89ee60043c0068698b
3
+ metadata.gz: d9993d2825db93d9add472070658ec947f669beb9d4b77c8154edc580773cfb7
4
+ data.tar.gz: 480dec8d1418deef7d29043f8cf92127942f76746310f74d98d968756bf9c60d
5
5
  SHA512:
6
- metadata.gz: a416bcf0410932c54f59b124e2402c5cf0f8a908adc984b41c81cede5a3d3af879ce3fb4e1dc7ed9412c7b9d4eb8bfa4badc2bdae2ea164f20e348d5f8cfa83d
7
- data.tar.gz: 2de6fb2a476dd6568fdde3a4db1ae6ddaab37297bcb847e51764d4f499facc5761052b388d7df4cd00fb4d4750c9b0a649ae73d89abb1598f1a9b340207e4fe3
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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.38"
4
+ VERSION = "0.1.39"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolf_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.38
4
+ version: 0.1.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Roncallo