Giter Site home page Giter Site logo

Comments (2)

anibalcucco avatar anibalcucco commented on May 27, 2024

Hey Chris,

That's because Basecamp doesn't send the id in the time entries API end point:

GET /time_entries/#{id}.xml

<time-entry>
<date type="date">2011-11-22</date>
<description/>
<hours type="float">2.0</hours>
<person-id type="integer">2222</person-id>
<todo-item-id type="integer">2222</todo-item-id>
<person-name>The Person Name</person-name>
</time-entry>

To do what you want you'll have to:

  • manually set the id
  • remove non editable attributes like person_name (in the docs they say GET /time_entries/#{id}/edit.xml retrieves only attributes that can be edited but i get the same as GET /time_entries/#{id}, it doesn't exclude person_name)

At least for me, this works:

> id = 222
# get the entry
> time_entry = Basecamp::TimeEntry.find(id)
# set id manually
> time_entry.id = id
# remove person_name to avoid "unknown attribute: person_name" error
> time_entry.attributes.delete("person_name")
# update attributes
> time_entry.hours = 4
# save
> time_entry.save
=> true

I know is a bit ugly but is the solution i found. If you find a better solution, let me know.

Hope this helps,
Anibal

from basecamp-wrapper.

chrxs avatar chrxs commented on May 27, 2024

Ah excellent!
thanks Anibal :D

from basecamp-wrapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.