Comments (2)
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.
Ah excellent!
thanks Anibal :D
from basecamp-wrapper.
Related Issues (20)
- Changing default return format HOT 7
- NoMethodError: undefined method `collect!' for #<Hash:0x00000100b74c50> HOT 1
- Launchpad Data HOT 1
- Cannot retrieve time entries HOT 2
- Milestone#list not functioning HOT 3
- 404 Errors when creating messages HOT 6
- Response Headers HOT 2
- 'Ignored' params in find call HOT 2
- comments pagination is not supported HOT 4
- Create project with template HOT 2
- Basecamp.record(s) methods HOT 1
- Basecamp::Message object returned after create HOT 2
- Not thread-safe HOT 1
- Todo Item ID missing from Time Entries HOT 1
- Accessing the todo_list from the todo_item HOT 3
- need help for method missing - todo_list.project_id HOT 1
- Using this with rails 2.3.5 HOT 1
- New Version Changed Things. HOT 2
- Doesn't handle 301 redirects HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from basecamp-wrapper.