File: personal_access_token.rb

package info (click to toggle)
ruby-asana 0.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 744 kB
  • sloc: ruby: 2,850; javascript: 8; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'bundler'
Bundler.require
require 'asana'

access_token = ENV['ASANA_ACCESS_TOKEN']
unless access_token
  abort "Run this program with the env var ASANA_ACCESS_TOKEN.\n"  \
    "Go to http://app.asana.com/-/account_api to create a personal access token."
end

client = Asana::Client.new do |c|
  c.authentication :access_token, access_token
end

puts "My Workspaces:"
client.workspaces.find_all.each do |workspace|
  puts "\t* #{workspace.name} - tags:"
  client.tags.find_by_workspace(workspace: workspace.id).each do |tag|
    puts "\t\t- #{tag.name}"
  end
end