class Eso::IntegrationOption
Attributes
id[RW]
name[RW]
steps[RW]
Public Class Methods
load(raw_integration_option)
click to toggle source
Load a Hash of an IntegrationOption
into an actual IntegrationOption
. Probably didn't need to break out separately, but might be useful
@param [Hash] raw_integration_option is a Hash representation of an IntegrationOption
@return [IntegrationOption] The IntegrationOption
version of the Hash
# File lib/eso/integration_option.rb, line 74 def self.load(raw_integration_option) integration_option = IntegrationOption.new(id: raw_integration_option[:id], name: raw_integration_option[:name]) steps = raw_integration_option[:steps] steps.each do |step| step_config = step[:stepConfiguration] integration_option.steps << Step.new(uuid: step[:uuid], service_name: step[:serviceName], type_name: step_config[:typeName], previous_type_name: step_config[:previousTypeName], configuration_params: step_config[:configurationParams]) end integration_option end
new(id: nil, name:, steps: [])
click to toggle source
# File lib/eso/integration_option.rb, line 26 def initialize(id: nil, name:, steps: []) @id = id @name = name @steps = steps end
Public Instance Methods
site_id()
click to toggle source
# File lib/eso/integration_option.rb, line 37 def site_id # As of now, the site is always in the last Step of the IntegrationOption. Might change. @steps.last.site_id end
site_id=(site_id)
click to toggle source
# File lib/eso/integration_option.rb, line 32 def site_id=(site_id) # As of now, the site is always in the last Step of the IntegrationOption. Might change. @steps.last.add_property(StepConfiguration::ConfigParamProperties::SITE_ID, site_id) end
to_hash()
click to toggle source
Return this object as a Hash. The corresponding Steps will still be objects.
@return [Hash] Hash interpretation of this IntegrationOption
.
# File lib/eso/integration_option.rb, line 63 def to_hash hash = {} instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var)} hash end
to_json()
click to toggle source
Return this object and the associated steps in a digestible JSON format.
@return [String] JSON interpretation of this workflow.
# File lib/eso/integration_option.rb, line 46 def to_json # Convert Object to Hash hash = self.to_hash # Grab the Step objects and convert to Hashes steps = hash['steps'] hashified_steps = [] steps.each {|step| hashified_steps << step.to_hash} hash['steps'] = hashified_steps # Convert Hash to JSON hash.to_json end