z4r / python-rtkit

Python Api for Request Tracker's REST interface
http://z4r.github.com/python-rtkit/
Other
68 stars 44 forks source link

OO Style #20

Closed daffodil closed 11 years ago

daffodil commented 11 years ago

I;ve just pushed a little patch to a branch which I'm using..

The idea is that it casts what returned into an Object then little helper makes it into a dict, custom fields etc.

https://rtkit.readthedocs.org/en/latest/resource.html https://github.com/daffodil/python-rtkit/blob/pedro/rtkit/resource.py

I'm pretty new to RT Rest API, but one thing I dont want to have to do is learn the syntax of fields all over the places..

For exampel I Just want to create a new Ticket add a few values and just send it..

It looks like the entities is the way to do this, but for my purposed I would love..

tick = Ticket()
tick.Subject = "foo"
tick.Text = "bar"
tick.Queue = "HelpDesk"
tick.DateRequired = datetime.datetime.now()
tick.set_custom("X-ref", myId)
# conn
trackerObject = Tracker("server", USER, PASS, CookieAuthenticator)
success = tracker.new_ticket(tick)

Also I'm using dict's all over the place, from/to json etc.

The only snag I have with the entities is that they are not the same Case. eg self.Subject vs self.subject// and not sure that is a good idea.. And There is no simple way to simple create a "blank" Ticket or Comment" object ready to populate with data

any some thoughts Pedro

z4r commented 11 years ago

OO is working in progress in tracker and entities. Like I explain in #15 i don't want a "middle" level API.