Class: Samsara::Types::RoutesStopResponseObjectResponseBody

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(actual_arrival_time: OMIT, actual_departure_time: OMIT, address: OMIT, documents: OMIT, en_route_time: OMIT, eta: OMIT, external_ids: OMIT, id:, live_sharing_url: OMIT, location_live_sharing_links: OMIT, name:, notes: OMIT, ontime_window_after_arrival_ms: OMIT, ontime_window_before_arrival_ms: OMIT, scheduled_arrival_time: OMIT, scheduled_departure_time: OMIT, single_use_location: OMIT, skipped_time: OMIT, state:, additional_properties: nil) ⇒ Samsara::Types::RoutesStopResponseObjectResponseBody

Parameters:

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

    Additional properties unmapped to the current class definition



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
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 95

def initialize(actual_arrival_time: OMIT, actual_departure_time: OMIT, address: OMIT, documents: OMIT, en_route_time: OMIT, eta: OMIT, external_ids: OMIT, id:, live_sharing_url: OMIT, location_live_sharing_links: OMIT, name:, notes: OMIT, ontime_window_after_arrival_ms: OMIT, ontime_window_before_arrival_ms: OMIT, scheduled_arrival_time: OMIT, scheduled_departure_time: OMIT, single_use_location: OMIT, skipped_time: OMIT, state:, additional_properties: nil)
  @actual_arrival_time = actual_arrival_time if actual_arrival_time != OMIT
  @actual_departure_time = actual_departure_time if actual_departure_time != OMIT
  @address = address if address != OMIT
  @documents = documents if documents != OMIT
  @en_route_time = en_route_time if en_route_time != OMIT
  @eta = eta if eta != OMIT
  @external_ids = external_ids if external_ids != OMIT
  @id = id
  @live_sharing_url = live_sharing_url if live_sharing_url != OMIT
  @location_live_sharing_links = location_live_sharing_links if location_live_sharing_links != OMIT
  @name = name
  @notes = notes if notes != OMIT
  @ontime_window_after_arrival_ms = ontime_window_after_arrival_ms if ontime_window_after_arrival_ms != OMIT
  @ontime_window_before_arrival_ms = ontime_window_before_arrival_ms if ontime_window_before_arrival_ms != OMIT
  @scheduled_arrival_time = scheduled_arrival_time if scheduled_arrival_time != OMIT
  @scheduled_departure_time = scheduled_departure_time if scheduled_departure_time != OMIT
  @single_use_location = single_use_location if single_use_location != OMIT
  @skipped_time = skipped_time if skipped_time != OMIT
  @state = state
  @additional_properties = additional_properties
  @_field_set = { "actualArrivalTime": actual_arrival_time, "actualDepartureTime": actual_departure_time, "address": address, "documents": documents, "enRouteTime": en_route_time, "eta": eta, "externalIds": external_ids, "id": id, "liveSharingUrl": live_sharing_url, "locationLiveSharingLinks": location_live_sharing_links, "name": name, "notes": notes, "ontimeWindowAfterArrivalMs": ontime_window_after_arrival_ms, "ontimeWindowBeforeArrivalMs": ontime_window_before_arrival_ms, "scheduledArrivalTime": scheduled_arrival_time, "scheduledDepartureTime": scheduled_departure_time, "singleUseLocation": single_use_location, "skippedTime": skipped_time, "state": state }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#actual_arrival_time ⇒ DateTime (readonly)

Returns Actual arrival time, if it exists, for the route stop in RFC 3339 format.

Returns:

  • (DateTime) —

    Actual arrival time, if it exists, for the route stop in RFC 3339 format.



21
22
23
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 21

def actual_arrival_time
  @actual_arrival_time
end

#actual_departure_time ⇒ DateTime (readonly)

Returns Actual departure time, if it exists, for the route stop in RFC 3339 format.

Returns:

  • (DateTime) —

    Actual departure time, if it exists, for the route stop in RFC 3339 format.



23
24
25
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 23

def actual_departure_time
  @actual_departure_time
end

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



63
64
65
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 63

def additional_properties
  @additional_properties
end

#address ⇒ Samsara::Types::GoaAddressTinyResponseResponseBody (readonly)



25
26
27
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 25

def address
  @address
end

#documents ⇒ Array<Samsara::Types::GoaDocumentTinyResponseResponseBody> (readonly)

Returns List of documents associated with the stop.

Returns:



27
28
29
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 27

