Class: Eso::Step
- Inherits:
-
Object
- Object
- Eso::Step
- Defined in:
- lib/eso/step.rb
Overview
Object representation of a step, which are attributes of Workflows and Integration Options
Instance Attribute Summary collapse
-
#serviceName ⇒ Object
Type of this step.
-
#stepConfiguration ⇒ Object
The configuration for this step.
-
#uuid ⇒ Object
UUID of this step.
Instance Method Summary collapse
-
#add_filter(filter) ⇒ Object
Add the specified filter to this step.
-
#add_property(name, value) ⇒ Step
Convenience method which calls the #add_property method of the @stepConfiguration, but returns the Step.
-
#configuration_params ⇒ Hash
Return the configuration parameters for this step.
-
#configuration_params=(config_params) ⇒ Hash
Set the the configuration parameters for this step.
-
#filters ⇒ Array
Returns all configured filters for this step.
-
#initialize(uuid: nil, service_name:, workflow: nil, type_name:, previous_type_name: StepNames::EMPTY, configuration_params: nil) ⇒ Step
constructor
Constructor for Step.
-
#previous_type_name ⇒ String
Return the previous type name for this step.
-
#previous_type_name=(action_name) ⇒ String
Set the previous type name for this step.
-
#properties ⇒ Hash{}
Return the properties of this step.
-
#properties=(new_properties) ⇒ Hash
Set the properties of this step.
-
#site_id ⇒ String|nil
Determine the siteID of this step, if it exists.
-
#to_hash ⇒ Hash
Return this step as a hash.
-
#to_json ⇒ String
Return this step in a JSON digestible format.
-
#type_name ⇒ String
Return the type name for this step.
-
#type_name=(wf_action_name) ⇒ String
Set the type name for this step.
-
#update_property(name, value) ⇒ Step
Convenience method which calls the #add_property method of the @stepConfiguration, but returns the Step.
Constructor Details
#initialize(uuid: nil, service_name:, workflow: nil, type_name:, previous_type_name: StepNames::EMPTY, configuration_params: nil) ⇒ Step
Constructor for Step.
21 22 23 24 25 26 27 |
# File 'lib/eso/step.rb', line 21 def initialize(uuid: nil, service_name:, workflow: nil, type_name:, previous_type_name: StepNames::EMPTY, configuration_params: nil) @uuid = uuid if uuid @serviceName = service_name @stepConfiguration = StepConfiguration.new(type_name, previous_type_name) @stepConfiguration.configurationParams = configuration_params if configuration_params @stepConfiguration.workflowID = workflow.id if workflow end |
Instance Attribute Details
#serviceName ⇒ Object
Type of this step. Should be one of Eso::ServiceNames
9 10 11 |
# File 'lib/eso/step.rb', line 9 def serviceName @serviceName end |
#stepConfiguration ⇒ Object
The configuration for this step.
12 13 14 |
# File 'lib/eso/step.rb', line 12 def stepConfiguration @stepConfiguration end |
#uuid ⇒ Object
UUID of this step. This is generated on creation on the server.
6 7 8 |
# File 'lib/eso/step.rb', line 6 def uuid @uuid end |
Instance Method Details
#add_filter(filter) ⇒ Object
Add the specified filter to this step. The filter is converted to a hash and saved as such instead of being saved as a ESO::Filter object.
140 141 142 |
# File 'lib/eso/step.rb', line 140 def add_filter(filter) @stepConfiguration.configurationParams[:properties].merge! filter.to_hash end |
#add_property(name, value) ⇒ Step
Convenience method which calls the #add_property method of the @stepConfiguration, but returns the Step
123 124 125 126 |
# File 'lib/eso/step.rb', line 123 def add_property(name, value) @stepConfiguration.add_property(name, value) self end |
#configuration_params ⇒ Hash
Return the configuration parameters for this step.
33 34 35 |
# File 'lib/eso/step.rb', line 33 def configuration_params @stepConfiguration.configurationParams end |
#configuration_params=(config_params) ⇒ Hash
Set the the configuration parameters for this step.
42 43 44 |
# File 'lib/eso/step.rb', line 42 def configuration_params=(config_params) @stepConfiguration.configurationParams = config_params end |
#filters ⇒ Array
Returns all configured filters for this step.
110 111 112 113 114 115 116 117 118 |
# File 'lib/eso/step.rb', line 110 def filters rv = {} self.properties.each_pair do |key, value| if value[:properties] rv[key] = value if value[:properties].has_key?(:operators) end end rv end |
#previous_type_name ⇒ String
Return the previous type name for this step.
67 68 69 |
# File 'lib/eso/step.rb', line 67 def previous_type_name @stepConfiguration.previousTypeName end |
#previous_type_name=(action_name) ⇒ String
Set the previous type name for this step.
76 77 78 |
# File 'lib/eso/step.rb', line 76 def previous_type_name=(action_name) @stepConfiguration.previousTypeName = action_name end |
#properties ⇒ Hash{}
Return the properties of this step.
84 85 86 |
# File 'lib/eso/step.rb', line 84 def properties @stepConfiguration.configurationParams[:properties] end |
#properties=(new_properties) ⇒ Hash
Set the properties of this step.
93 94 95 |
# File 'lib/eso/step.rb', line 93 def properties=(new_properties) @stepConfiguration.configurationParams[:properties] = new_properties end |
#site_id ⇒ String|nil
Determine the siteID of this step, if it exists
100 101 102 103 104 |
# File 'lib/eso/step.rb', line 100 def site_id if @stepConfiguration.configurationParams[:properties][:siteID] @stepConfiguration.configurationParams[:properties][:siteID][:value] end end |
#to_hash ⇒ Hash
Return this step as a hash.
156 157 158 159 160 161 162 163 164 |
# File 'lib/eso/step.rb', line 156 def to_hash hash = {} instance_variables.each do |var| value = instance_variable_get(var) value = value.to_h if value.respond_to?('to_h') hash[var.to_s.delete('@')] = value end hash end |
#to_json ⇒ String
Return this step in a JSON digestible format.
148 149 150 |
# File 'lib/eso/step.rb', line 148 def to_json self.to_hash.to_json end |
#type_name ⇒ String
Return the type name for this step.
50 51 52 |
# File 'lib/eso/step.rb', line 50 def type_name @stepConfiguration.typeName end |
#type_name=(wf_action_name) ⇒ String
Set the type name for this step.
59 60 61 |
# File 'lib/eso/step.rb', line 59 def type_name=(wf_action_name) @stepConfiguration.typeName = wf_action_name end |
#update_property(name, value) ⇒ Step
Convenience method which calls the #add_property method of the @stepConfiguration, but returns the Step
131 132 133 134 |
# File 'lib/eso/step.rb', line 131 def update_property(name, value) @stepConfiguration.add_property(name, value) self end |