Class: Samsara::Types::GoaRouteStopTinyResponseResponseBody

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

Overview

A minified route stop object

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::GoaRouteStopTinyResponseResponseBody

Parameters:

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

    A map of external ids

  • id (String) (defaults to: OMIT) —

    Id of the route stop

  • name (String) (defaults to: OMIT) —

    Name of the route stop

  • 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_stop_tiny_response_response_body.rb', line 28

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_properties ⇒ OpenStruct (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_stop_tiny_response_response_body.rb', line 16

def additional_properties
  @additional_properties
end

#external_ids ⇒ Hash{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_stop_tiny_response_response_body.rb', line 10

def external_ids
  @external_ids
end

#id ⇒ String (readonly)

Returns Id of the route stop.

Returns:

  • (String) —

    Id of the route stop



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

def id
  @id
end

#name ⇒ String (readonly)

Returns Name of the route stop.

Returns:

  • (String) —

    Name of the route stop



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

def name
  @name
end

Class Method Details

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

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_stop_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_stop_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_json ⇒ String

Returns:

  • (String)


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

def to_json
  @_field_set&.to_json
end