Class: Samsara::Types::WebhookRouteResponseObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::WebhookRouteResponseObjectResponseBody
- Defined in:
- lib/samsara_api/types/webhook_route_response_object_response_body.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#actual_route_end_time ⇒ DateTime
readonly
Actual end time, if it exists, for the route in RFC 3339 format.
-
#actual_route_start_time ⇒ DateTime
readonly
Actual start time, if it exists, for the route in RFC 3339 format.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#external_ids ⇒ Hash{String => String}
readonly
A map of external ids.
-
#id ⇒ String
readonly
ID of the route.
-
#name ⇒ String
readonly
Route name.
-
#notes ⇒ String
readonly
Notes for the route.
-
#scheduled_route_end_time ⇒ DateTime
readonly
Scheduled end time, if it exists, for the route in RFC 3339 format.
-
#scheduled_route_start_time ⇒ DateTime
readonly
Scheduled start time, if it exists, for the route in RFC 3339 format.
- #settings ⇒ Samsara::Types::RouteSettingsResponseBody readonly
-
#stops ⇒ Array<Samsara::Types::RoutesStopResponseObjectResponseBody>
readonly
List of stops along the route.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::WebhookRouteResponseObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(actual_route_end_time: OMIT, actual_route_start_time: OMIT, external_ids: OMIT, id:, name: OMIT, notes: OMIT, scheduled_route_end_time: OMIT, scheduled_route_start_time: OMIT, settings: OMIT, stops: OMIT, additional_properties: nil) ⇒ Samsara::Types::WebhookRouteResponseObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(actual_route_end_time: OMIT, actual_route_start_time: OMIT, external_ids: OMIT, id:, name: OMIT, notes: OMIT, scheduled_route_end_time: OMIT, scheduled_route_start_time: OMIT, settings: OMIT, stops: OMIT, additional_properties: nil) ⇒ Samsara::Types::WebhookRouteResponseObjectResponseBody
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 54 def initialize(actual_route_end_time: OMIT, actual_route_start_time: OMIT, external_ids: OMIT, id:, name: OMIT, notes: OMIT, scheduled_route_end_time: OMIT, scheduled_route_start_time: OMIT, settings: OMIT, stops: OMIT, additional_properties: nil) @actual_route_end_time = actual_route_end_time if actual_route_end_time != OMIT @actual_route_start_time = actual_route_start_time if actual_route_start_time != OMIT @external_ids = external_ids if external_ids != OMIT @id = id @name = name if name != OMIT @notes = notes if notes != OMIT @scheduled_route_end_time = scheduled_route_end_time if scheduled_route_end_time != OMIT @scheduled_route_start_time = scheduled_route_start_time if scheduled_route_start_time != OMIT @settings = settings if settings != OMIT @stops = stops if stops != OMIT @additional_properties = additional_properties @_field_set = { "actualRouteEndTime": actual_route_end_time, "actualRouteStartTime": actual_route_start_time, "externalIds": external_ids, "id": id, "name": name, "notes": notes, "scheduledRouteEndTime": scheduled_route_end_time, "scheduledRouteStartTime": scheduled_route_start_time, "settings": settings, "stops": stops }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#actual_route_end_time ⇒ DateTime (readonly)
Returns Actual end time, if it exists, for the route in RFC 3339 format.
15 16 17 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 15 def actual_route_end_time @actual_route_end_time end |
#actual_route_start_time ⇒ DateTime (readonly)
Returns Actual start time, if it exists, for the route in RFC 3339 format.
17 18 19 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 17 def actual_route_start_time @actual_route_start_time end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
35 36 37 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 35 def additional_properties @additional_properties end |
#external_ids ⇒ Hash{String => String} (readonly)
Returns A map of external ids.
19 20 21 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 19 def external_ids @external_ids end |
#id ⇒ String (readonly)
Returns ID of the route.
21 22 23 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 21 def id @id end |
#name ⇒ String (readonly)
Returns Route name.
23 24 25 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 23 def name @name end |
#notes ⇒ String (readonly)
Returns Notes for the route.
25 26 27 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 25 def notes @notes end |
#scheduled_route_end_time ⇒ DateTime (readonly)
Returns Scheduled end time, if it exists, for the route in RFC 3339 format.
27 28 29 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 27 def scheduled_route_end_time @scheduled_route_end_time end |
#scheduled_route_start_time ⇒ DateTime (readonly)
Returns Scheduled start time, if it exists, for the route in RFC 3339 format.
29 30 31 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 29 def scheduled_route_start_time @scheduled_route_start_time end |
#settings ⇒ Samsara::Types::RouteSettingsResponseBody (readonly)
31 32 33 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 31 def settings @settings end |
#stops ⇒ Array<Samsara::Types::RoutesStopResponseObjectResponseBody> (readonly)
Returns List of stops along the route.
33 34 35 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 33 def stops @stops end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::WebhookRouteResponseObjectResponseBody
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 75 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) actual_route_end_time = unless parsed_json["actualRouteEndTime"].nil? DateTime.parse(parsed_json["actualRouteEndTime"]) else nil end actual_route_start_time = unless parsed_json["actualRouteStartTime"].nil? DateTime.parse(parsed_json["actualRouteStartTime"]) else nil end external_ids = parsed_json["externalIds"] id = parsed_json["id"] name = parsed_json["name"] notes = parsed_json["notes"] scheduled_route_end_time = unless parsed_json["scheduledRouteEndTime"].nil? DateTime.parse(parsed_json["scheduledRouteEndTime"]) else nil end scheduled_route_start_time = unless parsed_json["scheduledRouteStartTime"].nil? DateTime.parse(parsed_json["scheduledRouteStartTime"]) else nil end unless parsed_json["settings"].nil? settings = parsed_json["settings"].to_json settings = Samsara::Types::RouteSettingsResponseBody.from_json(json_object: settings) else settings = nil end stops = parsed_json["stops"]&.map do | item | item = item.to_json Samsara::Types::RoutesStopResponseObjectResponseBody.from_json(json_object: item) end new( actual_route_end_time: actual_route_end_time, actual_route_start_time: actual_route_start_time, external_ids: external_ids, id: id, name: name, notes: notes, scheduled_route_end_time: scheduled_route_end_time, scheduled_route_start_time: scheduled_route_start_time, settings: settings, stops: stops, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 138 def self.validate_raw(obj:) obj.actual_route_end_time&.is_a?(DateTime) != false || raise("Passed value for field obj.actual_route_end_time is not the expected type, validation failed.") obj.actual_route_start_time&.is_a?(DateTime) != false || raise("Passed value for field obj.actual_route_start_time is not the expected type, validation failed.") obj.external_ids&.is_a?(Hash) != false || raise("Passed value for field obj.external_ids is not the expected type, validation failed.") 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.") obj.notes&.is_a?(String) != false || raise("Passed value for field obj.notes is not the expected type, validation failed.") obj.scheduled_route_end_time&.is_a?(DateTime) != false || raise("Passed value for field obj.scheduled_route_end_time is not the expected type, validation failed.") obj.scheduled_route_start_time&.is_a?(DateTime) != false || raise("Passed value for field obj.scheduled_route_start_time is not the expected type, validation failed.") obj.settings.nil? || Samsara::Types::RouteSettingsResponseBody.validate_raw(obj: obj.settings) obj.stops&.is_a?(Array) != false || raise("Passed value for field obj.stops is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
129 130 131 |
# File 'lib/samsara_api/types/webhook_route_response_object_response_body.rb', line 129 def to_json @_field_set&.to_json end |