ruby-sfn-local 0.1.30 → 0.1.32

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: 5f39a29fcb4267d151c127c9cb1bb087225f8bfcec17fcbd86fae7e728509472
4
- data.tar.gz: 96cf6b8922ef7b7bdb6a77fef72f985bd8212f6386f13a214fa8955fd5f62ccb
3
+ metadata.gz: d68a321378807a1a11249950ebb400f5f33a8c3d662306566ef3aede826d18ff
4
+ data.tar.gz: 919713ecbec3594d08e5700105995772753ebcefcffdbc916d3c671b0d70c524
5
5
  SHA512:
6
- metadata.gz: 02cd2a8099569ab7e0cbf86f38b5b95ac325b8ae3912b406709d93bdf09f70d24f82e63da8c7ace09204d4354d47ab5838c9163034548f8c52cab59f9fa73130
7
- data.tar.gz: d40f6ee1da4a101fe4e8e226b450518f24784dcda34e93c5de918b5231a05c71da280fb25df51e12a17c0d5b61b54510cb5550d066ac9ff86e4c0ef6a9d2f028
6
+ metadata.gz: 7eef4da764b91790dc86510487a6a19752732928e986f95e86585a4edc92197fe5fa588032cade13eab2bbec0b7ae9e78a8ef2ed0de01e0425c01836a9903f10
7
+ data.tar.gz: cdc8c3f006170f605636d555fde249e602e9eda30e2c0c7c49021e5ad3f792dc909e3a720f993c32d5cc5e36a941d63b88365ad66b70ab21985241284748e96b
@@ -5,7 +5,7 @@ module Sfn
5
5
  module ApiGateway
6
6
  def self.response(data)
7
7
  data = [data] if data.is_a?(Hash)
8
- data.map! do |val|
8
+ out_data = data.map do |val|
9
9
  if val.key?(:error)
10
10
  { Throw: { Error: val[:error], Cause: val[:cause] } }
11
11
  else
@@ -16,7 +16,7 @@ module Sfn
16
16
  end
17
17
  end
18
18
  out = {}
19
- data.each_with_index do |val, idx|
19
+ out_data.each_with_index do |val, idx|
20
20
  out[idx.to_s] = val
21
21
  end
22
22
  out
@@ -5,7 +5,7 @@ module Sfn
5
5
  module Lambda
6
6
  def self.response(data)
7
7
  data = [data] if data.is_a?(Hash)
8
- data.map! do |val|
8
+ out_data = data.map do |val|
9
9
  if val.key?(:error)
10
10
  { Throw: { Error: val[:error], Cause: val[:cause] } }
11
11
  else
@@ -15,7 +15,7 @@ module Sfn
15
15
  end
16
16
  end
17
17
  out = {}
18
- data.each_with_index do |val, idx|
18
+ out_data.each_with_index do |val, idx|
19
19
  out[idx.to_s] = val
20
20
  end
21
21
  out
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sfn
4
+ module MockMacros
5
+ module NativeIntegration
6
+ def self.response(data)
7
+ data = [data] if data.is_a?(Hash)
8
+ out_data = data.map do |val|
9
+ if val.key?(:error)
10
+ { Throw: { Error: val[:error], Cause: val[:cause] } }
11
+ else
12
+ { Return: val }
13
+ end
14
+ end
15
+ out = {}
16
+ out_data.each_with_index do |val, idx|
17
+ out[idx.to_s] = val
18
+ end
19
+ out
20
+ end
21
+ end
22
+ end
23
+ end
@@ -5,7 +5,7 @@ module Sfn
5
5
  module OptimisedStepFunction
6
6
  def self.response(data)
7
7
  data = [data] if data.is_a?(Hash)
8
- data.map! do |val|
8
+ out_data = data.map do |val|
9
9
  if val.key?(:error)
10
10
  { Throw: { Error: val[:error], Cause: val[:cause] } }
11
11
  else
@@ -15,7 +15,7 @@ module Sfn
15
15
  end
16
16
  end
17
17
  out = {}
18
- data.each_with_index do |val, idx|
18
+ out_data.each_with_index do |val, idx|
19
19
  out[idx.to_s] = val
20
20
  end
21
21
  out
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sfn
4
+ module MockMacros
5
+ module SdkIntegration
6
+ def self.response(data)
7
+ data = [data] if data.is_a?(Hash)
8
+ out_data = data.map do |val|
9
+ { Return: val.to_json }
10
+ end
11
+ out = {}
12
+ out_data.each_with_index do |val, idx|
13
+ out[idx.to_s] = val
14
+ end
15
+ out
16
+ end
17
+ end
18
+ end
19
+ end
@@ -5,7 +5,7 @@ module Sfn
5
5
  module SecretsManager
6
6
  def self.response(data)
7
7
  data = [data] if data.is_a?(Hash)
8
- data.map! do |val|
8
+ out_data = data.map do |val|
9
9
  if val.key?(:error)
10
10
  { Throw: { Error: val[:error], Cause: val[:cause] } }
11
11
  else
@@ -15,7 +15,7 @@ module Sfn
15
15
  end
16
16
  end
17
17
  out = {}
18
- data.each_with_index do |val, idx|
18
+ out_data.each_with_index do |val, idx|
19
19
  out[idx.to_s] = val
20
20
  end
21
21
  out
