Class: Samsara::Types::TachographVehicleFile

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

Overview

Tachograph vehicle file

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(created_at_time: OMIT, id: OMIT, url: OMIT, vehicle_identification_number: OMIT, additional_properties: nil) ⇒ Samsara::Types::TachographVehicleFile

Parameters:

  • vehicle_identification_number (String) (defaults to: OMIT)

    VIN associated with the vehicle file.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
44
45
46
# File 'lib/samsara_api/types/tachograph_vehicle_file.rb', line 37

def initialize(created_at_time: OMIT, id: OMIT, url: OMIT, vehicle_identification_number: OMIT, additional_properties: nil)
  @created_at_time = created_at_time if created_at_time != OMIT
  @id = id if id != OMIT
  @url = url if url != OMIT
  @vehicle_identification_number = vehicle_identification_number if vehicle_identification_number != OMIT
  @additional_properties = additional_properties
  @_field_set = { "createdAtTime": created_at_time, "id": id, "url": url, "vehicleIdentificationNumber": vehicle_identification_number }.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



21
22
23
# File 'lib/samsara_api/types/tachograph_vehicle_file.rb', line 21

def additional_properties
  @additional_properties
end

#created_at_timeObject (readonly)

files manually uploaded via Samsara UI).



12
13
14
# File 'lib/samsara_api/types/tachograph_vehicle_file.rb', line 12

def created_at_time
  @created_at_time
end

#idString (readonly)

Returns ID of the file.

Returns:

  • (String)

    ID of the file.



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

def id
  @id
end

#urlObject (readonly)

multiple times and expires after an hour.



17
18
19
# File 'lib/samsara_api/types/tachograph_vehicle_file.rb', line 17

def url
  @url
end

#vehicle_identification_numberString (readonly)

Returns VIN associated with the vehicle file.

Returns:

  • (String)

    VIN associated with the vehicle file.



19
20
21
# File 'lib/samsara_api/types/tachograph_vehicle_file.rb', line 19

def vehicle_identification_number
  @vehicle_identification_number
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/samsara_api/types/tachograph_vehicle_file.rb', line 51

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  created_at_time = parsed_json["createdAtTime"]
  id = parsed_json["id"]
  url = parsed_json["url"]
  vehicle_identification_number = parsed_json["vehicleIdentificationNumber"]
  new(
    created_at_time: created_at_time,
    id: id,
    url: url,
    vehicle_identification_number: vehicle_identification_number,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


78
79
80
81
82
83
# File 'lib/samsara_api/types/tachograph_vehicle_file.rb', line 78

def self.validate_raw(obj:)
  obj.created_at_time&.is_a?(String) != false || raise("Passed value for field obj.created_at_time 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.url&.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
  obj.vehicle_identification_number&.is_a?(String) != false || raise("Passed value for field obj.vehicle_identification_number is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


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

def to_json
  @_field_set&.to_json
end