class Checkoff::Tags
Work with tags in Asana
Constants
- DAY
- HOUR
- LONG_CACHE_TIME
- MINUTE
- REALLY_LONG_CACHE_TIME
- SHORT_CACHE_TIME
Attributes
client[R]
workspaces[R]
Public Class Methods
new(config: Checkoff::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), clients: Checkoff::Clients.new(config: config), client: clients.client)
click to toggle source
# File lib/checkoff/tags.rb, line 23 def initialize(config: Checkoff::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), clients: Checkoff::Clients.new(config: config), client: clients.client) @workspaces = workspaces @client = client end
Private Class Methods
run()
click to toggle source
# File lib/checkoff/tags.rb, line 53 def run workspace_name = ARGV[0] || raise('Please pass workspace name as first argument') tag_name = ARGV[1] || raise('Please pass tag name as second argument') tags = Checkoff::Tags.new tag = tags.tag_or_raise(workspace_name, tag_name) puts "Results: #{tag}" end
Public Instance Methods
tag(workspace_name, tag_name)
click to toggle source
# File lib/checkoff/tags.rb, line 39 def tag(workspace_name, tag_name) workspace = workspaces.workspace_or_raise(workspace_name) tags = client.tags.get_tags_for_workspace(workspace_gid: workspace.gid) tags.find { |tag| tag.name == tag_name } end
tag_or_raise(workspace_name, tag_name)
click to toggle source
# File lib/checkoff/tags.rb, line 31 def tag_or_raise(workspace_name, tag_name) tag = tag(workspace_name, tag_name) raise "Could not find tag #{tag_name} under workspace #{workspace_name}." if tag.nil? tag end