@@ -5,7 +5,7 @@ module Sfn
5
5
  module Sns
6
6
  def self.response(data)
7
7
  data = [data] if data.is_a?(Hash)
8
- data.map! do |val|
8
+ out_data = data.map do |val|
9
9
  if val.key?(:error)
10
10
  { Throw: { Error: val[:error], Cause: val[:cause] } }
11
11
  else
@@ -15,7 +15,7 @@ module Sfn
15
15
  end
16
16
  end
17
17
  out = {}
18
- data.each_with_index do |val, idx|
18
+ out_data.each_with_index do |val, idx|
19
19
  out[idx.to_s] = val
20
20
  end
21
21
  out
@@ -5,7 +5,7 @@ module Sfn
5
5
  module Sqs
6
6
  def self.response(data)
7
7
  data = [data] if data.is_a?(Hash)
8
- data.map! do |val|
8
+ out_data = data.map do |val|
9
9
  if val.key?(:error)
10
10
  { Throw: { Error: val[:error], Cause: val[:cause] } }
11
11
  else
@@ -15,7 +15,7 @@ module Sfn
15
15
  end
16
16
  end
17
17
  out = {}
18
- data.each_with_index do |val, idx|
18
+ out_data.each_with_index do |val, idx|
19
19
  out[idx.to_s] = val
20
20
  end
21
21
  out
@@ -5,7 +5,7 @@ module Sfn
5
5
  module StepFunction
6
6
  def self.response(data)
7
7
  data = [data] if data.is_a?(Hash)
8
- data.map! do |val|
8
+ out_data = data.map do |val|
9
9
  if val.key?(:error)
10
10
  { Return: { Error: val[:error], Cause: val[:cause], Status: 'FAILED' } }
11
11
  else
@@ -15,7 +15,7 @@ module Sfn
15
15
  end
16
16
  end
17
17
  out = {}
18
- data.each_with_index do |val, idx|
18
+ out_data.each_with_index do |val, idx|
19
19
  out[idx.to_s] = val
20
20
  end
21
21
  out
@@ -1,21 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'sfn/mock_macros/api_gateway'
3
4
  require 'sfn/mock_macros/lambda'
5
+ require 'sfn/mock_macros/native_integration'
4
6
  require 'sfn/mock_macros/optimised_step_function'
7
+ require 'sfn/mock_macros/sdk_integration'
8
+ require 'sfn/mock_macros/secrets_manager'
5
9
  require 'sfn/mock_macros/step_function'
6
- require 'sfn/mock_macros/api_gateway'
7
10
  require 'sfn/mock_macros/sns'
8
11
  require 'sfn/mock_macros/sqs'
9
- require 'sfn/mock_macros/secrets_manager'
10
12
 
11
13
  module Sfn
12
14
  module MockMacros
15
+ include ApiGateway
13
16
  include Lambda
17
+ include NativeIntegration
14
18
  include OptimisedStepFunction
15
- include StepFunction
16
- include ApiGateway
19
+ include SdkIntegration
20
+ include SecretsManager
17
21
  include Sns
18
22
  include Sqs
23
+ include StepFunction
19
24
 
20
25
  def self.gateway_response(data)
21
26
  ApiGateway.response(data)
@@ -25,6 +30,22 @@ module Sfn
25
30
  Lambda.response(data)
26
31
  end
27
32
 
33
+ def self.native_integration_response(data)
34
+ NativeIntegration.response(data)
35
+ end
36
+
37
+ def self.optimised_step_function_response(data)
38
+ OptimisedStepFunction.response(data)
39
+ end
40
+
41
+ def self.sdk_integration_response(data)
42
+ SdkIntegration.response(data)
43
+ end
44
+
45
+ def self.secrets_manager_response(data)
46
+ SecretsManager.response(data)
47
+ end
48
+
28
49
  def self.sns_response(data)
29
50
  Sns.response(data)
30
51
  end
@@ -35,16 +56,8 @@ module Sfn
35
56
 
36
57
  def self.step_function_response(data, _optimised = false)
37
58
  StepFunction.response(data)
38
- end
39
-
40
- def self.optimised_step_function_response(data)
41
- OptimisedStepFunction.response(data)
42
59
  end
43
60
 
44
- def self.secrets_manager_response(data)
45
- SecretsManager.response(data)
46
- end
47
-
48
61
  def self.gateway_payload(data)
49
62
  warn '[DEPRECATION] `gateway_payload` is deprecated. Please use `gateway_response` instead.'
50
63
  ApiGateway.response(data)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-sfn-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.30
4
+ version: 0.1.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gianni Mazza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-31 00:00:00.000000000 Z
11
+ date: 2023-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-release
@@ -69,7 +69,9 @@ files:
69
69
  - lib/sfn/mock_macros.rb
70
70
  - lib/sfn/mock_macros/api_gateway.rb
71
71
  - lib/sfn/mock_macros/lambda.rb
72
+ - lib/sfn/mock_macros/native_integration.rb
72
73
  - lib/sfn/mock_macros/optimised_step_function.rb
74
+ - lib/sfn/mock_macros/sdk_integration.rb
73
75
  - lib/sfn/mock_macros/secrets_manager.rb
74
76
  - lib/sfn/mock_macros/sns.rb
75
77
  - lib/sfn/mock_macros/sqs.rb