Class: Samsara::Types::AlertEventDvirDefectsItem
- Inherits:
-
Object
- Object
- Samsara::Types::AlertEventDvirDefectsItem
- Defined in:
- lib/samsara_api/types/alert_event_dvir_defects_item.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#comment ⇒ String
readonly
Defect comment.
-
#created_at ⇒ DateTime
readonly
Creation timestamp.
-
#defect_type ⇒ String
readonly
Type of defect.
-
#id ⇒ String
readonly
ID of the defect.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id: OMIT, created_at: OMIT, defect_type: OMIT, comment: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertEventDvirDefectsItem constructor
- #to_json ⇒ String
Constructor Details
#initialize(id: OMIT, created_at: OMIT, defect_type: OMIT, comment: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertEventDvirDefectsItem
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/samsara_api/types/alert_event_dvir_defects_item.rb', line 31 def initialize(id: OMIT, created_at: OMIT, defect_type: OMIT, comment: OMIT, additional_properties: nil) @id = id if id != OMIT @created_at = created_at if created_at != OMIT @defect_type = defect_type if defect_type != OMIT @comment = comment if comment != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "createdAt": created_at, "defectType": defect_type, "comment": comment }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/samsara_api/types/alert_event_dvir_defects_item.rb', line 18 def additional_properties @additional_properties end |
#comment ⇒ String (readonly)
Returns Defect comment.
16 17 18 |
# File 'lib/samsara_api/types/alert_event_dvir_defects_item.rb', line 16 def comment @comment end |
#created_at ⇒ DateTime (readonly)
Returns Creation timestamp.
12 13 14 |
# File 'lib/samsara_api/types/alert_event_dvir_defects_item.rb', line 12 def created_at @created_at end |
#defect_type ⇒ String (readonly)
Returns Type of defect.
14 15 16 |
# File 'lib/samsara_api/types/alert_event_dvir_defects_item.rb', line 14 def defect_type @defect_type end |
#id ⇒ String (readonly)
Returns ID of the defect.
10 11 12 |
# File 'lib/samsara_api/types/alert_event_dvir_defects_item.rb', line 10 def id @id end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::AlertEventDvirDefectsItem
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/samsara_api/types/alert_event_dvir_defects_item.rb', line 45 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] created_at = unless parsed_json["createdAt"].nil? DateTime.parse(parsed_json["createdAt"]) else nil end defect_type = parsed_json["defectType"] comment = parsed_json["comment"] new( id: id, created_at: created_at, defect_type: defect_type, comment: comment, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
76 77 78 79 80 81 |
# File 'lib/samsara_api/types/alert_event_dvir_defects_item.rb', line 76 def self.validate_raw(obj:) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id 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.defect_type&.is_a?(String) != false || raise("Passed value for field obj.defect_type is not the expected type, validation failed.") obj.comment&.is_a?(String) != false || raise("Passed value for field obj.comment is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
67 68 69 |
# File 'lib/samsara_api/types/alert_event_dvir_defects_item.rb', line 67 def to_json @_field_set&.to_json end |