Sha256: ef43f73885e8fd4194a37c1f06af07003b6f9bd079c2e024bb4d097229c60584

Contents?: true

Size: 2 KB

Versions: 5

Compression:

Stored size: 2 KB

Contents

require 'activefacts/api'

module ::Address

  class City < String
    value_type :length => 64
  end

  class CompanyName < String
    value_type 
    one_to_one :company                         # See Company.company_name
  end

  class FamilyName < String
    value_type :length => 20
    one_to_one :family                          # See Family.family_name
  end

  class GivenNames < String
    value_type :length => 20
  end

  class Number < String
    value_type :length => 12
  end

  class Postcode < String
    value_type 
  end

  class StreetLine < String
    value_type :length => 64
  end

  class Company
    identified_by :company_name
    has_one :address                            # See Address.all_company
    one_to_one :company_name, :mandatory => true  # See CompanyName.company
  end

  class Family
    identified_by :family_name
    one_to_one :family_name, :mandatory => true  # See FamilyName.family
  end

  class Person
    identified_by :family, :given_names
    has_one :address                            # See Address.all_person
    has_one :family, :mandatory => true         # See Family.all_person
    has_one :given_names, :mandatory => true    # See GivenNames.all_person
  end

  class Street
    identified_by :first_street_line, :second_street_line, :third_street_line
    has_one :first_street_line, :class => StreetLine, :mandatory => true  # See StreetLine.all_street_as_first_street_line
    has_one :second_street_line, :class => StreetLine  # See StreetLine.all_street_as_second_street_line
    has_one :third_street_line, :class => StreetLine  # See StreetLine.all_street_as_third_street_line
  end

  class Address
    identified_by :street_number, :street, :city, :postcode
    has_one :city, :mandatory => true           # See City.all_address
    has_one :postcode                           # See Postcode.all_address
    has_one :street, :mandatory => true         # See Street.all_address
    has_one :street_number, :class => Number    # See Number.all_address_as_street_number
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activefacts-examples-1.9.9 ruby/Address.rb
activefacts-examples-1.9.8 ruby/Address.rb
activefacts-examples-1.8.0 ruby/Address.rb
activefacts-examples-1.7.2 ruby/Address.rb
activefacts-examples-1.7.1 ruby/Address.rb