Class: Samsara::Types::LiveSharingLinkFullResponseObjectResponseBody

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

Overview

Live Sharing Link object

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assets_location_link_config: OMIT, assets_near_location_link_config: OMIT, assets_on_route_link_config: OMIT, description: OMIT, expires_at_time: OMIT, id:, live_sharing_url:, name:, type:, additional_properties: nil) ⇒ Samsara::Types::LiveSharingLinkFullResponseObjectResponseBody

Parameters:

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

    Additional properties unmapped to the current class definition



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 52

def initialize(assets_location_link_config: OMIT, assets_near_location_link_config: OMIT, assets_on_route_link_config: OMIT, description: OMIT, expires_at_time: OMIT, id:, live_sharing_url:, name:, type:, additional_properties: nil)
  @assets_location_link_config = assets_location_link_config if assets_location_link_config != OMIT
  @assets_near_location_link_config = assets_near_location_link_config if assets_near_location_link_config != OMIT
  @assets_on_route_link_config = assets_on_route_link_config if assets_on_route_link_config != OMIT
  @description = description if description != OMIT
  @expires_at_time = expires_at_time if expires_at_time != OMIT
  @id = id
  @live_sharing_url = live_sharing_url
  @name = name
  @type = type
  @additional_properties = additional_properties
  @_field_set = { "assetsLocationLinkConfig": assets_location_link_config, "assetsNearLocationLinkConfig": assets_near_location_link_config, "assetsOnRouteLinkConfig": assets_on_route_link_config, "description": description, "expiresAtTime": expires_at_time, "id": id, "liveSharingUrl": live_sharing_url, "name": name, "type": type }.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



33
34
35
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 33

def additional_properties
  @additional_properties
end


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

def assets_location_link_config
  @assets_location_link_config
end


16
17
18
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 16

def assets_near_location_link_config
  @assets_near_location_link_config
end


18
19
20
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 18

def assets_on_route_link_config
  @assets_on_route_link_config
end

#description ⇒ String (readonly)

Returns Description for the Live Sharing Link (not applicable for 'assetsOnRoute' type).

Returns:

  • (String) —

    Description for the Live Sharing Link (not applicable for 'assetsOnRoute' type).



20
21
22
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 20

def description
  @description
end

#expires_at_time ⇒ String (readonly)

Returns Date that this link expires, in RFC 3339 format.

Returns:

  • (String) —

    Date that this link expires, in RFC 3339 format.



22
23
24
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 22

def expires_at_time
  @expires_at_time
end

#id ⇒ String (readonly)

Returns Unique identifier for the Live Sharing Link.

Returns:

  • (String) —

    Unique identifier for the Live Sharing Link.



24
25
26
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 24

def id
  @id
end

#live_sharing_url ⇒ String (readonly)

Returns The shareable URL of the vehicle's location.

Returns:

  • (String) —

    The shareable URL of the vehicle's location.



26
27
28
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 26

def live_sharing_url
  @live_sharing_url
end

#name ⇒ String (readonly)

Returns Name of the Live Sharing Link.

Returns:

  • (String) —

    Name of the Live Sharing Link.



28
29
30
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 28

def name
  @name
end

#type ⇒ Object (readonly)

assetsNearLocation, assetsOnRoute



31
32
33
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 31

def type
  @type
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



72
73
74
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
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 72

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["assetsLocationLinkConfig"].nil?
    assets_location_link_config = parsed_json["assetsLocationLinkConfig"].to_json
    assets_location_link_config = Samsara::Types::AssetsLocationLinkConfigObjectResponseBody.from_json(json_object: assets_location_link_config)
  else
    assets_location_link_config = nil
  end
  unless parsed_json["assetsNearLocationLinkConfig"].nil?
    assets_near_location_link_config = parsed_json["assetsNearLocationLinkConfig"].to_json
    assets_near_location_link_config = Samsara::Types::AssetsNearLocationLinkConfigObjectResponseBody.from_json(json_object: assets_near_location_link_config)
  else
    assets_near_location_link_config = nil
  end
  unless parsed_json["assetsOnRouteLinkConfig"].nil?
    assets_on_route_link_config = parsed_json["assetsOnRouteLinkConfig"].to_json
    assets_on_route_link_config = Samsara::Types::AssetsOnRouteLinkConfigObjectResponseBody.from_json(json_object: assets_on_route_link_config)
  else
    assets_on_route_link_config = nil
  end
  description = parsed_json["description"]
  expires_at_time = parsed_json["expiresAtTime"]
  id = parsed_json["id"]
  live_sharing_url = parsed_json["liveSharingUrl"]
  name = parsed_json["name"]
  type = parsed_json["type"]
  new(
    assets_location_link_config: assets_location_link_config,
    assets_near_location_link_config: assets_near_location_link_config,
    assets_on_route_link_config: assets_on_route_link_config,
    description: description,
    expires_at_time: expires_at_time,
    id: id,
    live_sharing_url: live_sharing_url,
    name: name,
    type: type,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


125
126
127
128
129
130
131
132
133
134
135
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 125

def self.validate_raw(obj:)
  obj.assets_location_link_config.nil? || Samsara::Types::AssetsLocationLinkConfigObjectResponseBody.validate_raw(obj: obj.assets_location_link_config)
  obj.assets_near_location_link_config.nil? || Samsara::Types::AssetsNearLocationLinkConfigObjectResponseBody.validate_raw(obj: obj.assets_near_location_link_config)
  obj.assets_on_route_link_config.nil? || Samsara::Types::AssetsOnRouteLinkConfigObjectResponseBody.validate_raw(obj: obj.assets_on_route_link_config)
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.expires_at_time&.is_a?(String) != false || raise("Passed value for field obj.expires_at_time 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.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.type.is_a?(Samsara::Types::LiveSharingLinkFullResponseObjectResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


116
117
118
# File 'lib/samsara_api/types/live_sharing_link_full_response_object_response_body.rb', line 116

def to_json
  @_field_set&.to_json
end