Class: ReactorSDK::Resources::RuleComponent

Inherits:
BaseResource show all
Defined in:
lib/reactor_sdk/resources/rule_component.rb

Instance Attribute Summary

Attributes inherited from BaseResource

#attributes, #id, #meta, #relationships, #type

Instance Method Summary collapse

Methods inherited from BaseResource

#==, #[], attribute, #initialize, #relationship_data, #relationship_id, #relationship_ids, #to_h

Constructor Details

This class inherits a constructor from ReactorSDK::Resources::BaseResource

Instance Method Details

#created_atString

Returns ISO8601 timestamp when the component was created.

Returns:

  • (String)

    ISO8601 timestamp when the component was created



51
# File 'lib/reactor_sdk/resources/rule_component.rb', line 51

attribute :created_at

#delegate_descriptor_idString

Returns Identifies the extension delegate powering this component Format: “extension-package-name::component-type::component-name” Example: “core::actions::custom-code” Example: “adobe-alloy::actions::send-event”.

Returns:

  • (String)

    Identifies the extension delegate powering this component Format: “extension-package-name::component-type::component-name” Example: “core::actions::custom-code” Example: “adobe-alloy::actions::send-event”



37
# File 'lib/reactor_sdk/resources/rule_component.rb', line 37

attribute :delegate_descriptor_id

#inspectString

Returns Human-readable representation.

Returns:

  • (String)

    Human-readable representation



93
94
95
96
97
98
# File 'lib/reactor_sdk/resources/rule_component.rb', line 93

def inspect
  '#<ReactorSDK::Resources::RuleComponent ' \
    "id=#{id.inspect} " \
    "name=#{name.inspect} " \
    "delegate=#{delegate_descriptor_id.inspect}>"
end

#nameString

Returns Display name of the rule component.

Returns:

  • (String)

    Display name of the rule component



31
# File 'lib/reactor_sdk/resources/rule_component.rb', line 31

attribute :name

#orderInteger?

Returns Execution order of this component within the rule.

Returns:

  • (Integer, nil)

    Execution order of this component within the rule



45
# File 'lib/reactor_sdk/resources/rule_component.rb', line 45

attribute :order

#parsed_settingsHash

Returns the settings field parsed into a Ruby Hash.

This is the primary accessor for component configuration. It handles all extension types uniformly:

- Core custom code (JavaScript, HTML) stored as JSON-encoded string
- Adobe Web SDK XDM objects and data objects
- Adobe Analytics variable mappings and custom setup blocks
- Any third-party extension settings structure

The app can render this as formatted JSON for display and diffing —exactly as Adobe Launch does in its own version comparison UI.

Behaviour by input type:

- JSON-encoded string → parsed into Hash
- Already a Hash     → returned as-is
- nil or blank       → returns empty Hash
- Unparseable string → returns empty Hash, raw value still on settings

The raw settings value is always preserved on the settings attribute unchanged — this method never modifies the underlying data.

Returns:

  • (Hash)

    Parsed settings or empty hash if nil, blank, or unparseable



80
81
82
83
84
85
86
87
88
# File 'lib/reactor_sdk/resources/rule_component.rb', line 80

def parsed_settings
  raw = @attributes['settings']
  return {} if raw.nil? || raw == ''
  return raw if raw.is_a?(Hash)

  JSON.parse(raw)
rescue JSON::ParserError
  {}
end

#rule_orderFloat, ...

Returns Execution order of this component within the rule graph.

Returns:

  • (Float, Integer, nil)

    Execution order of this component within the rule graph



48
# File 'lib/reactor_sdk/resources/rule_component.rb', line 48

attribute :rule_order

#settingsString

Returns Raw settings value exactly as returned by Adobe. May be a JSON-encoded string or a plain Hash depending on the extension. Use parsed_settings for reliable Hash access.

Returns:

  • (String)

    Raw settings value exactly as returned by Adobe. May be a JSON-encoded string or a plain Hash depending on the extension. Use parsed_settings for reliable Hash access.



42
# File 'lib/reactor_sdk/resources/rule_component.rb', line 42

attribute :settings

#updated_atString

Returns ISO8601 timestamp when the component was last updated.

Returns:

  • (String)

    ISO8601 timestamp when the component was last updated



54
# File 'lib/reactor_sdk/resources/rule_component.rb', line 54

attribute :updated_at