Sha256: 353b02853944eefd42594ba044c1c460b104605b2ae5491cc2ec20798b9e0b2d
Contents?: true
Size: 990 Bytes
Versions: 9
Compression:
Stored size: 990 Bytes
Contents
# frozen_string_literal: true module Checkoff # Query different workspaces of Asana projects class Workspaces def initialize(config: Checkoff::ConfigLoader.load(:asana), asana_client: Asana::Client) @config = config @asana_client = asana_client end # Returns Asana Ruby API Client object def client @client ||= @asana_client.new do |c| c.authentication :access_token, @config.fetch(:personal_access_token) c.default_headers 'asana-enable' => 'string_ids,new_sections' c.default_headers 'asana-disable' => 'new_user_task_lists' end end # Pulls an Asana workspace object def workspace_by_name(workspace_name) client.workspaces.find_all.find do |workspace| workspace.name == workspace_name end || raise("Could not find workspace named [#{workspace_name}]") end private def default_workspace_gid @config.fetch(:default_workspace_gid) end end end
Version data entries
9 entries across 9 versions & 1 rubygems