Class: Samsara::Types::BaseRouteResponseObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::BaseRouteResponseObjectResponseBody
- Defined in:
- lib/samsara_api/types/base_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.
- #driver ⇒ Samsara::Types::GoaDriverTinyResponseResponseBody readonly
-
#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.
-
#org_local_timezone ⇒ Object
readonly
here.
-
#recurring_route_live_sharing_links ⇒ Array<Samsara::Types::LiveSharingLinkResponseObjectResponseBody>
readonly
List of shareable, non-expired 'By recurring Route' Live Sharing Links.
-
#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.
- #vehicle ⇒ Samsara::Types::GoaVehicleTinyResponseResponseBody readonly
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::BaseRouteResponseObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(actual_route_end_time: OMIT, actual_route_start_time: OMIT, driver: OMIT, external_ids: OMIT, id:, name: OMIT, notes: OMIT, org_local_timezone: OMIT, recurring_route_live_sharing_links: OMIT, scheduled_route_end_time: OMIT, scheduled_route_start_time: OMIT, settings: OMIT, stops: OMIT, vehicle: OMIT, additional_properties: nil) ⇒ Samsara::Types::BaseRouteResponseObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(actual_route_end_time: OMIT, actual_route_start_time: OMIT, driver: OMIT, external_ids: OMIT, id:, name: OMIT, notes: OMIT, org_local_timezone: OMIT, recurring_route_live_sharing_links: OMIT, scheduled_route_end_time: OMIT, scheduled_route_start_time: OMIT, settings: OMIT, stops: OMIT, vehicle: OMIT, additional_properties: nil) ⇒ Samsara::Types::BaseRouteResponseObjectResponseBody
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 77 def initialize(actual_route_end_time: OMIT, actual_route_start_time: OMIT, driver: OMIT, external_ids: OMIT, id:, name: OMIT, notes: OMIT, org_local_timezone: OMIT, recurring_route_live_sharing_links: OMIT, scheduled_route_end_time: OMIT, scheduled_route_start_time: OMIT, settings: OMIT, stops: OMIT, vehicle: 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 @driver = driver if driver != OMIT @external_ids = external_ids if external_ids != OMIT @id = id @name = name if name != OMIT @notes = notes if notes != OMIT @org_local_timezone = org_local_timezone if org_local_timezone != OMIT @recurring_route_live_sharing_links = recurring_route_live_sharing_links if recurring_route_live_sharing_links != 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 @vehicle = vehicle if vehicle != OMIT @additional_properties = additional_properties @_field_set = { "actualRouteEndTime": actual_route_end_time, "actualRouteStartTime": actual_route_start_time, "driver": driver, "externalIds": external_ids, "id": id, "name": name, "notes": notes, "orgLocalTimezone": org_local_timezone, "recurringRouteLiveSharingLinks": recurring_route_live_sharing_links, "scheduledRouteEndTime": scheduled_route_end_time, "scheduledRouteStartTime": scheduled_route_start_time, "settings": settings, "stops": stops, "vehicle": vehicle }.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.
18 19 20 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 18 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.
20 21 22 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 20 def actual_route_start_time @actual_route_start_time end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
50 51 52 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 50 def additional_properties @additional_properties end |
#driver ⇒ Samsara::Types::GoaDriverTinyResponseResponseBody (readonly)
22 23 24 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 22 def driver @driver end |
#external_ids ⇒ Hash{String => String} (readonly)
Returns A map of external ids.
24 25 26 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 24 def external_ids @external_ids end |
#id ⇒ String (readonly)
Returns ID of the route.
26 27 28 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 26 def id @id end |
#name ⇒ String (readonly)
Returns Route name.
28 29 30 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 28 def name @name end |
#notes ⇒ String (readonly)
Returns Notes for the route.
30 31 32 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 30 def notes @notes end |
#org_local_timezone ⇒ Object (readonly)
here.
36 37 38 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 36 def org_local_timezone @org_local_timezone end |
#recurring_route_live_sharing_links ⇒ Array<Samsara::Types::LiveSharingLinkResponseObjectResponseBody> (readonly)
Returns List of shareable, non-expired 'By recurring Route' Live Sharing Links.
38 39 40 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 38 def recurring_route_live_sharing_links @recurring_route_live_sharing_links end |
#scheduled_route_end_time ⇒ DateTime (readonly)
Returns Scheduled end time, if it exists, for the route in RFC 3339 format.
40 41 42 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 40 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.
42 43 44 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 42 def scheduled_route_start_time @scheduled_route_start_time end |
#settings ⇒ Samsara::Types::RouteSettingsResponseBody (readonly)
44 45 46 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 44 def settings @settings end |
#stops ⇒ Array<Samsara::Types::RoutesStopResponseObjectResponseBody> (readonly)
Returns List of stops along the route.
46 47 48 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 46 def stops @stops end |
#vehicle ⇒ Samsara::Types::GoaVehicleTinyResponseResponseBody (readonly)
48 49 50 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 48 def vehicle @vehicle end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::BaseRouteResponseObjectResponseBody
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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 101 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 unless parsed_json["driver"].nil? driver = parsed_json["driver"].to_json driver = Samsara::Types::GoaDriverTinyResponseResponseBody.from_json(json_object: driver) else driver = nil end external_ids = parsed_json["externalIds"] id = parsed_json["id"] name = parsed_json["name"] notes = parsed_json["notes"] org_local_timezone = parsed_json["orgLocalTimezone"] recurring_route_live_sharing_links = parsed_json["recurringRouteLiveSharingLinks"]&.map do | item | item = item.to_json Samsara::Types::LiveSharingLinkResponseObjectResponseBody.from_json(json_object: item) end 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 unless parsed_json["vehicle"].nil? vehicle = parsed_json["vehicle"].to_json vehicle = Samsara::Types::GoaVehicleTinyResponseResponseBody.from_json(json_object: vehicle) else vehicle = nil end new( actual_route_end_time: actual_route_end_time, actual_route_start_time: actual_route_start_time, driver: driver, external_ids: external_ids, id: id, name: name, notes: notes, org_local_timezone: org_local_timezone, recurring_route_live_sharing_links: recurring_route_live_sharing_links, scheduled_route_end_time: scheduled_route_end_time, scheduled_route_start_time: scheduled_route_start_time, settings: settings, stops: stops, vehicle: vehicle, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 185 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.driver.nil? || Samsara::Types::GoaDriverTinyResponseResponseBody.validate_raw(obj: obj.driver) 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.org_local_timezone&.is_a?(String) != false || raise("Passed value for field obj.org_local_timezone is not the expected type, validation failed.") obj.recurring_route_live_sharing_links&.is_a?(Array) != false || raise("Passed value for field obj.recurring_route_live_sharing_links 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.") obj.vehicle.nil? || Samsara::Types::GoaVehicleTinyResponseResponseBody.validate_raw(obj: obj.vehicle) end |
Instance Method Details
#to_json ⇒ String
176 177 178 |
# File 'lib/samsara_api/types/base_route_response_object_response_body.rb', line 176 def to_json @_field_set&.to_json end |