Class: Intrinsic::FiredRuleObject

Inherits:
Object
  • Object
show all
Defined in:
lib/intrinsic/types/fired_rule_object.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object:, rule_id:, rule_name:, triggered_action_name:, additional_properties: nil) ⇒ FiredRuleObject

Parameters:

  • object (String)
  • rule_id (String)

    ID of the fired rule

  • rule_name (String)

    Name of the fired rule

  • triggered_action_name (String)

    Name of the triggered action

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/intrinsic/types/fired_rule_object.rb', line 15

def initialize(object:, rule_id:, rule_name:, triggered_action_name:, additional_properties: nil)
  # @type [String]
  @object = object
  # @type [String] ID of the fired rule
  @rule_id = rule_id
  # @type [String] Name of the fired rule
  @rule_name = rule_name
  # @type [String] Name of the triggered action
  @triggered_action_name = triggered_action_name
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



7
8
9
# File 'lib/intrinsic/types/fired_rule_object.rb', line 7

def additional_properties
  @additional_properties
end

#objectObject (readonly)

Returns the value of attribute object.



7
8
9
# File 'lib/intrinsic/types/fired_rule_object.rb', line 7

def object
  @object
end

#rule_idObject (readonly)

Returns the value of attribute rule_id.



7
8
9
# File 'lib/intrinsic/types/fired_rule_object.rb', line 7

def rule_id
  @rule_id
end

#rule_nameObject (readonly)

Returns the value of attribute rule_name.



7
8
9
# File 'lib/intrinsic/types/fired_rule_object.rb', line 7

def rule_name
  @rule_name
end

#triggered_action_nameObject (readonly)

Returns the value of attribute triggered_action_name.



7
8
9
# File 'lib/intrinsic/types/fired_rule_object.rb', line 7

def triggered_action_name
  @triggered_action_name
end

Class Method Details

.from_json(json_object:) ⇒ FiredRuleObject

Deserialize a JSON object to an instance of FiredRuleObject

Parameters:

  • json_object (JSON)

Returns:



32
33
34
35
36
37
38
39
40
41
# File 'lib/intrinsic/types/fired_rule_object.rb', line 32

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  JSON.parse(json_object)
  object = struct.object
  rule_id = struct.rule_id
  rule_name = struct.rule_name
  triggered_action_name = struct.triggered_action_name
  new(object: object, rule_id: rule_id, rule_name: rule_name, triggered_action_name: triggered_action_name,
      additional_properties: struct)
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


59
60
61
62
63
64
# File 'lib/intrinsic/types/fired_rule_object.rb', line 59

def self.validate_raw(obj:)
  obj.object.is_a?(String) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
  obj.rule_id.is_a?(String) != false || raise("Passed value for field obj.rule_id is not the expected type, validation failed.")
  obj.rule_name.is_a?(String) != false || raise("Passed value for field obj.rule_name is not the expected type, validation failed.")
  obj.triggered_action_name.is_a?(String) != false || raise("Passed value for field obj.triggered_action_name is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of FiredRuleObject to a JSON object

Returns:

  • (JSON)


46
47
48
49
50
51
52
53
# File 'lib/intrinsic/types/fired_rule_object.rb', line 46

def to_json(*_args)
  {
    "object": @object,
    "rule_id": @rule_id,
    "rule_name": @rule_name,
    "triggered_action_name": @triggered_action_name
  }.to_json
end