Class: Intrinsic::CreateEventAsyncResponse
- Inherits:
-
Object
- Object
- Intrinsic::CreateEventAsyncResponse
- Defined in:
- lib/intrinsic/types/create_event_async_response.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#detections ⇒ Object
readonly
Returns the value of attribute detections.
-
#event_type_id ⇒ Object
readonly
Returns the value of attribute event_type_id.
-
#fired_rules ⇒ Object
readonly
Returns the value of attribute fired_rules.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CreateEventAsyncResponse
Deserialize a JSON object to an instance of CreateEventAsyncResponse.
-
.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:, id:, event_type_id:, content:, created_at:, detections:, fired_rules:, additional_properties: nil) ⇒ CreateEventAsyncResponse constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of CreateEventAsyncResponse to a JSON object.
Constructor Details
#initialize(object:, id:, event_type_id:, content:, created_at:, detections:, fired_rules:, additional_properties: nil) ⇒ CreateEventAsyncResponse
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 21 def initialize(object:, id:, event_type_id:, content:, created_at:, detections:, fired_rules:, additional_properties: nil) # @type [String] @object = object # @type [String] ID of the created event @id = id # @type [String] ID of the event type that was created @event_type_id = event_type_id # @type [Hash{String => String}] Arbitrary JSON payload for the request body @content = content # @type [DateTime] Timestamp of when the event was created @created_at = created_at # @type [Array<DetectionObject>] List of pending detection ids created for the event @detections = detections # @type [Array<FiredRuleObject>] List of fired rules created for the event @fired_rules = fired_rules # @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.
10 11 12 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 10 def additional_properties @additional_properties end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
10 11 12 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 10 def content @content end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 10 def created_at @created_at end |
#detections ⇒ Object (readonly)
Returns the value of attribute detections.
10 11 12 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 10 def detections @detections end |
#event_type_id ⇒ Object (readonly)
Returns the value of attribute event_type_id.
10 11 12 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 10 def event_type_id @event_type_id end |
#fired_rules ⇒ Object (readonly)
Returns the value of attribute fired_rules.
10 11 12 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 10 def fired_rules @fired_rules end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 10 def id @id end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
10 11 12 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 10 def object @object end |
Class Method Details
.from_json(json_object:) ⇒ CreateEventAsyncResponse
Deserialize a JSON object to an instance of CreateEventAsyncResponse
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 45 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) object = struct.object id = struct.id event_type_id = struct.event_type_id content = struct.content created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?) detections = parsed_json["detections"]&.map do |v| v = v.to_json DetectionObject.from_json(json_object: v) end fired_rules = parsed_json["fired_rules"]&.map do |v| v = v.to_json FiredRuleObject.from_json(json_object: v) end new(object: object, id: id, event_type_id: event_type_id, content: content, created_at: created_at, detections: detections, fired_rules: fired_rules, 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.
84 85 86 87 88 89 90 91 92 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 84 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.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.event_type_id.is_a?(String) != false || raise("Passed value for field obj.event_type_id is not the expected type, validation failed.") obj.content.is_a?(Hash) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.detections.is_a?(Array) != false || raise("Passed value for field obj.detections is not the expected type, validation failed.") obj.fired_rules.is_a?(Array) != false || raise("Passed value for field obj.fired_rules is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of CreateEventAsyncResponse to a JSON object
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/intrinsic/types/create_event_async_response.rb', line 68 def to_json(*_args) { "object": @object, "id": @id, "event_type_id": @event_type_id, "content": @content, "created_at": @created_at, "detections": @detections, "fired_rules": @fired_rules }.to_json end |