Class: Buggy::Controllers::Resource

Inherits:
R
  • Object
show all
Defined in:
lib/buggy.rb

Instance Method Summary collapse

Instance Method Details

#getObject



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

#postObject



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