Class: Samsara::Types::ReverseGeo

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

Overview

Reverse geocoded information.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formatted_location: OMIT, additional_properties: nil) ⇒ Samsara::Types::ReverseGeo

Parameters:

  • formatted_location (String) (defaults to: OMIT)

    Formatted address of the reverse geocoding data.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



22
23
24
25
26
27
28
# File 'lib/samsara_api/types/reverse_geo.rb', line 22

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



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

def additional_properties
  @additional_properties
end

#formatted_locationString (readonly)

Returns Formatted address of the reverse geocoding data.

Returns:

  • (String)

    Formatted address of the reverse geocoding data.



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

def formatted_location
  @formatted_location
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



33
34
35
36
37
38
# File 'lib/samsara_api/types/reverse_geo.rb', line 33

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


51
52
53
# File 'lib/samsara_api/types/reverse_geo.rb', line 51

def self.validate_raw(obj:)
  obj.formatted_location&.is_a?(String) != false || raise("Passed value for field obj.formatted_location is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


42
43
44
# File 'lib/samsara_api/types/reverse_geo.rb', line 42

def to_json
  @_field_set&.to_json
end