class Eso::Step

Object representation of a step, which are attributes of Workflows and Integration Options

Attributes

serviceName[RW]

Type of this step. Should be one of Eso::ServiceNames

stepConfiguration[RW]

The configuration for this step.

uuid[RW]

UUID of this step. This is generated on creation on the server.

Public Class Methods

new(uuid: nil, service_name:, workflow: nil, type_name:, previous_type_name: StepNames::EMPTY, configuration_params: nil) click to toggle source

Constructor for Step.

@param [String] uuid UUID of this Step. This is created on the server side upon creation through the API. @param [String] service_name The name of step this is. @param [Workflow] workflow The workflow this step belongs to. @param [Hash] configuration_params Hash of the parameters for this step.

# 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

Public Instance Methods

add_filter(filter) click to toggle source

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.

@param [Filter] filter The filter to add to this step.

# File lib/eso/step.rb, line 140
def add_filter(filter)
  @stepConfiguration.configurationParams[:properties].merge! filter.to_hash
end
add_property(name, value) click to toggle source

Convenience method which calls the add_property method of the @stepConfiguration, but returns the Step

@return [Step] Returns this Step for chaining

# File lib/eso/step.rb, line 123
def add_property(name, value)
  @stepConfiguration.add_property(name, value)
  self
end
configuration_params() click to toggle source

Return the configuration parameters for this step.

@return [Hash] Hash of the configuration parameters for this step.

# File lib/eso/step.rb, line 33
def configuration_params
  @stepConfiguration.configurationParams
end
configuration_params=(config_params) click to toggle source

Set the the configuration parameters for this step.

@param [Hash] config_params of the new configuration parameters you would like to set. @return [Hash] Hash of the updated configuration parameters for this step.

# File lib/eso/step.rb, line 42
def configuration_params=(config_params)
  @stepConfiguration.configurationParams = config_params
end
filters() click to toggle source

Returns all configured filters for this step.

@return [Array] An array of the currently configured filters for this step, each represented as a hash.

# 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() click to toggle source

Return the previous type name for this step.

@return [String] The previous type name for this step.

# File lib/eso/step.rb, line 67
def previous_type_name
  @stepConfiguration.previousTypeName
end
previous_type_name=(action_name) click to toggle source

Set the previous type name for this step.

@param [String] The new previous type name that you would like to set. See Eso::StepNames for valid names. @return [String] Hash of the configuration parameters for this step.

# File lib/eso/step.rb, line 76
def previous_type_name=(action_name)
  @stepConfiguration.previousTypeName = action_name
end
properties() click to toggle source

Return the properties of this step.

@return [Hash{}] Hash of the properties for this step.

# File lib/eso/step.rb, line 84
def properties
  @stepConfiguration.configurationParams[:properties]
end
properties=(new_properties) click to toggle source

Set the properties of this step.

@param [Hash] The new properties to set for this step. @return [Hash] Hash of the newly configured properties for this step.

# File lib/eso/step.rb, line 93
def properties=(new_properties)
  @stepConfiguration.configurationParams[:properties] = new_properties
end
site_id() click to toggle source

Determine the siteID of this step, if it exists

@return [String|nil] The String siteID value or nil if no siteID

# File lib/eso/step.rb, line 100
def site_id
  if @stepConfiguration.configurationParams[:properties][:siteID]
    @stepConfiguration.configurationParams[:properties][:siteID][:value]
  end
end
to_hash() click to toggle source

Return this step as a hash.

@return [Hash] Hash interpretation of this step.

# 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() click to toggle source

Return this step in a JSON digestible format.

@return [String] JSON interpretation of this step.

# File lib/eso/step.rb, line 148
def to_json
  self.to_hash.to_json
end
type_name() click to toggle source

Return the type name for this step.

@return [String] The currently configured type name.

# File lib/eso/step.rb, line 50
def type_name
  @stepConfiguration.typeName
end
type_name=(wf_action_name) click to toggle source

Set the type name for this step.

@param [String] The new type_name that you would like to set this to. See Eso::StepNames for valid names. @return [String] The newly set type name.

# File lib/eso/step.rb, line 59
def type_name=(wf_action_name)
  @stepConfiguration.typeName = wf_action_name
end
update_property(name, value) click to toggle source

Convenience method which calls the add_property method of the @stepConfiguration, but returns the Step

@return [Step] Returns this Step for chaining

# File lib/eso/step.rb, line 131
def update_property(name, value)
  @stepConfiguration.add_property(name, value)
  self
end