Sha256: 2a950ac649b8fe97eb72faf4e21150a10d181d27cdc2c4875f82435602f780fd
Contents?: true
Size: 849 Bytes
Versions: 3
Compression:
Stored size: 849 Bytes
Contents
class TestApp < Sinatra::Base register Yaks::Sinatra class HomeMapper < Yaks::Mapper link 'http://myapi.example.com/rel/friends', '/friends' end class FriendMapper < Yaks::Mapper attribute :name def name object[:name] end form :poke do action '/poke/{name}' method 'POST' text :message end end class MessageMapper < Yaks::Mapper attribute :message do object[:message] end end configure_yaks do mapper_for :home, HomeMapper rel_template 'http://myapi.example.com/rel/{rel}' end get '/' do yaks :home end get '/friends' do yaks [{name: 'Matt'}, {name: 'Yohan'}, {name: 'Janko'}], item_mapper: FriendMapper end post '/poke/:name' do yaks({message: "You poked #{params[:name]}: #{params[:message]}"}, mapper: MessageMapper) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
yaks-html-0.13.0 | spec/support/test_app.rb |
yaks-html-0.12.0 | spec/support/test_app.rb |
yaks-html-0.11.0 | spec/support/test_app.rb |