Class: Samsara::Types::LocationObjectResponseBody

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

Overview

least one location must be selected.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address_ids: OMIT, address_types: OMIT, circle: OMIT, polygon: OMIT, tag_ids: OMIT, additional_properties: nil) ⇒ Samsara::Types::LocationObjectResponseBody

Parameters:



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/samsara_api/types/location_object_response_body.rb', line 38

def initialize(address_ids: OMIT, address_types: OMIT, circle: OMIT, polygon: OMIT, tag_ids: OMIT, additional_properties: nil)
  @address_ids = address_ids if address_ids != OMIT
  @address_types = address_types if address_types != OMIT
  @circle = circle if circle != OMIT
  @polygon = polygon if polygon != OMIT
  @tag_ids = tag_ids if tag_ids != OMIT
  @additional_properties = additional_properties
  @_field_set = { "addressIds": address_ids, "addressTypes": address_types, "circle": circle, "polygon": polygon, "tagIds": tag_ids }.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



24
25
26
# File 'lib/samsara_api/types/location_object_response_body.rb', line 24

def additional_properties
  @additional_properties
end

#address_idsArray<String> (readonly)

Returns All locations with selected address IDs will trigger.

Returns:

  • (Array<String>)

    All locations with selected address IDs will trigger.



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

def address_ids
  @address_ids
end

#address_typesArray<Samsara::Types::LocationObjectResponseBodyAddressTypesItem> (readonly)

Returns All locations with the selected address types will trigger.

Returns:



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

def address_types
  @address_types
end

#circleSamsara::Types::CircleResponseBody (readonly)



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

def circle
  @circle
end

#polygonSamsara::Types::PolygonResponseBody (readonly)



20
21
22
# File 'lib/samsara_api/types/location_object_response_body.rb', line 20

def polygon
  @polygon
end

#tag_idsArray<String> (readonly)

Returns All locations with selected tag will trigger.

Returns:

  • (Array<String>)

    All locations with selected tag will trigger.



22
23
24
# File 'lib/samsara_api/types/location_object_response_body.rb', line 22

def tag_ids
  @tag_ids
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/samsara_api/types/location_object_response_body.rb', line 53

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  address_ids = parsed_json["addressIds"]
  address_types = parsed_json["addressTypes"]
  unless parsed_json["circle"].nil?
    circle = parsed_json["circle"].to_json
    circle = Samsara::Types::CircleResponseBody.from_json(json_object: circle)
  else
    circle = nil
  end
  unless parsed_json["polygon"].nil?
    polygon = parsed_json["polygon"].to_json
    polygon = Samsara::Types::PolygonResponseBody.from_json(json_object: polygon)
  else
    polygon = nil
  end
  tag_ids = parsed_json["tagIds"]
  new(
    address_ids: address_ids,
    address_types: address_types,
    circle: circle,
    polygon: polygon,
    tag_ids: tag_ids,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


92
93
94
95
96
97
98
# File 'lib/samsara_api/types/location_object_response_body.rb', line 92

def self.validate_raw(obj:)
  obj.address_ids&.is_a?(Array) != false || raise("Passed value for field obj.address_ids is not the expected type, validation failed.")
  obj.address_types&.is_a?(Array) != false || raise("Passed value for field obj.address_types is not the expected type, validation failed.")
  obj.circle.nil? || Samsara::Types::CircleResponseBody.validate_raw(obj: obj.circle)
  obj.polygon.nil? || Samsara::Types::PolygonResponseBody.validate_raw(obj: obj.polygon)
  obj.tag_ids&.is_a?(Array) != false || raise("Passed value for field obj.tag_ids is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


83
84
85
# File 'lib/samsara_api/types/location_object_response_body.rb', line 83

def to_json
  @_field_set&.to_json
end