Class: Samsara::Types::EngineImmobilizerStateResponseBody

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

Overview

An engine immobilizer state.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(happened_at_time:, is_connected_to_vehicle:, relay_states:, vehicle_id:, additional_properties: nil) ⇒ Samsara::Types::EngineImmobilizerStateResponseBody

Parameters:

  • is_connected_to_vehicle (Boolean) —

    Whether the engine immobilizer is connected the vehicle.

  • relay_states (Array<Samsara::Types::EngineImmobilizerRelayStateResponseBody>) —

    A list of states for each relay

  • vehicle_id (String) —

    The ID of the vehicle that the engine immobilizer is connected to.

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

    Additional properties unmapped to the current class definition



36
37
38
39
40
41
42
43
# File 'lib/samsara_api/types/engine_immobilizer_state_response_body.rb', line 36

def initialize(happened_at_time:, is_connected_to_vehicle:, relay_states:, vehicle_id:, additional_properties: nil)
  @happened_at_time = happened_at_time
  @is_connected_to_vehicle = is_connected_to_vehicle
  @relay_states = relay_states
  @vehicle_id = vehicle_id
  @additional_properties = additional_properties
  @_field_set = { "happenedAtTime": happened_at_time, "isConnectedToVehicle": is_connected_to_vehicle, "relayStates": relay_states, "vehicleId": vehicle_id }
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



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

def additional_properties
  @additional_properties
end

#happened_at_time ⇒ Object (readonly)

2015-09-15T14:00:12-04:00).



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

def happened_at_time
  @happened_at_time
end

#is_connected_to_vehicle ⇒ Boolean (readonly)

Returns Whether the engine immobilizer is connected the vehicle.

Returns:

  • (Boolean) —

    Whether the engine immobilizer is connected the vehicle.



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

def is_connected_to_vehicle
  @is_connected_to_vehicle
end

#relay_states ⇒ Array<Samsara::Types::EngineImmobilizerRelayStateResponseBody> (readonly)

Returns A list of states for each relay.

Returns:



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

def relay_states
  @relay_states
end

#vehicle_id ⇒ String (readonly)

Returns The ID of the vehicle that the engine immobilizer is connected to.

Returns:

  • (String) —

    The ID of the vehicle that the engine immobilizer is connected to.



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

def vehicle_id
  @vehicle_id
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  happened_at_time = parsed_json["happenedAtTime"]
  is_connected_to_vehicle = parsed_json["isConnectedToVehicle"]
  relay_states = parsed_json["relayStates"]&.map do | item |
  item = item.to_json
  Samsara::Types::EngineImmobilizerRelayStateResponseBody.from_json(json_object: item)
end
  vehicle_id = parsed_json["vehicleId"]
  new(
    happened_at_time: happened_at_time,
    is_connected_to_vehicle: is_connected_to_vehicle,
    relay_states: relay_states,
    vehicle_id: vehicle_id,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

def self.validate_raw(obj:)
  obj.happened_at_time.is_a?(String) != false || raise("Passed value for field obj.happened_at_time is not the expected type, validation failed.")
  obj.is_connected_to_vehicle.is_a?(Boolean) != false || raise("Passed value for field obj.is_connected_to_vehicle is not the expected type, validation failed.")
  obj.relay_states.is_a?(Array) != false || raise("Passed value for field obj.relay_states is not the expected type, validation failed.")
  obj.vehicle_id.is_a?(String) != false || raise("Passed value for field obj.vehicle_id is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


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

def to_json
  @_field_set&.to_json
end