def documents
  @documents
end

#en_route_time ⇒ DateTime (readonly)

Returns The time the stop became en-route, in RFC 3339 format.

Returns:

  • (DateTime) —

    The time the stop became en-route, in RFC 3339 format.



29
30
31
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 29

def en_route_time
  @en_route_time
end

#eta ⇒ Object (readonly)

format.



32
33
34
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 32

def eta
  @eta
end

#external_ids ⇒ Hash{String => String} (readonly)

Returns A map of external ids.

Returns:

  • (Hash{String => String}) —

    A map of external ids



34
35
36
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 34

def external_ids
  @external_ids
end

#id ⇒ String (readonly)

Returns Id of the stop.

Returns:

  • (String) —

    Id of the stop



36
37
38
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 36

def id
  @id
end

#live_sharing_url ⇒ String (readonly)

Returns The shareable url of the stop's current status.

Returns:

  • (String) —

    The shareable url of the stop's current status.



38
39
40
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 38

def live_sharing_url
  @live_sharing_url
end

Returns List of shareable, non-expired 'By Location' Live Sharing Links.

Returns:



40
41
42
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 40

def location_live_sharing_links
  @location_live_sharing_links
end

#name ⇒ String (readonly)

Returns Name of the stop.

Returns:

  • (String) —

    Name of the stop



42
43
44
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 42

def name
  @name
end

#notes ⇒ String (readonly)

Returns Notes for the stop.

Returns:

  • (String) —

    Notes for the stop



44
45
46
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 44

def notes
  @notes
end

#ontime_window_after_arrival_ms ⇒ Object (readonly)

time during which the stop is considered 'on-time'.



47
48
49
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 47

def ontime_window_after_arrival_ms
  @ontime_window_after_arrival_ms
end

#ontime_window_before_arrival_ms ⇒ Object (readonly)

time during which the stop is considered 'on-time'.



50
51
52
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 50

def ontime_window_before_arrival_ms
  @ontime_window_before_arrival_ms
end

#scheduled_arrival_time ⇒ DateTime (readonly)

Returns Scheduled arrival time, if it exists, for the stop in RFC 3339 format.

Returns:

  • (DateTime) —

    Scheduled arrival time, if it exists, for the stop in RFC 3339 format.



52
53
54
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 52

def scheduled_arrival_time
  @scheduled_arrival_time
end

#scheduled_departure_time ⇒ DateTime (readonly)

Returns Scheduled departure time, if it exists, for the stop in RFC 3339 format.

Returns:

  • (DateTime) —

    Scheduled departure time, if it exists, for the stop in RFC 3339 format.



54
55
56
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 54

def scheduled_departure_time
  @scheduled_departure_time
end

#single_use_location ⇒ Samsara::Types::RoutesSingleUseAddressObjectResponseBody (readonly)



56
57
58
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 56

def single_use_location
  @single_use_location
end

#skipped_time ⇒ DateTime (readonly)

Returns Skipped time, if it exists, for the route stop in RFC 3339 format.

Returns:

  • (DateTime) —

    Skipped time, if it exists, for the route stop in RFC 3339 format.



58
59
60
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 58

def skipped_time
  @skipped_time
end

#state ⇒ Object (readonly)

en route, skipped, arrived, departed



61
62
63
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 61

def state
  @state
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 124

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  actual_arrival_time = unless parsed_json["actualArrivalTime"].nil?
  DateTime.parse(parsed_json["actualArrivalTime"])
else
  nil
end
  actual_departure_time = unless parsed_json["actualDepartureTime"].nil?
  DateTime.parse(parsed_json["actualDepartureTime"])
else
  nil
end
  unless parsed_json["address"].nil?
    address = parsed_json["address"].to_json
    address = Samsara::Types::GoaAddressTinyResponseResponseBody.from_json(json_object: address)
  else
    address = nil
  end
  documents = parsed_json["documents"]&.map do | item |
  item = item.to_json
  Samsara::Types::GoaDocumentTinyResponseResponseBody.from_json(json_object: item)
end
  en_route_time = unless parsed_json["enRouteTime"].nil?
  DateTime.parse(parsed_json["enRouteTime"])
else
  nil
end
  eta = unless parsed_json["eta"].nil?
  DateTime.parse(parsed_json["eta"])
else
  nil
