Class: Samsara::Types::WorkflowAddressEventWithGeofenceObjectResponseBody

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

Overview

A minimal Address object representation used in AddressEventObject objects

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(external_ids: OMIT, formatted_address:, geofence: OMIT, id:, name:, additional_properties: nil) ⇒ Samsara::Types::WorkflowAddressEventWithGeofenceObjectResponseBody

Parameters:

  • geofence (Samsara::Types::WorkflowGeofenceResponseBody) (defaults to: OMIT)
  • id (String) —

    Id of the address

  • name (String) —

    Name of the address

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



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

def initialize(external_ids: OMIT, formatted_address:, geofence: OMIT, id:, name:, additional_properties: nil)
  @external_ids = external_ids if external_ids != OMIT
  @formatted_address = formatted_address
  @geofence = geofence if geofence != OMIT
  @id = id
  @name = name
  @additional_properties = additional_properties
  @_field_set = { "externalIds": external_ids, "formattedAddress": formatted_address, "geofence": geofence, "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



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

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



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

def external_ids
  @external_ids
end

#formatted_address ⇒ Object (readonly)

Google Maps.



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

def formatted_address
  @formatted_address
end

#geofence ⇒ Samsara::Types::WorkflowGeofenceResponseBody (readonly)



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

def geofence
  @geofence
end

#id ⇒ String (readonly)

Returns Id of the address.

Returns:

  • (String) —

    Id of the address



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

def id
  @id
end

#name ⇒ String (readonly)

Returns Name of the address.

Returns:

  • (String) —

    Name of the address



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

def name
  @name
end

Class Method Details

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

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
# File 'lib/samsara_api/types/workflow_address_event_with_geofence_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)
  external_ids = parsed_json["externalIds"]
  formatted_address = parsed_json["formattedAddress"]
  unless parsed_json["geofence"].nil?
    geofence = parsed_json["geofence"].to_json
    geofence = Samsara::Types::WorkflowGeofenceResponseBody.from_json(json_object: geofence)
  else
    geofence = nil
  end
  id = parsed_json["id"]
  name = parsed_json["name"]
  new(
    external_ids: external_ids,
    formatted_address: formatted_address,
    geofence: geofence,
    id: id,
    name: name,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


88
89
90
91
92
93
94
# File 'lib/samsara_api/types/workflow_address_event_with_geofence_object_response_body.rb', line 88

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.formatted_address.is_a?(String) != false || raise("Passed value for field obj.formatted_address is not the expected type, validation failed.")
  obj.geofence.nil? || Samsara::Types::WorkflowGeofenceResponseBody.validate_raw(obj: obj.geofence)
  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)


79
80
81
# File 'lib/samsara_api/types/workflow_address_event_with_geofence_object_response_body.rb', line 79

def to_json
  @_field_set&.to_json
end