Class: CobotClient::NavigationLinkService

Inherits:
Object
  • Object
show all
Defined in:
lib/cobot_client/navigation_link_service.rb

Overview

Used to install links into the Cobot navigation of a space.

Instance Method Summary collapse

Constructor Details

#initialize(api_client, space_sudomain) ⇒ NavigationLinkService

api_client - an CobotClient::ApiClient access_token - an access token string (owner must be admin of the space to be used)



8
9
10
11
# File 'lib/cobot_client/navigation_link_service.rb', line 8

def initialize(api_client, space_sudomain)
  @api_client = api_client
  @subdomain = space_sudomain
end

Instance Method Details

Checks if links are already installed and if not installs them.

new_links - any number of ‘CobotClient::NavigationLink`s

Returns the links as ‘[CobotClient::NavigationLink]`



18
19
20
21
22
23
24
25
# File 'lib/cobot_client/navigation_link_service.rb', line 18

def install_links(new_links)
  if (links = get_links).empty?
    new_links.each do |link|
      links << create_link(link)
    end
  end
  links
end