Sha256: 66483ce9f6d41764d4c850d205982b099fba1a4d1291103cd82c0a478b8c9371
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'oauth2' module CobotClient # Used to install links into the Cobot navigation of a space. class NavigationLinkService # oauth_client - an CobotClient::ApiClient # access_token - an access token string (owner must be admin of the space to be used) def initialize(api_client, space_sudomain) @api_client = api_client @subdomain = space_sudomain end # 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]` def install_links(new_links) if (links = get_links).empty? new_links.each do |link| links << create_link(link) end end links end private def get_links @api_client.get(@subdomain, "/navigation_links").map do |attributes| NavigationLink.new attributes end end def create_link(link) response = @api_client.post(@subdomain, '/navigation_links', section: link.section, label: link.label, iframe_url: link.iframe_url ) NavigationLink.new response end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cobot_client-1.0.0 | lib/cobot_client/navigation_link_service.rb |