Class: Samsara::Types::VehicleWithGatewayTinyResponseResponseBody

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

Overview

assigned to the vehicle.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(asset_type: OMIT, external_ids: OMIT, gateway: OMIT, id: OMIT, license_plate: OMIT, name: OMIT, vin: OMIT, additional_properties: nil) ⇒ Samsara::Types::VehicleWithGatewayTinyResponseResponseBody

Parameters:

  • external_ids (Hash{String => String}) (defaults to: OMIT)

    A map of external ids

  • gateway (Samsara::Types::GoaGatewayTinyResponseResponseBody) (defaults to: OMIT)
  • id (String) (defaults to: OMIT)

    ID of the vehicle

  • license_plate (String) (defaults to: OMIT)

    The license plate of the vehicle.

  • name (String) (defaults to: OMIT)

    Name of the vehicle

  • vin (String) (defaults to: OMIT)

    The VIN of the vehicle.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 45

def initialize(asset_type: OMIT, external_ids: OMIT, gateway: OMIT, id: OMIT, license_plate: OMIT, name: OMIT, vin: OMIT, additional_properties: nil)
  @asset_type = asset_type if asset_type != OMIT
  @external_ids = external_ids if external_ids != OMIT
  @gateway = gateway if gateway != OMIT
  @id = id if id != OMIT
  @license_plate = license_plate if license_plate != OMIT
  @name = name if name != OMIT
  @vin = vin if vin != OMIT
  @additional_properties = additional_properties
  @_field_set = { "assetType": asset_type, "externalIds": external_ids, "gateway": gateway, "id": id, "licensePlate": license_plate, "name": name, "vin": vin }.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



28
29
30
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 28

def additional_properties
  @additional_properties
end

#asset_typeObject (readonly)

‘unpowered`, `vehicle`



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

def asset_type
  @asset_type
end

#external_idsHash{String => String} (readonly)

Returns A map of external ids.

Returns:

  • (Hash{String => String})

    A map of external ids



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

def external_ids
  @external_ids
end

#gatewaySamsara::Types::GoaGatewayTinyResponseResponseBody (readonly)



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

def gateway
  @gateway
end

#idString (readonly)

Returns ID of the vehicle.

Returns:

  • (String)

    ID of the vehicle



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

def id
  @id
end

#license_plateString (readonly)

Returns The license plate of the vehicle.

Returns:

  • (String)

    The license plate of the vehicle.



22
23
24
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 22

def license_plate
  @license_plate
end

#nameString (readonly)

Returns Name of the vehicle.

Returns:

  • (String)

    Name of the vehicle



24
25
26
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 24

def name
  @name
end

#vinString (readonly)

Returns The VIN of the vehicle.

Returns:

  • (String)

    The VIN of the vehicle.



26
27
28
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 26

def vin
  @vin
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 63

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  asset_type = parsed_json["assetType"]
  external_ids = parsed_json["externalIds"]
  unless parsed_json["gateway"].nil?
    gateway = parsed_json["gateway"].to_json
    gateway = Samsara::Types::GoaGatewayTinyResponseResponseBody.from_json(json_object: gateway)
  else
    gateway = nil
  end
  id = parsed_json["id"]
  license_plate = parsed_json["licensePlate"]
  name = parsed_json["name"]
  vin = parsed_json["vin"]
  new(
    asset_type: asset_type,
    external_ids: external_ids,
    gateway: gateway,
    id: id,
    license_plate: license_plate,
    name: name,
    vin: vin,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


102
103
104
105
106
107
108
109
110
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 102

def self.validate_raw(obj:)
  obj.asset_type&.is_a?(Samsara::Types::VehicleWithGatewayTinyResponseResponseBodyAssetType) != false || raise("Passed value for field obj.asset_type is not the expected type, validation failed.")
  obj.external_ids&.is_a?(Hash) != false || raise("Passed value for field obj.external_ids is not the expected type, validation failed.")
  obj.gateway.nil? || Samsara::Types::GoaGatewayTinyResponseResponseBody.validate_raw(obj: obj.gateway)
  obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.license_plate&.is_a?(String) != false || raise("Passed value for field obj.license_plate 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.vin&.is_a?(String) != false || raise("Passed value for field obj.vin is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


93
94
95
# File 'lib/samsara_api/types/vehicle_with_gateway_tiny_response_response_body.rb', line 93

def to_json
  @_field_set&.to_json
end