Class: Samsara::Types::TachographVehicleFileListWrapper

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(files: OMIT, vehicle: OMIT, additional_properties: nil) ⇒ Samsara::Types::TachographVehicleFileListWrapper

Parameters:



26
27
28
29
30
31
32
33
# File 'lib/samsara_api/types/tachograph_vehicle_file_list_wrapper.rb', line 26

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

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



15
16
17
# File 'lib/samsara_api/types/tachograph_vehicle_file_list_wrapper.rb', line 15

def additional_properties
  @additional_properties
end

#filesSamsara::Types::TACHOGRAPH_VEHICLE_FILE_LIST (readonly)



11
12
13
# File 'lib/samsara_api/types/tachograph_vehicle_file_list_wrapper.rb', line 11

def files
  @files
end

#vehicleSamsara::Types::VehicleTinyResponse (readonly)



13
14
15
# File 'lib/samsara_api/types/tachograph_vehicle_file_list_wrapper.rb', line 13

def vehicle
  @vehicle
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/samsara_api/types/tachograph_vehicle_file_list_wrapper.rb', line 38

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  files = parsed_json["files"]&.map do | item |
  item = item.to_json
  Samsara::Types::TachographVehicleFile.from_json(json_object: item)
end
  unless parsed_json["vehicle"].nil?
    vehicle = parsed_json["vehicle"].to_json
    vehicle = Samsara::Types::VehicleTinyResponse.from_json(json_object: vehicle)
  else
    vehicle = nil
  end
  new(
    files: files,
    vehicle: vehicle,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


69
70
71
72
# File 'lib/samsara_api/types/tachograph_vehicle_file_list_wrapper.rb', line 69

def self.validate_raw(obj:)
  obj.files&.is_a?(Array) != false || raise("Passed value for field obj.files is not the expected type, validation failed.")
  obj.vehicle.nil? || Samsara::Types::VehicleTinyResponse.validate_raw(obj: obj.vehicle)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


60
61
62
# File 'lib/samsara_api/types/tachograph_vehicle_file_list_wrapper.rb', line 60

def to_json
  @_field_set&.to_json
end