Class: Eso::StepConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/eso/step_configuration.rb

Defined Under Namespace

Modules: ConfigParamProperties, ConfigParamPropertyTypes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(typeName, previousTypeName, configurationParams = nil, workflowID = nil) ⇒ StepConfiguration

Returns a new instance of StepConfiguration.



23
24
25
26
27
28
29
30
31
# File 'lib/eso/step_configuration.rb', line 23

def initialize (typeName, previousTypeName, configurationParams=nil, workflowID=nil)
  @typeName = typeName
  @previousTypeName = previousTypeName
  @configurationParams = configurationParams ? configurationParams : {
      :valueClass => Values::OBJECT,
      :objectType => 'params',
      :properties => {}}
  @workflowID = workflowID if workflowID
end

Instance Attribute Details

#configurationParamsObject

Returns the value of attribute configurationParams.



3
4
5
# File 'lib/eso/step_configuration.rb', line 3

def configurationParams
  @configurationParams
end

#previousTypeNameObject

Returns the value of attribute previousTypeName.



3
4
5
# File 'lib/eso/step_configuration.rb', line 3

def previousTypeName
  @previousTypeName
end

#typeNameObject

Returns the value of attribute typeName.



3
4
5
# File 'lib/eso/step_configuration.rb', line 3

def typeName
  @typeName
end

#workflowIDObject

Returns the value of attribute workflowID.



3
4
5
# File 'lib/eso/step_configuration.rb', line 3

def workflowID
  @workflowID
end

Instance Method Details

#add_property(name, value) ⇒ StepConfiguration

This adds the specified property to this StepConfiguration.configurationParams.properties Hash

Parameters:

  • name (String)

    The name of the property to add, which should be one of ConfigParamProperties

  • value (Object)

    The value of the property to add, which should already be in the appropriate format (Eso::Values)

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/eso/step_configuration.rb', line 38

def add_property(name, value)
  @configurationParams[:properties][name] =
      case name
        when *ConfigParamPropertyTypes::BOOLEAN
          {
              valueClass: Values::BOOLEAN,
              value: value
          }
        when *ConfigParamPropertyTypes::INTEGER
          {
              valueClass: Values::INTEGER,
              value: value
          }
        when *ConfigParamPropertyTypes::STRING
          {
              valueClass: Values::STRING,
              value: value
          }
        else
          raise ArgumentError, "Invalid StepConfiguration ConfigurationParameter Property name: #{name}. " +
              'Should be one of StepConfiguration::ConfigParamProperties'
      end
  self
end

#to_hObject



63
64
65
66
67
68
69
70
71
# File 'lib/eso/step_configuration.rb', line 63

def to_h
  hash = {
      :typeName => @typeName,
      :previousTypeName => @previousTypeName,
      :configurationParams => @configurationParams
  }
  hash['workflowID'] = @workflowID if @workflowID
  hash
end