Class: Samsara::Types::WorkflowCircleResponseBody

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

Overview

is a circle.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(latitude: OMIT, longitude: OMIT, radius_meters:, additional_properties: nil) ⇒ Samsara::Types::WorkflowCircleResponseBody

Parameters:

  • radius_meters (Long)

    The radius of the circular geofence in meters.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



31
32
33
34
35
36
37
38
39
# File 'lib/samsara_api/types/workflow_circle_response_body.rb', line 31

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



18
19
20
# File 'lib/samsara_api/types/workflow_circle_response_body.rb', line 18

def additional_properties
  @additional_properties
end

#latitudeFloat (readonly)

Returns Latitude of the address. Will be geocoded from formattedAddress if not provided.

Returns:

  • (Float)

    Latitude of the address. Will be geocoded from formattedAddress if not provided.



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

def latitude
  @latitude
end

#longitudeObject (readonly)

provided.



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

def longitude
  @longitude
end

#radius_metersLong (readonly)

Returns The radius of the circular geofence in meters.

Returns:

  • (Long)

    The radius of the circular geofence in meters.



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

def radius_meters
  @radius_meters
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/samsara_api/types/workflow_circle_response_body.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  latitude = parsed_json["latitude"]
  longitude = parsed_json["longitude"]
  radius_meters = parsed_json["radiusMeters"]
  new(
    latitude: latitude,
    longitude: longitude,
    radius_meters: radius_meters,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


69
70
71
72
73
# File 'lib/samsara_api/types/workflow_circle_response_body.rb', line 69

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

Instance Method Details

#to_jsonString

Returns:

  • (String)


60
61
62
# File 'lib/samsara_api/types/workflow_circle_response_body.rb', line 60

def to_json
  @_field_set&.to_json
end