end
  external_ids = parsed_json["externalIds"]
  id = parsed_json["id"]
  live_sharing_url = parsed_json["liveSharingUrl"]
  location_live_sharing_links = parsed_json["locationLiveSharingLinks"]&.map do | item |
  item = item.to_json
  Samsara::Types::LiveSharingLinkResponseObjectResponseBody.from_json(json_object: item)
end
  name = parsed_json["name"]
  notes = parsed_json["notes"]
  ontime_window_after_arrival_ms = parsed_json["ontimeWindowAfterArrivalMs"]
  ontime_window_before_arrival_ms = parsed_json["ontimeWindowBeforeArrivalMs"]
  scheduled_arrival_time = unless parsed_json["scheduledArrivalTime"].nil?
  DateTime.parse(parsed_json["scheduledArrivalTime"])
else
  nil
end
  scheduled_departure_time = unless parsed_json["scheduledDepartureTime"].nil?
  DateTime.parse(parsed_json["scheduledDepartureTime"])
else
  nil
end
  unless parsed_json["singleUseLocation"].nil?
    single_use_location = parsed_json["singleUseLocation"].to_json
    single_use_location = Samsara::Types::RoutesSingleUseAddressObjectResponseBody.from_json(json_object: single_use_location)
  else
    single_use_location = nil
  end
  skipped_time = unless parsed_json["skippedTime"].nil?
  DateTime.parse(parsed_json["skippedTime"])
else
  nil
end
  state = parsed_json["state"]
  new(
    actual_arrival_time: actual_arrival_time,
    actual_departure_time: actual_departure_time,
    address: address,
    documents: documents,
    en_route_time: en_route_time,
    eta: eta,
    external_ids: external_ids,
    id: id,
    live_sharing_url: live_sharing_url,
    location_live_sharing_links: location_live_sharing_links,
    name: name,
    notes: notes,
    ontime_window_after_arrival_ms: ontime_window_after_arrival_ms,
    ontime_window_before_arrival_ms: ontime_window_before_arrival_ms,
    scheduled_arrival_time: scheduled_arrival_time,
    scheduled_departure_time: scheduled_departure_time,
    single_use_location: single_use_location,
    skipped_time: skipped_time,
    state: state,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 225

def self.validate_raw(obj:)
  obj.actual_arrival_time&.is_a?(DateTime) != false || raise("Passed value for field obj.actual_arrival_time is not the expected type, validation failed.")
  obj.actual_departure_time&.is_a?(DateTime) != false || raise("Passed value for field obj.actual_departure_time is not the expected type, validation failed.")
  obj.address.nil? || Samsara::Types::GoaAddressTinyResponseResponseBody.validate_raw(obj: obj.address)
  obj.documents&.is_a?(Array) != false || raise("Passed value for field obj.documents is not the expected type, validation failed.")
  obj.en_route_time&.is_a?(DateTime) != false || raise("Passed value for field obj.en_route_time is not the expected type, validation failed.")
  obj.eta&.is_a?(DateTime) != false || raise("Passed value for field obj.eta 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.live_sharing_url&.is_a?(String) != false || raise("Passed value for field obj.live_sharing_url is not the expected type, validation failed.")
  obj.location_live_sharing_links&.is_a?(Array) != false || raise("Passed value for field obj.location_live_sharing_links 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.ontime_window_after_arrival_ms&.is_a?(Long) != false || raise("Passed value for field obj.ontime_window_after_arrival_ms is not the expected type, validation failed.")
  obj.ontime_window_before_arrival_ms&.is_a?(Long) != false || raise("Passed value for field obj.ontime_window_before_arrival_ms is not the expected type, validation failed.")
  obj.scheduled_arrival_time&.is_a?(DateTime) != false || raise("Passed value for field obj.scheduled_arrival_time is not the expected type, validation failed.")
  obj.scheduled_departure_time&.is_a?(DateTime) != false || raise("Passed value for field obj.scheduled_departure_time is not the expected type, validation failed.")
  obj.single_use_location.nil? || Samsara::Types::RoutesSingleUseAddressObjectResponseBody.validate_raw(obj: obj.single_use_location)
  obj.skipped_time&.is_a?(DateTime) != false || raise("Passed value for field obj.skipped_time is not the expected type, validation failed.")
  obj.state.is_a?(Samsara::Types::RoutesStopResponseObjectResponseBodyState) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


216
217
218
# File 'lib/samsara_api/types/routes_stop_response_object_response_body.rb', line 216

def to_json
  @_field_set&.to_json
end