Sha256: 9cffed853b91b34c405cabd276d40c7f1063e4b23764844fb960ba278d88e2e4
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require 'anima' class Scholar include Anima.new(:id, :name, :pinyin, :latinized, :works) end class Work include Anima.new(:id, :chinese_name, :english_name, :quotes, :era) end class Quote include Anima.new(:id, :chinese, :english, :sources) end class Era include Anima.new(:id, :name) end class LiteratureBaseMapper < Yaks::Mapper link :profile, 'http://literature.example.com/profiles/{mapper_name}', expand: true link :self, 'http://literature.example.com/{mapper_name}/{id}' end class ScholarMapper < LiteratureBaseMapper attributes :id, :name, :pinyin, :latinized has_many :works link 'http://literature.example.com/rels/quotes', 'http://literature.example.com/quotes/?author={downcased_pinyin}&q={query}', expand: [:downcased_pinyin], title: 'Search for quotes' link :self, 'http://literature.example.com/authors/{downcased_pinyin}' form :search do title 'Find a Scholar' method 'POST' media_type 'application/x-www-form-urlencoded' field :name, label: 'Scholar Name', type: 'text' field :pinyin, label: 'Hanyu Pinyin', type: 'text' end def downcased_pinyin object.pinyin.downcase end end class WorkMapper < LiteratureBaseMapper attributes :id, :chinese_name, :english_name has_many :quotes has_one :era end class QuoteMapper < Yaks::Mapper attributes :id, :chinese end class EraMapper < Yaks::Mapper attributes :id, :name end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yaks-0.7.7 | spec/acceptance/models.rb |