Class: Samsara::Types::GoaRouteTinyResponseResponseBody

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

Overview

A minified representation of a single route.

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:, name: OMIT, additional_properties: nil) ⇒ Samsara::Types::GoaRouteTinyResponseResponseBody

Parameters:

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

    A map of external ids

  • id (String)

    Unique identifier for the route.

  • name (String) (defaults to: OMIT)

    Name of the route.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

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



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

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



10
11
12
# File 'lib/samsara_api/types/goa_route_tiny_response_response_body.rb', line 10

def external_ids
  @external_ids
end

#idString (readonly)

Returns Unique identifier for the route.

Returns:

  • (String)

    Unique identifier for the route.



12
13
14
# File 'lib/samsara_api/types/goa_route_tiny_response_response_body.rb', line 12

def id
  @id
end

#nameString (readonly)

Returns Name of the route.

Returns:

  • (String)

    Name of the route.



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

def name
  @name
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

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)


66
67
68
69
70
# File 'lib/samsara_api/types/goa_route_tiny_response_response_body.rb', line 66

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)


57
58
59
# File 'lib/samsara_api/types/goa_route_tiny_response_response_body.rb', line 57

def to_json
  @_field_set&.to_json
end