Sha256: 6791b8d1fc35b0b33d8384ec1fcbfed7455ff1bca12c0c86f513ee7fad8c423d
Contents?: true
Size: 1.51 KB
Versions: 4
Compression:
Stored size: 1.51 KB
Contents
#!/usr/bin/env ruby require_relative './fiveapples.rb' FiveA.startdb class Cultivar < Sequel::Model(:cultivar) # Navigation attributes one_to_many :parent, :class => :Parentage, :key => :cultivar_id one_to_many :child, :class => :Parentage, :key => :parent_id many_to_one :breeder, :key => :breeder_id end class ParentageType < Sequel::Model(:par_type) end class Breeder < Sequel::Model(:breeder) one_to_many :cultivar, :key => :breeder_id end class Parentage < Sequel::Model(:parentage) # A parentage is for a given cultivar; there can be multiple parentage records # (type: father or mother), or one (type seedling) or none # many_to_one :cultivar, :class => :Cultivar, :key=>:cultivar_id many_to_one :parent, :class=> :Cultivar, :key=>:parent_id many_to_one :par_type, :class=>:ParentageType, :key => :ptype_id end ### SERVER Part ############################# class ODataFiveApples < OData::ServerApp publish_service do title 'Five apples OData API' name 'FiveApplesService' namespace 'ODataFiveApples' path_prefix '/odata' publish_model Cultivar, :cultivar do add_nav_prop_single :breeder add_nav_prop_collection :parent add_nav_prop_collection :child end publish_model Breeder, :breeder do add_nav_prop_collection :cultivar end publish_model ParentageType, :par_type publish_model Parentage, :parentage do add_nav_prop_single :parent add_nav_prop_single :cultivar add_nav_prop_single :par_type end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fiveapples-0.0.4 | lib/model.rb |
fiveapples-0.0.3 | lib/model.rb |
fiveapples-0.0.2 | lib/model.rb |
fiveapples-0.0.1 | lib/model.rb |