class Checkoff::Workspaces

Query different workspaces of Asana projects

Constants

DAY
HOUR
LONG_CACHE_TIME
MINUTE
REALLY_LONG_CACHE_TIME
SHORT_CACHE_TIME

Attributes

client[R]

Public Class Methods

new(config: Checkoff::ConfigLoader.load(:asana), clients: Checkoff::Clients.new(config: config), client: clients.client) click to toggle source
# File lib/checkoff/workspaces.rb, line 20
def initialize(config: Checkoff::ConfigLoader.load(:asana),
               clients: Checkoff::Clients.new(config: config),
               client: clients.client)
  @config = config
  @client = client
end

Public Instance Methods

workspace(workspace_name) click to toggle source

Pulls an Asana workspace object

# File lib/checkoff/workspaces.rb, line 28
def workspace(workspace_name)
  client.workspaces.find_all.find do |workspace|
    workspace.name == workspace_name
  end
end
workspace_or_raise(workspace_name) click to toggle source
# File lib/checkoff/workspaces.rb, line 34
def workspace_or_raise(workspace_name)
  workspace = workspace(workspace_name)
  raise "Could not find workspace #{workspace_name}" if workspace.nil?

  workspace
end

Private Instance Methods

default_workspace_gid() click to toggle source
# File lib/checkoff/workspaces.rb, line 45
def default_workspace_gid
  @config.fetch(:default_workspace_gid)
end