Class: Samsara::Types::DefectResolvedBy

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/defect_resolved_by.rb

Overview

unresolved.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, name: OMIT, type: OMIT, additional_properties: nil) ⇒ Samsara::Types::DefectResolvedBy

Parameters:

  • name (String) (defaults to: OMIT) —

    Name of the person who resolved this defect.

  • type (Samsara::Types::DefectResolvedByType) (defaults to: OMIT) —

    Indicates whether this defect was resolved by a driver or a mechanic.

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



34
35
36
37
38
39
40
41
42
# File 'lib/samsara_api/types/defect_resolved_by.rb', line 34

def initialize(id: OMIT, name: OMIT, type: OMIT, additional_properties: nil)
  @id = id if id != OMIT
  @name = name if name != OMIT
  @type = type if type != OMIT
  @additional_properties = additional_properties
  @_field_set = { "id": id, "name": name, "type": type }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



20
21
22
# File 'lib/samsara_api/types/defect_resolved_by.rb', line 20

def additional_properties
  @additional_properties
end

#id ⇒ Object (readonly)

mechanic, this will be the Samsara Dashboard User ID of the mechanic.



14
15
16
# File 'lib/samsara_api/types/defect_resolved_by.rb', line 14

def id
  @id
end

#name ⇒ String (readonly)

Returns Name of the person who resolved this defect.

Returns:

  • (String) —

    Name of the person who resolved this defect.



16
17
18
# File 'lib/samsara_api/types/defect_resolved_by.rb', line 16

def name
  @name
end

#type ⇒ Samsara::Types::DefectResolvedByType (readonly)

Returns Indicates whether this defect was resolved by a driver or a mechanic.

Returns:



18
19
20
# File 'lib/samsara_api/types/defect_resolved_by.rb', line 18

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::DefectResolvedBy

Parameters:

  • json_object (String)

Returns:



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/samsara_api/types/defect_resolved_by.rb', line 47

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  name = parsed_json["name"]
  type = parsed_json["type"]
  new(
    id: id,
    name: name,
    type: type,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


72
73
74
75
76
# File 'lib/samsara_api/types/defect_resolved_by.rb', line 72

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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.type&.is_a?(Samsara::Types::DefectResolvedByType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


63
64
65
# File 'lib/samsara_api/types/defect_resolved_by.rb', line 63

def to_json
  @_field_set&.to_json
end