Class: Buggy::Controllers::Resource
- Inherits:
-
R
- Object
- R
- Buggy::Controllers::Resource
- Defined in:
- lib/buggy.rb
Instance Method Summary collapse
Instance Method Details
#get ⇒ Object
65 66 67 68 69 |
# File 'lib/buggy.rb', line 65 def get @headers['Content-Type'] = 'text/xml charset=utf8' @bugs = Bug.find(:all, :limit => 10, :conditions => ["closed=?",0]) render :apilist end |
#post ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/buggy.rb', line 71 def post doc = Hpricot(input.bug) @bug = Bug.new @bug.priority = (doc/:bug/:priority).first.innerHTML @bug.project = (doc/:bug/:project).first.innerHTML @bug.body = (doc/:bug/:body).first.innerHTML @bug.closed = 0 if @bug.save @status = 201 render :apishow else @status = 500 end end |