ruby-sfn-local 0.1.9 → 0.1.12

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: c91b50b39f94e77840a25e9179e86fca730a556d7884fcee41997f76e6273ae0
4
- data.tar.gz: 36465c625f9169533a80018d4a5d3840bff585fcfac216b9ab43d0f8df933211
3
+ metadata.gz: 05122d4c47a198bda25cdb97029a921f3e84a081f2bab2283124c8ee4eefb102
4
+ data.tar.gz: 212f8edb5259942315dd586ed34c453618adc245164db27b307123b66d9f8ba5
5
5
  SHA512:
6
- metadata.gz: 3dfe1991cac8fdecccf933a4b83c1bd328875dc6b6fa236098ab0d64f79a5dc8a6adeba45e45987182b57c974957a7d01852d03dce23c284feb4ba9a907d31e5
7
- data.tar.gz: 3405576ab516b3d7f5f9f59478d8113ec31da189a01a2aa1ee255e0163b349991274e1b00c1310cb69cbd3047fafb8261cd0fed1ed0561653756ae99c24deceb
6
+ metadata.gz: 31b1037fbad8a590aa1df037ab4f57709666e462c8ef9cc05242de74d891461bde6eee0381eaac26b449ef3b7c5864d6df3b6fa7e55ba3403f0e2e9e6cfba77b
7
+ data.tar.gz: 128ab49678e6a0d6622811f7610d135ea89d054a2700f915efe40a8e6c37f2259afc84ea08f64c6ca30f72783f33f7b7b83d9fe27cf7168419d45f12037bf653
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sfn
4
+ module MockMacros
5
+ module Sqs
6
+ def self.response(data)
7
+ data = [data] if data.is_a?(Hash)
8
+ data.map! do |val|
9
+ if val.key?(:error)
10
+ { Throw: { Error: val[:error], Cause: val[:cause] } }
11
+ else
12
+ val[:uuid] ||= SecureRandom.uuid
13
+ val[:sequence] ||= 10_000_000_000_000_003_000
14
+ { Return: { MessageId: val[:uuid], SequenceNumber: val[:sequence] } }
15
+ end
16
+ end
17
+ out = {}
18
+ data.each_with_index do |val, idx|
19
+ out[idx.to_s] = val
20
+ end
21
+ out
22
+ end
23
+ end
24
+ end
25
+ end
@@ -4,6 +4,7 @@ require 'sfn/mock_macros/lambda'
4
4
  require 'sfn/mock_macros/step_function'
5
5
  require 'sfn/mock_macros/api_gateway'
6
6
  require 'sfn/mock_macros/sns'
7
+ require 'sfn/mock_macros/sqs'
7
8
 
8
9
  module Sfn
9
10
  module MockMacros
@@ -11,6 +12,7 @@ module Sfn
11
12
  include StepFunction
12
13
  include ApiGateway
13
14
  include Sns
15
+ include Sqs
14
16
 
15
17
  def self.gateway_response(data)
16
18
  ApiGateway.response(data)
@@ -24,6 +26,10 @@ module Sfn
24
26
  Sns.response(data)
25
27
  end
26
28
 
29
+ def self.sqs_response(data)
30
+ Sqs.response(data)
31
+ end
32
+
27
33
  def self.step_function_response(data)
28
34
  StepFunction.response(data)
29
35
  end
@@ -41,7 +41,7 @@ module Sfn
41
41
  end
42
42
 
43
43
  def run(mock_data = {}, input = {}, test_name = nil)
44
- test_name ||= OpenSSL::Digest::SHA512.digest(mock_data.merge(input).to_json)
44
+ test_name ||= OpenSSL::Digest::SHA512.digest(mock_data.merge({input: input}).to_json)
45
45
  executions[test_name] ||= Execution.call(self, test_name, mock_data, input)
46
46
  executions[test_name]
47
47
  end
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.9
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gianni Mazza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-23 00:00:00.000000000 Z
11
+ date: 2022-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-release
@@ -69,6 +69,7 @@ files:
69
69
  - lib/sfn/mock_macros/api_gateway.rb
70
70
  - lib/sfn/mock_macros/lambda.rb
71
71
  - lib/sfn/mock_macros/sns.rb
72
+ - lib/sfn/mock_macros/sqs.rb
72
73
  - lib/sfn/mock_macros/step_function.rb
73
74
  - lib/sfn/state_machine.rb
74
75
  - lib/string.rb