dyoder (owner)

Revisions

gist: 120522 Download_button fork
public
Public Clone URL: git://gist.github.com/120522.git
rest_foundation_2.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class Blog
 
  include Waves::Resource::Server
 
  resource :list, :expires => 3.days, [ blogs ] do
    get { model.find_all }
  end
 
  resource :element, :expires => 3.days, [ blog, :name ] do
    get { model.find_by_name( captured.name ) }
  end
 
  schema :element, [ 'schema', 'blog', '2009-03' ] do
    attributes :title => String, :description => String
    link :entries, :list => Story
  end
 
  representations :list do
    as :html, :lang => :en do | blogs |
      view( :blog ).list( blogs )
    end
  end
 
  representations :element do
    as :html, :lang => :en do | blog |
      view( :blog ).show( blog )
    end
  end
 
end