Class: Webhookdb::Replicator::StateMachineStep
- Inherits:
-
Object
- Object
- Webhookdb::Replicator::StateMachineStep
- Defined in:
- lib/webhookdb/replicator/state_machine_step.rb
Instance Attribute Summary collapse
-
#complete ⇒ Object
Returns the value of attribute complete.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#needs_input ⇒ Object
Returns the value of attribute needs_input.
-
#output ⇒ Object
Returns the value of attribute output.
-
#post_params ⇒ Object
Returns the value of attribute post_params.
-
#post_params_value_key ⇒ Object
Returns the value of attribute post_params_value_key.
-
#post_to_url ⇒ Object
Returns the value of attribute post_to_url.
-
#prompt ⇒ Object
Returns the value of attribute prompt.
-
#prompt_is_secret ⇒ Object
Returns the value of attribute prompt_is_secret.
Instance Method Summary collapse
- #api_url(sint) ⇒ Webhookdb::Replicator::StateMachineStep
- #backfill_key(sint) ⇒ Webhookdb::Replicator::StateMachineStep
- #backfill_secret(sint) ⇒ Webhookdb::Replicator::StateMachineStep
- #completed ⇒ Webhookdb::Replicator::StateMachineStep
-
#initialize ⇒ StateMachineStep
constructor
A new instance of StateMachineStep.
- #prompting(field, secret: false) ⇒ Object
- #secret_prompt(field) ⇒ Webhookdb::Replicator::StateMachineStep
- #set_prompt(value, secret: false) ⇒ Object
- #successful? ⇒ Boolean
- #transition_field(sint, field) ⇒ Webhookdb::Replicator::StateMachineStep
- #webhook_secret(sint) ⇒ Webhookdb::Replicator::StateMachineStep
Constructor Details
#initialize ⇒ StateMachineStep
Returns a new instance of StateMachineStep.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 14 def initialize @needs_input = false @prompt = "" @prompt_is_secret = false @post_to_url = "" @complete = false @output = "" @error_code = "" @post_params = {} @post_params_value_key = "value" end |
Instance Attribute Details
#complete ⇒ Object
Returns the value of attribute complete.
4 5 6 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 4 def complete @complete end |
#error_code ⇒ Object
Returns the value of attribute error_code.
4 5 6 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 4 def error_code @error_code end |
#needs_input ⇒ Object
Returns the value of attribute needs_input.
4 5 6 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 4 def needs_input @needs_input end |
#output ⇒ Object
Returns the value of attribute output.
4 5 6 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 4 def output @output end |
#post_params ⇒ Object
Returns the value of attribute post_params.
4 5 6 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 4 def post_params @post_params end |
#post_params_value_key ⇒ Object
Returns the value of attribute post_params_value_key.
4 5 6 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 4 def post_params_value_key @post_params_value_key end |
#post_to_url ⇒ Object
Returns the value of attribute post_to_url.
4 5 6 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 4 def post_to_url @post_to_url end |
#prompt ⇒ Object
Returns the value of attribute prompt.
4 5 6 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 4 def prompt @prompt end |
#prompt_is_secret ⇒ Object
Returns the value of attribute prompt_is_secret.
4 5 6 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 4 def prompt_is_secret @prompt_is_secret end |
Instance Method Details
#api_url(sint) ⇒ Webhookdb::Replicator::StateMachineStep
62 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 62 def api_url(sint) = self.transition_field(sint, "api_url") |
#backfill_key(sint) ⇒ Webhookdb::Replicator::StateMachineStep
56 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 56 def backfill_key(sint) = self.transition_field(sint, "backfill_key") |
#backfill_secret(sint) ⇒ Webhookdb::Replicator::StateMachineStep
53 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 53 def backfill_secret(sint) = self.transition_field(sint, "backfill_secret") |
#completed ⇒ Webhookdb::Replicator::StateMachineStep
29 30 31 32 33 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 29 def completed self.complete = true self.needs_input = false return self end |
#prompting(field, secret: false) ⇒ Object
40 41 42 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 40 def prompting(field, secret: false) return self.set_prompt("Paste or type your #{field} here:", secret:) end |
#secret_prompt(field) ⇒ Webhookdb::Replicator::StateMachineStep
36 37 38 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 36 def secret_prompt(field) return self.prompting(field, secret: true) end |
#set_prompt(value, secret: false) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 44 def set_prompt(value, secret: false) self.needs_input = true self.prompt = value self.prompt_is_secret = secret self.complete = false return self end |
#successful? ⇒ Boolean
26 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 26 def successful? = return self.complete && self.error_code.blank? |
#transition_field(sint, field) ⇒ Webhookdb::Replicator::StateMachineStep
65 66 67 68 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 65 def transition_field(sint, field) self.post_to_url = sint.authed_api_path + "/transition/#{field}" return self end |
#webhook_secret(sint) ⇒ Webhookdb::Replicator::StateMachineStep
59 |
# File 'lib/webhookdb/replicator/state_machine_step.rb', line 59 def webhook_secret(sint) = self.transition_field(sint, "webhook_secret") |