Class: CobotClient::NavigationLinkService

Inherits:
Object
  • Object
show all
Includes:
UrlHelper
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

Methods included from UrlHelper

#cobot_url

Constructor Details

#initialize(oauth_client, access_token, space_sudomain) ⇒ NavigationLinkService

oauth_client - an OAuth2::Client access_token - an access token string (owner must be admin of the space to be used)



10
11
12
13
14
# File 'lib/cobot_client/navigation_link_service.rb', line 10

def initialize(oauth_client, access_token, space_sudomain)
  @oauth_client = oauth_client
  @access_token = access_token
  @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]`



21
22
23
24
25
26
27
28
# File 'lib/cobot_client/navigation_link_service.rb', line 21

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