Class: Simplerubysteps::Callback

Inherits:
State
  • Object
show all
Defined in:
lib/simplerubysteps/model.rb

Instance Attribute Summary

Attributes inherited from State

#name, #state_machine

Instance Method Summary collapse

Methods inherited from State

#[]=, #next=, #render

Constructor Details

#initialize(name) ⇒ Callback

Returns a new instance of Callback.



100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/simplerubysteps/model.rb', line 100

def initialize(name)
  super
  @dict[:Type] = "Task"
  @dict[:Resource] = "arn:aws:states:::lambda:invoke.waitForTaskToken"
  @dict[:Parameters] = {
    :FunctionName => function_name,
    :Payload => {
      :Task => name,
      "Input.$" => "$",
      "Token.$" => "$$.Task.Token",
    },
  }
end

Instance Method Details

#action(&action_block) ⇒ Object



114
115
116
# File 'lib/simplerubysteps/model.rb', line 114

def action(&action_block)
  @action_block = action_block
end

#perform_action(input, token) ⇒ Object



118
119
120
# File 'lib/simplerubysteps/model.rb', line 118

def perform_action(input, token)
  @action_block.call(input, token) if @action_block
end