Class: Samsara::Types::EngineImmobilizerRelayStateResponseBody

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

Overview

An engine immobilizer relay state.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, is_open:, additional_properties: nil) ⇒ Samsara::Types::EngineImmobilizerRelayStateResponseBody

Parameters:

  • id (Samsara::Types::EngineImmobilizerRelayStateResponseBodyId) —

    The ID of the relay Valid values: relay1, relay2

  • is_open (Boolean) —

    Whether the relay is open.

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

    Additional properties unmapped to the current class definition



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

def initialize(id:, is_open:, additional_properties: nil)
  @id = id
  @is_open = is_open
  @additional_properties = additional_properties
  @_field_set = { "id": id, "isOpen": is_open }
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



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

def additional_properties
  @additional_properties
end

#id ⇒ Samsara::Types::EngineImmobilizerRelayStateResponseBodyId (readonly)

Returns The ID of the relay Valid values: relay1, relay2.

Returns:



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

def id
  @id
end

#is_open ⇒ Boolean (readonly)

Returns Whether the relay is open.

Returns:

  • (Boolean) —

    Whether the relay is open.



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

def is_open
  @is_open
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  is_open = parsed_json["isOpen"]
  new(
    id: id,
    is_open: is_open,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


61
62
63
64
# File 'lib/samsara_api/types/engine_immobilizer_relay_state_response_body.rb', line 61

def self.validate_raw(obj:)
  obj.id.is_a?(Samsara::Types::EngineImmobilizerRelayStateResponseBodyId) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.is_open.is_a?(Boolean) != false || raise("Passed value for field obj.is_open is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


52
53
54
# File 'lib/samsara_api/types/engine_immobilizer_relay_state_response_body.rb', line 52

def to_json
  @_field_set&.to_json
end