wolf_core 1.0.2 → 1.0.4

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: 713728dd5e1dcb51f570691d0c6db147a43aa3ca51641b8a4ae041c34f3a2444
4
- data.tar.gz: f2633bf41157b9e4f4003bac49bf49e1a1ce9c6a40f5551ec0974702733bf396
3
+ metadata.gz: 35aeeac3f51bc3fbbe02a1d7148d2d33da262ead551290abe5576ad667b35c0f
4
+ data.tar.gz: 23ee8419964b3d6e5771b1177ef1d43b51024c42f466feb7774c490a79fb0f7e
5
5
  SHA512:
6
- metadata.gz: 75e0dbf1afad256967de638b6b680ede71cf3c98fb7424bfa73915dd5843c94764b7c5a19f240d7821283c2de2e6c4a4c84233212c8f91a4db9abb8e65095109
7
- data.tar.gz: 65097203aeda8d2f63ca98b3ab74141e325fe11364dfa9eece70cb9850a69783d56ba17f076ad177adc2cd94d1dcdc8c96c9910d6fa1fcdd4ae4bf2e55397f51
6
+ metadata.gz: 4eddb905a05b63ae58e27882c4d7ef227c7684de1e95816448052471e590510ebc95a35beea29b34c8ca11db29b6fd24fda4de912e0527458090b111188a22c2
7
+ data.tar.gz: 56d83567fe97d018747f635d7df6ba07c2419d829e191021260d0be116c809bc388ec09f37478e2c71210e10029da88a32bbc7554a30b5bd5341338f736b0d9d
@@ -34,7 +34,7 @@ module WolfCore
34
34
  WolfCore::HttpDataSource.http_get(url: url, headers: headers, query: query)
35
35
  end
36
36
 
37
- def parsed_http_post(url:, body:, headers: {}, query: nil)
37
+ def parsed_http_post(url:, body: nil, headers: {}, query: nil)
38
38
  response = http_post(url: url, headers: headers, query: query, body: body)
39
39
  parse_http_response(response)
40
40
  end
@@ -65,7 +65,7 @@ module WolfCore
65
65
  WolfCore::HttpDataSource.http_post(url: url, headers: headers, query: query, body: body)
66
66
  end
67
67
 
68
- def parsed_http_put(url:, body:, headers: {}, query: nil)
68
+ def parsed_http_put(url:, body: nil, headers: {}, query: nil)
69
69
  response = http_put(url: url, headers: headers, query: query, body: body)
70
70
  parse_http_response(response)
71
71
  end
@@ -1,6 +1,7 @@
1
1
  module WolfCore
2
2
  module LambdaFunctionOperations
3
3
  include WolfCore::ExceptionOperations
4
+ include WolfCore::StringUtils
4
5
 
5
6
  def invoke_lambda(function_name:, payload:, invocation_type: nil)
6
7
  WolfCore::LambdaFunctionDataSource.invoke(
@@ -28,20 +29,12 @@ module WolfCore
28
29
 
29
30
  def get_event_params(event)
30
31
  event_body = event['body']
31
- return deep_parse_json(event_body) if event_body.present?
32
- event.with_indifferent_access
33
- end
34
-
35
- def deep_parse_json(input)
36
- while input.is_a?(String)
37
- begin
38
- input = JSON.parse(input)
39
- rescue JSON::ParserError
40
- break
41
- end
32
+ params = if event_body.present?
33
+ deep_parse_json(event_body)
34
+ else
35
+ event
42
36
  end
43
-
44
- input&.with_indifferent_access || {}
37
+ params&.with_indifferent_access
45
38
  end
46
39
 
47
40
  def result_to_response(result)
@@ -19,5 +19,17 @@ module WolfCore
19
19
  def hash_str_to_json(hash_str)
20
20
  hash_str&.gsub('=>', ':')&.gsub('\"', '"')&.gsub('{', '{')&.gsub('}', '}')&.gsub(/(\w+)(?=\s*:)/) { |key| "\"#{key}\"" }
21
21
  end
22
+
23
+ def deep_parse_json(input)
24
+ while input.is_a?(String)
25
+ begin
26
+ input = JSON.parse(input)
27
+ rescue JSON::ParserError
28
+ break
29
+ end
30
+ end
31
+
32
+ input || {}
33
+ end
22
34
  end
23
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "1.0.2"
4
+ VERSION = "1.0.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolf_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Roncallo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-15 00:00:00.000000000 Z
11
+ date: 2024-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty