Class: Samsara::Types::GatewayWithVehicleTinyResponseResponseBody

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, serial:, vehicle: OMIT, additional_properties: nil) ⇒ Samsara::Types::GatewayWithVehicleTinyResponseResponseBody

Parameters:

  • serial (String) —

    The serial number of the gateway installed on the asset.

  • vehicle (Samsara::Types::GoaVehicleTinyResponseResponseBody) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



39
40
41
42
43
44
45
46
47
# File 'lib/samsara_api/types/gateway_with_vehicle_tiny_response_response_body.rb', line 39

def initialize(model:, serial:, vehicle: OMIT, additional_properties: nil)
  @model = model
  @serial = serial
  @vehicle = vehicle if vehicle != OMIT
  @additional_properties = additional_properties
  @_field_set = { "model": model, "serial": serial, "vehicle": vehicle }.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



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

def additional_properties
  @additional_properties
end

#model ⇒ Object (readonly)

VG54EU, VG54FN, VG54NA, VG54NAE, VG54NAH, VG55EU, VG55FN, VG55NA



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

def model
  @model
end

#serial ⇒ String (readonly)

Returns The serial number of the gateway installed on the asset.

Returns:

  • (String) —

    The serial number of the gateway installed on the asset.



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

def serial
  @serial
end

#vehicle ⇒ Samsara::Types::GoaVehicleTinyResponseResponseBody (readonly)



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

def vehicle
  @vehicle
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/samsara_api/types/gateway_with_vehicle_tiny_response_response_body.rb', line 53

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  model = parsed_json["model"]
  serial = parsed_json["serial"]
  unless parsed_json["vehicle"].nil?
    vehicle = parsed_json["vehicle"].to_json
    vehicle = Samsara::Types::GoaVehicleTinyResponseResponseBody.from_json(json_object: vehicle)
  else
    vehicle = nil
  end
  new(
    model: model,
    serial: serial,
    vehicle: vehicle,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


84
85
86
87
88
# File 'lib/samsara_api/types/gateway_with_vehicle_tiny_response_response_body.rb', line 84

def self.validate_raw(obj:)
  obj.model.is_a?(Samsara::Types::GatewayWithVehicleTinyResponseResponseBodyModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.serial.is_a?(String) != false || raise("Passed value for field obj.serial is not the expected type, validation failed.")
  obj.vehicle.nil? || Samsara::Types::GoaVehicleTinyResponseResponseBody.validate_raw(obj: obj.vehicle)
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


75
76
77
# File 'lib/samsara_api/types/gateway_with_vehicle_tiny_response_response_body.rb', line 75

def to_json
  @_field_set&.to_json
end