Problems with Rubygem and Task

Answered

Comments

7 comments

  • Jakob Kær Poulsen

    Just to clarify. I fetch multiple tasks with the following line: 

    Podio::Task.find_all(my options)

    Thanks for the help.

    0
    Comment actions Permalink
  • Casper Fabricius

    Hi Jakob,

    Podio::Task.find and Podio::Task.find_all works fine for me. We use them inside the Podio web app, and I just retested them in the console to make sure. Also, the get to problem 2, I guess you must have overcome problem 1? If that's not the case, please supply the specific call you are making (exactly which options are you supplying?) and the exact error and stack trace you are getting. Feel free to replace any sensitive information with X's or something.

    As for created_by, I'm pretty sure that works just like it should. If you see "Created by [name] N days ago" on podio.com/tasks and you are looking at the same task from the API, you will see the same created_by information, as it is the same code that is getting executing. If you are still sure you are getting the wrong created_by, please supply the call you are making, the id of the task(s) with the wrong created_by, which created_by id you get and which you expect to get. You can also doublecheck what you get out using the sandbox API access: https://developers.podio.com/doc/tasks/get-task-22413

    0
    Comment actions Permalink
  • Jakob Kær Poulsen

    Hi Casper

    Thanks for that. Now everything is working just fine: I replaced Podio::Task.find() with Podio.connection.get('task/task_id'). The reason the former of the two didn't work is probably that the action where it is called is a POST-requested action. 

    Regarding Podio::Task.find_all() the created_by_id referred to the space, I've just realized. 

    Thanks for your help. 

    0
    Comment actions Permalink
  • Casper Fabricius

    Hi Jakob,

    All the former does is to make the latter call inside the method and deserialize it from a hash into a Ruby object. So the only reason the latter would work for you, but not the former, is if the deserialization goes wrong.

    I'd still like to see you code and the error (with stacktrace) you get when using Podio::Task.find(), as I'd like to get the client fixed if there is a problem.

    0
    Comment actions Permalink
  • Jakob Kær Poulsen

    Sure. No problem. I've set up a simple test to reproduce the problem. 

    Various code: http://cl.ly/text/0e1x2j1Z2H17

    Working code responds in html: #Faraday::Response:0x0000012f22a300

    Failing code responds: http://cl.ly/image/1h0z1S1t3l05

    Full trace: http://cl.ly/text/0K3b0y1L3V3X 

    0
    Comment actions Permalink
  • Casper Fabricius

    Okay, I've found and fixed the problem. Turns out the Podio client was assuming that the ActiveRecord class called User I assume you have in your app, was in fact an ActivePodio class. I've added a check, so it falls back to the Podio class and doesn't class with ActiveRecord models with the same name. You'll need to update your Podio gem to version 0.8.0.

    I've also updated our Rails sample project to prove that looking up a task now actually works, even with an ActiveRecord object named user: https://github.com/podio/podio_rails_sample

    Thanks a lot for your help with identifying this problem.

    0
    Comment actions Permalink
  • Jakob Kær Poulsen

    Awesome. I'll be sure to upgrade our gem. 

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk