I am currently trying to get the list of projects I have on my asana account and post them on a webpage. I have already set up my oauth in Ruby which works. I am having issues figuring out now how to call the asana API for the projects. Here is the code that I am currently using:
get '/workspaces' do
if $client
"<h1>Workspaces</h1>" \
#u1 is an unordered html bulleted list; li defines the list item
$client.workspaces.find_all.each do |workspace|
get "\t* #{workspace.name} - projects:"
$client.projects.find_by_workspace(workspace: workspace.id).each do |projects|
get "\t\t- #{projects.name}"
"<ul>" + $client.projects.find_all.map { |w| "<li>#{w.name}</li>" }.join + "</ul>"
end
end
else
redirect '/sign_in'
end
end
I am getting the error message : undefined method `get' for #
file: app.rb location: block (2 levels) in <class:SinatraApp> line: 42
What other method should I be using other than get?