Class: Intrinsic::FiredRuleObject
- Inherits:
-
Object
- Object
- Intrinsic::FiredRuleObject
- Defined in:
- lib/intrinsic/types/fired_rule_object.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#rule_id ⇒ Object
readonly
Returns the value of attribute rule_id.
-
#rule_name ⇒ Object
readonly
Returns the value of attribute rule_name.
-
#triggered_action_name ⇒ Object
readonly
Returns the value of attribute triggered_action_name.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ FiredRuleObject
Deserialize a JSON object to an instance of FiredRuleObject.
-
.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.
Instance Method Summary collapse
- #initialize(object:, rule_id:, rule_name:, triggered_action_name:, additional_properties: nil) ⇒ FiredRuleObject constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of FiredRuleObject to a JSON object.
Constructor Details
#initialize(object:, rule_id:, rule_name:, triggered_action_name:, additional_properties: nil) ⇒ FiredRuleObject
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_properties ⇒ Object (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 |
#object ⇒ Object (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_id ⇒ Object (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_name ⇒ Object (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_name ⇒ Object (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
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.
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
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 |