Class: Samsara::Types::RouteStopEstimatedArrivalDetailsObjectResponseBody

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

Overview

Details specific to Route Stop Estimated Arrival

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(alert_before_arrival_milliseconds:, has_live_share_link: OMIT, is_alert_on_route_stop_only: OMIT, location:, additional_properties: nil) ⇒ Samsara::Types::RouteStopEstimatedArrivalDetailsObjectResponseBody

Parameters:



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

def initialize(alert_before_arrival_milliseconds:, has_live_share_link: OMIT, is_alert_on_route_stop_only: OMIT, location:, additional_properties: nil)
  @alert_before_arrival_milliseconds = alert_before_arrival_milliseconds
  @has_live_share_link = has_live_share_link if has_live_share_link != OMIT
  @is_alert_on_route_stop_only = is_alert_on_route_stop_only if is_alert_on_route_stop_only != OMIT
  @location = location
  @additional_properties = additional_properties
  @_field_set = { "alertBeforeArrivalMilliseconds": alert_before_arrival_milliseconds, "hasLiveShareLink": has_live_share_link, "isAlertOnRouteStopOnly": is_alert_on_route_stop_only, "location": location }.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



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

def additional_properties
  @additional_properties
end

#alert_before_arrival_milliseconds ⇒ Object (readonly)

than the threshold.



12
13
14
# File 'lib/samsara_api/types/route_stop_estimated_arrival_details_object_response_body.rb', line 12

def alert_before_arrival_milliseconds
  @alert_before_arrival_milliseconds
end

Returns If true, will include a live sharing link in the alert. Defaults to false.

Returns:

  • (Boolean) —

    If true, will include a live sharing link in the alert. Defaults to false.



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

def has_live_share_link
  @has_live_share_link
end

#is_alert_on_route_stop_only ⇒ Object (readonly)

false.



17
18
19
# File 'lib/samsara_api/types/route_stop_estimated_arrival_details_object_response_body.rb', line 17

def is_alert_on_route_stop_only
  @is_alert_on_route_stop_only
end

#location ⇒ Samsara::Types::LocationObjectResponseBody (readonly)



19
20
21
# File 'lib/samsara_api/types/route_stop_estimated_arrival_details_object_response_body.rb', line 19

def location
  @location
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/samsara_api/types/route_stop_estimated_arrival_details_object_response_body.rb', line 51

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  alert_before_arrival_milliseconds = parsed_json["alertBeforeArrivalMilliseconds"]
  has_live_share_link = parsed_json["hasLiveShareLink"]
  is_alert_on_route_stop_only = parsed_json["isAlertOnRouteStopOnly"]
  unless parsed_json["location"].nil?
    location = parsed_json["location"].to_json
    location = Samsara::Types::LocationObjectResponseBody.from_json(json_object: location)
  else
    location = nil
  end
  new(
    alert_before_arrival_milliseconds: alert_before_arrival_milliseconds,
    has_live_share_link: has_live_share_link,
    is_alert_on_route_stop_only: is_alert_on_route_stop_only,
    location: location,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


84
85
86
87
88
89
# File 'lib/samsara_api/types/route_stop_estimated_arrival_details_object_response_body.rb', line 84

def self.validate_raw(obj:)
  obj.alert_before_arrival_milliseconds.is_a?(Long) != false || raise("Passed value for field obj.alert_before_arrival_milliseconds is not the expected type, validation failed.")
  obj.has_live_share_link&.is_a?(Boolean) != false || raise("Passed value for field obj.has_live_share_link is not the expected type, validation failed.")
  obj.is_alert_on_route_stop_only&.is_a?(Boolean) != false || raise("Passed value for field obj.is_alert_on_route_stop_only is not the expected type, validation failed.")
  Samsara::Types::LocationObjectResponseBody.validate_raw(obj: obj.location)
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


75
76
77
# File 'lib/samsara_api/types/route_stop_estimated_arrival_details_object_response_body.rb', line 75

def to_json
  @_field_set&.to_json
end