ruby-sfn-local 0.1.13 → 0.1.14

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: 75dd7b0209a27d5fedaac3a899ab43ce8c9cc814ae8736e9ebfab57e11a81397
4
- data.tar.gz: a4caabe1ecab7fbae2b9a71d3ddd760f95c709813d67c67972248cd15d7628b8
3
+ metadata.gz: ebdc76d783d70c6ffd4a53ad77d2ccad609f51454b6d8888cc03b71c9d2a3f8a
4
+ data.tar.gz: 8d4bd280dab1cc12fb4bd2fb25995c6afb4096ed7862d65df6a7d7c10c57483c
5
5
  SHA512:
6
- metadata.gz: 46d027dcc3ba4688427c36f35ffd40c725a6edef9727320aea01c7c6c100f8dc2933dbe01437104d71546b037ea7830458dccb3e14b1be7cb443c47628077298
7
- data.tar.gz: 77cc4a235b5e881fac19faff75c9a36c2d57ef08b95a7c941d214bb823166db9149f9e53241a51436ec94c0d8e85965564dbe9caa0b40c3f2caae0fbe2a8fe02
6
+ metadata.gz: fff1c781578513f06501c8e01c25d72ea30ede3515170e17c4d86fa4f6d0fe6da27a6e0b26d87882c8152c4a343d3a65052b0ab30d183168799bc02d42cb2e41
7
+ data.tar.gz: 2df1e930018156d74acdfadc64d9c9f4bfa63a3c27190067562e556856cc982b1e8df4c8a7f1a554679912115527411043d56c5a733019ead05cd16c89313806
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sfn
4
+ module MockMacros
5
+ module OptimisedStepFunction
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[:output] ||= val[:payload]
13
+ val[:output] ||= val[:response]
14
+ { Return: { Output: val[:output], Status: 'SUCCEDED' } }
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
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'sfn/mock_macros/lambda'
4
+ require 'sfn/mock_macros/optimised_step_function'
4
5
  require 'sfn/mock_macros/step_function'
5
6
  require 'sfn/mock_macros/api_gateway'
6
7
  require 'sfn/mock_macros/sns'
@@ -9,6 +10,7 @@ require 'sfn/mock_macros/sqs'
9
10
  module Sfn
10
11
  module MockMacros
11
12
  include Lambda
13
+ include OptimisedStepFunction
12
14
  include StepFunction
13
15
  include ApiGateway
14
16
  include Sns
@@ -30,10 +32,14 @@ module Sfn
30
32
  Sqs.response(data)
31
33
  end
32
34
 
33
- def self.step_function_response(data)
35
+ def self.step_function_response(data, optimised = false)
34
36
  StepFunction.response(data)
35
37
  end
36
38
 
39
+ def self.optimised_step_function_response(data)
40
+ OptimisedStepFunction.response(data)
41
+ end
42
+
37
43
  def self.gateway_payload(data)
38
44
  warn '[DEPRECATION] `gateway_payload` is deprecated. Please use `gateway_response` instead.'
39
45
  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.13
4
+ version: 0.1.14
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-07-02 00:00:00.000000000 Z
11
+ date: 2022-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-release
@@ -68,6 +68,7 @@ files:
68
68
  - lib/sfn/mock_macros.rb
69
69
  - lib/sfn/mock_macros/api_gateway.rb
70
70
  - lib/sfn/mock_macros/lambda.rb
71
+ - lib/sfn/mock_macros/optimised_step_function.rb
71
72
  - lib/sfn/mock_macros/sns.rb
72
73
  - lib/sfn/mock_macros/sqs.rb
73
74
  - lib/sfn/mock_macros/step_function.rb