0

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?

hguza
  • 59
  • 2
  • 11

1 Answers1

0

It looks like you want to output the values. Use puts if you want output it into your console.

puts "\t* #{workspace.name} - projects:"

However, I noticed you are using redirect "/sign_in". I assume you are using some kind of framework? Then, use your framework's output methods.

Uzbekjon
  • 11,655
  • 3
  • 37
  • 54