Class: Samsara::Types::GoaVehicleTinyResponseResponseBody

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

Overview

to the vehicle.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(external_ids: OMIT, id: OMIT, name: OMIT, additional_properties: nil) ⇒ Samsara::Types::GoaVehicleTinyResponseResponseBody

Parameters:

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

    A map of external ids

  • id (String) (defaults to: OMIT)

    ID of the vehicle

  • name (String) (defaults to: OMIT)

    Name of the vehicle

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
36
37
# File 'lib/samsara_api/types/goa_vehicle_tiny_response_response_body.rb', line 29

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



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

def additional_properties
  @additional_properties
end

#external_idsHash{String => String} (readonly)

Returns A map of external ids.

Returns:

  • (Hash{String => String})

    A map of external ids



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

def external_ids
  @external_ids
end

#idString (readonly)

Returns ID of the vehicle.

Returns:

  • (String)

    ID of the vehicle



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

def id
  @id
end

#nameString (readonly)

Returns Name of the vehicle.

Returns:

  • (String)

    Name of the vehicle



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

def name
  @name
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/samsara_api/types/goa_vehicle_tiny_response_response_body.rb', line 42

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


67
68
69
70
71
# File 'lib/samsara_api/types/goa_vehicle_tiny_response_response_body.rb', line 67

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

Instance Method Details

#to_jsonString

Returns:

  • (String)


58
59
60
# File 'lib/samsara_api/types/goa_vehicle_tiny_response_response_body.rb', line 58

def to_json
  @_field_set&.to_json
end