Class: Samsara::Types::WorkflowAddressEventWithGeofenceObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::WorkflowAddressEventWithGeofenceObjectResponseBody
- 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#external_ids ⇒ Hash{String => String}
readonly
A map of external ids.
-
#formatted_address ⇒ Object
readonly
Google Maps.
- #geofence ⇒ Samsara::Types::WorkflowGeofenceResponseBody readonly
-
#id ⇒ String
readonly
Id of the address.
-
#name ⇒ String
readonly
Name of the address.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::WorkflowAddressEventWithGeofenceObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(external_ids: OMIT, formatted_address:, geofence: OMIT, id:, name:, additional_properties: nil) ⇒ Samsara::Types::WorkflowAddressEventWithGeofenceObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(external_ids: OMIT, formatted_address:, geofence: OMIT, id:, name:, additional_properties: nil) ⇒ Samsara::Types::WorkflowAddressEventWithGeofenceObjectResponseBody
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.
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.
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.
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.
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
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
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
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 |