Class: Samsara::AsyncLiveSharesClient
- Inherits:
-
Object
- Object
- Samsara::AsyncLiveSharesClient
- Defined in:
- lib/samsara_api/live_shares/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(assets_location_link_config: nil, assets_near_location_link_config: nil, assets_on_route_link_config: nil, description: nil, expires_at_time: nil, name:, type:, request_options: nil) ⇒ Object
api.live_shares.create(name: "Example Live Sharing Link name", type: ASSETS_LOCATION).
-
#delete(id:, request_options: nil) ⇒ Object
api.live_shares.delete(id: "id").
- #initialize(request_client:) ⇒ Samsara::AsyncLiveSharesClient constructor
-
#list(ids: nil, type: nil, limit: nil, after: nil, request_options: nil) ⇒ Object
api.live_shares.list.
-
#update(id:, description: nil, expires_at_time: nil, name:, request_options: nil) ⇒ Object
api.live_shares.update(id: "id", name: "Example Live Sharing Link name").
Constructor Details
#initialize(request_client:) ⇒ Samsara::AsyncLiveSharesClient
229 230 231 |
# File 'lib/samsara_api/live_shares/client.rb', line 229 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Samsara::AsyncRequestClient (readonly)
224 225 226 |
# File 'lib/samsara_api/live_shares/client.rb', line 224 def request_client @request_client end |
Instance Method Details
#create(assets_location_link_config: nil, assets_near_location_link_config: nil, assets_on_route_link_config: nil, description: nil, expires_at_time: nil, name:, type:, request_options: nil) ⇒ Object
api.live_shares.create(name: "Example Live Sharing Link name", type: ASSETS_LOCATION)
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/samsara_api/live_shares/client.rb', line 325 def create(assets_location_link_config: nil, assets_near_location_link_config: nil, assets_on_route_link_config: nil, description: nil, expires_at_time: nil, name:, type:, request_options: nil) Async do response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), assetsLocationLinkConfig: assets_location_link_config, assetsNearLocationLinkConfig: assets_near_location_link_config, assetsOnRouteLinkConfig: assets_on_route_link_config, description: description, expiresAtTime: expires_at_time, name: name, type: type }.compact req.url "#{@request_client.get_url(request_options: request_options)}/live-shares" end Samsara::Types::LiveSharingLinksCreateLiveSharingLinkResponseBody.from_json(json_object: response.body) end end |
#delete(id:, request_options: nil) ⇒ Object
api.live_shares.delete(id: "id")
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'lib/samsara_api/live_shares/client.rb', line 369 def delete(id:, request_options: nil) Async do response = @request_client.conn.delete do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "id": id }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: request_options)}/live-shares" end end end |
#list(ids: nil, type: nil, limit: nil, after: nil, request_options: nil) ⇒ Object
api.live_shares.list
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/samsara_api/live_shares/client.rb', line 264 def list(ids: nil, type: nil, limit: nil, after: nil, request_options: nil) Async do response = @request_client.conn.get do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "ids": ids, "type": type, "limit": limit, "after": after }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: request_options)}/live-shares" end Samsara::Types::LiveSharingLinksGetLiveSharingLinksResponseBody.from_json(json_object: response.body) end end |
#update(id:, description: nil, expires_at_time: nil, name:, request_options: nil) ⇒ Object
api.live_shares.update(id: "id", name: "Example Live Sharing Link name")
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/samsara_api/live_shares/client.rb', line 416 def update(id:, description: nil, expires_at_time: nil, name:, request_options: nil) Async do response = @request_client.conn.patch do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "id": id }.compact req.body = { **(&.additional_body_parameters || {}), description: description, expiresAtTime: expires_at_time, name: name }.compact req.url "#{@request_client.get_url(request_options: request_options)}/live-shares" end Samsara::Types::LiveSharingLinksUpdateLiveSharingLinkResponseBody.from_json(json_object: response.body) end end |