diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e515669..7373dbb 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,16 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2025-08-24 10:08:03 UTC using RuboCop version 1.80.0. +# on 2025-08-24 15:31:53 UTC using RuboCop version 1.80.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 -Lint/ShadowedException: - Exclude: - - 'lib/uddf/base/models.rb' - # Offense count: 4 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: diff --git a/lib/uddf/base/models.rb b/lib/uddf/base/models.rb index ccecedc..9408cf3 100644 --- a/lib/uddf/base/models.rb +++ b/lib/uddf/base/models.rb @@ -1,75 +1,12 @@ # frozen_string_literal: true +require "uddf/base/models/generic" +require "uddf/base/models/deco" +require "uddf/base/models/media" +require "uddf/base/models/dive_computer" + module UDDF module Base - module Models - ## - # Inside
the own ( element) address data, - # or that of dive buddies ( element), - # or that of a shop ( element) etc., are given. - class Address - include HappyMapper - - tag "address" - - has_one :street, String - has_one :city, String - has_one :postcode, String - has_one :country, String - has_one :province, String - end - - ## - # Inside data concerning getting in touch with some one are - # given, like phone number, email address, language etc. - class Contact - include HappyMapper - - tag "contact" - - has_many :emails, String, tag: "email" - has_many :faxes, String, tag: "fax" - has_many :homepages, String, tag: "homepage" - has_many :languages, String, tag: "language" - has_many :mobile_phones, String, tag: "mobilephone" - has_many :phones, String, tag: "phone" - end - - class DateTimeField - include HappyMapper - - element :raw, String, tag: "datetime" - - # Lazily parse on first access; memoize in @date_time - def date_time - return @date_time if @date_time - - content = raw.to_s.strip - return nil if content.empty? - - @date_time = - case content - when /^\d{4}$/ # "YYYY" - DateTime.new(content.to_i, 1, 1) - when /^\d{4}-\d{2}$/ # "YYYY-MM" - y, m = content.split("-").map!(&:to_i) - DateTime.new(y, m, 1) - else - begin - DateTime.iso8601(content) - rescue ArgumentError, Date::Error - begin - DateTime.rfc3339(content) - rescue ArgumentError, Date::Error - DateTime.parse(content) - end - end - end - end - - # Allow manual assignment if you ever need it - attr_writer :date_time - end - end + module Models; end end end diff --git a/lib/uddf/base/models/deco.rb b/lib/uddf/base/models/deco.rb new file mode 100644 index 0000000..ece7986 --- /dev/null +++ b/lib/uddf/base/models/deco.rb @@ -0,0 +1,102 @@ +# frozen_string_literal: true + +module UDDF + module Base + module Models + class Tissue + include HappyMapper + + tag "tissue" + + attribute :gas, String + attribute :half_life, Float, tag: "halflife" + attribute :number, Integer + attribute :a, Float + attribute :b, Float + end + + class Hargikas + include HappyMapper + + tag "hargikas" + + has_one :ambient, Float + has_many :tissues, Tissue, tag: "tissue" + has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel" + has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt" + has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel" + end + + class VPM + include HappyMapper + + tag "vpm" + + attribute :id, String + has_one :conservatism, Float + has_one :gamma, Float + has_one :gc, Float + has_one :lambda, Float + has_one :r0, Float + has_many :tissues, Tissue, tag: "tissue" + end + + class RGBM + include HappyMapper + + tag "rgbm" + + attribute :id, String + has_many :tissues, Tissue, tag: "tissue" + end + + class Buehlmann + include HappyMapper + + tag "buehlmann" + + attribute :id, String + has_many :tissues, Tissue, tag: "tissue" + end + + class BuehlmannV320 + include HappyMapper + + tag "buehlmann" + + attribute :id, String + has_one :gradient_factor_high, Float, tag: "gradientfactorhigh" + has_one :gradient_factor_low, Float, tag: "gradientfactorlow" + has_many :tissues, Tissue, tag: "tissue" + end + + class DecoModel + include HappyMapper + + tag "decomodel" + + content :value, String + end + + class DecoModelV310 + include HappyMapper + + tag "decomodel" + + has_many :buehlmanns, Buehlmann, tag: "buehlmann" + has_many :rgbms, RGBM, tag: "rbgm" + has_many :vpms, VPM, tag: "vpm" + end + + class DecoModelV320 + include HappyMapper + + tag "decomodel" + + has_many :buehlmanns, BuehlmannV320, tag: "buehlmann" + has_many :rgbms, RGBM, tag: "rbgm" + has_many :vpms, VPM, tag: "vpm" + end + end + end +end diff --git a/lib/uddf/base/models/dive_computer.rb b/lib/uddf/base/models/dive_computer.rb new file mode 100644 index 0000000..c472c26 --- /dev/null +++ b/lib/uddf/base/models/dive_computer.rb @@ -0,0 +1,193 @@ +# frozen_string_literal: true + +module UDDF + module Base + module Models + class DCAlarm + include HappyMapper + + tag "dcalarm" + + has_one :acknowledge, String + has_one :alarm_type, Integer, tag: "alarmtype" + has_one :period, Float + end + + class SetDCDiveDepthAlarm + include HappyMapper + + tag "setdcdivedethalarm" + + has_one :dc_alarm, DCAlarm, tag: "dcalarm" + has_one :dc_alarm_depth, Float, tag: "dcalarmdepth" + end + + class SetDCDivePo2Alarm + include HappyMapper + + tag "setdcdivepo2alarm" + + has_one :dc_alarm, DCAlarm, tag: "dcalarm" + has_one :maximum_po2, Float, tag: "maximumpo2" + end + + class SetDCDiveSiteData + include HappyMapper + + tag "setdcdivesitedata" + + attribute :dive_site, String, tag: "divesite" + end + + class SetDCDiveTimeAlarm + include HappyMapper + + tag "setdcdivetimealarm" + + has_one :dc_alarm, DCAlarm, tag: "dcalarm" + has_one :timespan, Float + end + + class SetDCEndNDTAlarm + include HappyMapper + + tag "setdcendndtalarm" + + has_one :dc_alarm, DCAlarm, tag: "dcalarm" + end + + class ApplicationDataV300 + include HappyMapper + + tag "applicationdata" + + has_one :hargikas, Hargikas + end + + class ApplicationDataV310 < ApplicationDataV300 + include HappyMapper + + tag "applicationdata" + + has_one :deco_trainer, String, tag: "decotrainer" + end + + class ApplicationDataV330 < ApplicationDataV310 + include HappyMapper + + has_one :apdiving, String + has_one :ratio, String + end + + class SetDCDecoModelV300 + include HappyMapper + + tag "setdcdecomodel" + + has_many :alias_names, String, tag: "aliasname" + has_one :application_data, ApplicationDataV300, tag: "applicationdata" + has_one :name, String + end + + class SetDCDecoModelV310 < SetDCDecoModelV300 + include HappyMapper + + has_one :application_data, ApplicationDataV310, tag: "applicationdata" + end + + class SetDCDecoModelV330 < SetDCDecoModelV310 + include HappyMapper + + has_one :application_data, ApplicationDataV330, tag: "applicationdata" + end + + class SetDCBuddyData + include HappyMapper + + tag "setdcbuddydata" + + attribute :buddy, String + end + + class SetDCDataV300 + include HappyMapper + + tag "setdcdata" + + has_one :set_dc_alarm_time, DateTime, tag: "setdcalarmtime" + has_one :set_dc_altitude, Float, tag: "setdcaltitude" + has_one :set_dc_buddy_data, SetDCBuddyData, tag: "setdcbuddydata" + has_one :set_dc_date_time, DateTime, tag: "setdcdatetime" + has_one :set_dc_deco_model, SetDCDecoModelV300, tag: "setdcdecomodel" + has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm, tag: "setdcdivedethalarm" + has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm, tag: "setdcdivepo2alarm" + has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata" + has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm, tag: "setdcdivetimealarm" + has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm, tag: "setdcendndtalarm" + has_one :set_dc_gas_definitions_data, String, tag: "setdcgasdefinitionsdata" + has_one :set_dc_owner_data, String, tag: "setdcownerdata" + has_one :set_dc_password, String, tag: "setdcpassword" + has_one :set_dc_generator_data, String, tag: "setdcgeneratordata" + end + + class SetDCDataV310 < SetDCDataV300 + include HappyMapper + + has_one :set_dc_deco_model, SetDCDecoModelV310, tag: "setdcdecomodel" + end + + class SetDCDataV330 < SetDCDataV310 + include HappyMapper + + has_one :set_dc_deco_model, SetDCDecoModelV330, tag: "setdcdecomodel" + end + + class GetDCData + include HappyMapper + + tag "getdcdata" + + has_one :get_dc_all_data, String, tag: "getdcalldata" + has_one :get_dc_generator_data, String, tag: "getdcgeneratordata" + has_one :get_dc_owner_data, String, tag: "getdcownerdata" + has_one :get_dc_buddy_data, String, tag: "getdcbuddydata" + has_one :get_dc_gas_definitions_data, String, tag: "getdcgasdefinitionsdata" + has_one :get_dc_dive_site_data, String, tag: "getdcdivesitedata" + has_one :get_dc_dive_trip_data, String, tag: "getdcdivetripdata" + has_one :get_dc_profile_data, String, tag: "getdcprofiledata" + end + + class DiveComputerDump + include HappyMapper + + tag "divecomputerdump" + + has_one :datetime, DateTime + has_one :dc_dump, String, tag: "dcdump" + has_one :link, Link + end + + class DiveComputerControlV300 + include HappyMapper + + tag "divecomputercontrol" + + has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump" + has_one :get_dc_data, GetDCData, tag: "getdcdata" + has_one :set_dc_data, SetDCDataV300, tag: "setdcdata" + end + + class DiveComputerControlV310 < DiveComputerControlV300 + include HappyMapper + + has_one :set_dc_data, SetDCDataV310, tag: "setdcdata" + end + + class DiveComputerControlV330 < DiveComputerControlV310 + include HappyMapper + + has_one :set_dc_data, SetDCDataV330, tag: "setdcdata" + end + end + end +end diff --git a/lib/uddf/base/models/generic.rb b/lib/uddf/base/models/generic.rb new file mode 100644 index 0000000..5b94d2d --- /dev/null +++ b/lib/uddf/base/models/generic.rb @@ -0,0 +1,787 @@ +# frozen_string_literal: true + +module UDDF + module Base + module Models + ## + # Inside
the own ( element) address data, + # or that of dive buddies ( element), + # or that of a shop ( element) etc., are given. + class Address + include HappyMapper + + tag "address" + + has_one :street, String + has_one :city, String + has_one :postcode, String + has_one :country, String + has_one :province, String + end + + ## + # Inside data concerning getting in touch with some one are + # given, like phone number, email address, language etc. + class Contact + include HappyMapper + + tag "contact" + + has_many :emails, String, tag: "email" + has_many :faxes, String, tag: "fax" + has_many :homepages, String, tag: "homepage" + has_many :languages, String, tag: "language" + has_many :mobile_phones, String, tag: "mobilephone" + has_many :phones, String, tag: "phone" + end + + class DateTimeField + include HappyMapper + + element :raw, String, tag: "datetime" + + # Lazily parse on first access; memoize in @date_time + def date_time + return @date_time if @date_time + + content = raw.to_s.strip + return nil if content.empty? + + @date_time = + case content + when /^\d{4}$/ # "YYYY" + DateTime.new(content.to_i, 1, 1) + when /^\d{4}-\d{2}$/ # "YYYY-MM" + y, m = content.split("-").map!(&:to_i) + DateTime.new(y, m, 1) + else + begin + DateTime.iso8601(content) + rescue ArgumentError, DateError + begin + DateTime.rfc3339(content) + rescue ArgumentError, DateError + DateTime.parse(content) + end + end + end + end + + # Allow manual assignment if you ever need it + attr_writer :date_time + end + + class Manufacturer + include HappyMapper + + tag "manufacturer" + + attribute :id, String + has_one :address, Address + has_many :alias_names, String, tag: "aliasname" + has_one :contact, Contact + has_one :name, String + end + + class Link + include HappyMapper + + tag "link" + + attribute :ref, String + end + + class Generator + include HappyMapper + + tag "generator" + + has_many :alias_names, String, tag: "aliasname" + has_one :datetime, DateTime + has_many :links, Link, tag: "link" + has_one :name, String + has_one :type, String + has_one :version, String + end + + class Notes + include HappyMapper + + tag "notes" + + has_many :paras, String, tag: "para" + has_many :links, Link, tag: "link" + end + + class Price + include HappyMapper + + tag "price" + + attribute :currency, String + content :value, Float + end + + class Shop + include HappyMapper + + tag "shop" + + has_many :alias_names, String, tag: "aliasname" + has_one :address, Address + has_one :contact, Contact + has_one :name, String + has_one :notes, Notes + end + + class Purchase + include HappyMapper + + tag "purchase" + + has_one :datetime, DateTime + has_one :link, Link + has_one :price, Price + has_one :shop, Shop + end + + class Mix + include HappyMapper + + tag "mix" + + attribute :id, String + has_many :alias_names, String, tag: "aliasname" + has_one :ar, Float + has_one :equivalent_air_depth, Float, tag: "equivalentairdepth" + has_one :h2, Float + has_one :he, Float + has_one :maximum_operation_depth, Float, tag: "maximumoperationdepth" + has_one :maximum_po2, Float, tag: "maximumpo2" + has_one :n2, Float + has_one :name, String + has_one :o2, Float + has_one :price_per_litre, Price, tag: "priceperlitre" + end + + class GasDefinitions + include HappyMapper + + tag "gasdefinitions" + + has_many :mixes, Mix, tag: "mix" + end + + class Medicine + include HappyMapper + + tag "medicine" + + has_many :alias_names, String, tag: "aliasname" + has_one :name, String + has_one :notes, Notes + has_one :periodically_taken, String, tag: "periodicallytaken" + has_one :timespan_before_dive, Float, tag: "timespanbeforedive" + end + + class MedicationBeforeDive + include HappyMapper + + tag "medicationbeforedive" + + has_many :medicines, Medicine, tag: "medicine" + end + + class Drink + include HappyMapper + + tag "drink" + + has_many :alias_names, String, tag: "aliasname" + has_one :name, String + has_one :notes, Notes + has_one :periodically_taken, String, tag: "periodicallytaken" + has_one :timespan_before_dive, Float, tag: "timespanbeforedive" + end + + class AlcoholBeforeDive + include HappyMapper + + tag "alcoholbeforedive" + + has_many :drinks, Drink, tag: "drink" + end + + class AnySymptoms + include HappyMapper + + tag "anysymptoms" + + has_one :notes, Notes + end + + class Abundance + include HappyMapper + + tag "abundance" + + attribute :quality, String + attribute :occurrence, String + content :value, Integer + end + + class Species + include HappyMapper + + tag "species" + + attribute :id, String + has_one :abundance, Abundance + has_one :age, Integer + has_one :dominance, String + has_one :life_stage, String, tag: "lifestage" + has_one :notes, Notes + has_one :scientific_name, String, tag: "scientificname" + has_one :sex, String + has_one :size, Float + has_one :trivial_name, String, tag: "trivialname" + end + + class WithSpecies + include HappyMapper + + has_many :species, Species, tag: "species" + end + + class Invertebrata + include HappyMapper + + tag "invertebrata" + + has_one :ascidiacea, WithSpecies + has_one :bryozoan, WithSpecies + has_one :cnidaria, WithSpecies + has_one :coelenterata, WithSpecies + has_one :crustacea, WithSpecies + has_one :ctenophora, WithSpecies + has_one :echinodermata, WithSpecies + has_one :invertebrata_various, WithSpecies, tag: "invertebratavarious" + has_one :mollusca, WithSpecies + has_one :phoronidea, WithSpecies + has_one :plathelminthes, WithSpecies + has_one :porifera, WithSpecies + end + + class Vertebrata + include HappyMapper + + tag "vertebrata" + + has_one :amphibia, WithSpecies + has_one :chondrichthyes, WithSpecies + has_one :mammalia, WithSpecies + has_one :osteichthyes, WithSpecies + has_one :reptilia, WithSpecies + has_one :vertebrata_various, WithSpecies, tag: "vertebratavarious" + end + + class Fauna + include HappyMapper + + tag "fauna" + + has_one :invertebrata, Invertebrata + has_one :notes, Notes + has_one :vertebrata, Vertebrata + end + + class Flora + include HappyMapper + + tag "flora" + + has_one :chlorophyceae, WithSpecies + has_one :flora_various, WithSpecies, tag: "floravarious" + has_one :notes, Notes + has_one :phaeophyceae, WithSpecies + has_one :rhodophyceae, WithSpecies + has_one :spermatophyta, WithSpecies + end + + class Observations + include HappyMapper + + tag "observations" + + has_one :fauna, Fauna + has_one :flora, Flora + has_one :notes, Notes + end + + class Geography + include HappyMapper + + tag "geography" + + has_one :address, Address + has_one :altitude, Float + has_one :latitude, Float + has_one :location, String + has_one :longitude, Float + has_one :time_zone, Float, tag: "timezone" + end + + class Ecology + include HappyMapper + + tag "ecology" + + has_one :fauna, Fauna + has_one :flora, Flora + end + + class Built + include HappyMapper + + tag "built" + + has_one :launching_date, DateTimeField, tag: "launchingdate" + has_one :ship_yard, String, tag: "shipyard" + end + + class ShipDimension + include HappyMapper + + tag "shipdimension" + + has_one :beam, Float + has_one :displacement, Float + has_one :draught, Float + has_one :length, Float + has_one :tonnage, Float + end + + class Wreck + include HappyMapper + + tag "wreck" + + has_many :alias_names, String, tag: "aliasname" + has_one :built, Built + has_one :name, String + has_one :nationality, String + has_one :ship_dimension, ShipDimension, tag: "shipdimension" + has_one :ship_type, String, tag: "shiptype" + has_one :sunk, DateTimeField + end + + class Shore + include HappyMapper + + tag "shore" + + attribute :id, String + has_many :alias_names, String, tag: "aliasname" + has_one :name, String + has_one :notes, Notes + end + + class River + include HappyMapper + + tag "river" + + attribute :id, String + has_many :alias_names, String, tag: "aliasname" + has_one :name, String + has_one :notes, Notes + end + + class Lake + include HappyMapper + + tag "lake" + + attribute :id, String + has_many :alias_names, String, tag: "aliasname" + has_one :name, String + has_one :notes, Notes + end + + class Indoor + include HappyMapper + + tag "indoor" + + has_one :address, Address + has_many :alias_names, String, tag: "aliasname" + has_one :contact, Contact + has_one :name, String + has_one :notes, Notes + end + + class Cave + include HappyMapper + + tag "cave" + + attribute :id, String + has_many :alias_names, String, tag: "aliasname" + has_one :name, String + has_one :notes, Notes + end + + class SiteData + include HappyMapper + + tag "sidedata" + + has_one :area_length, Float, tag: "arealength" + has_one :area_width, Float, tag: "areawidth" + has_one :average_visibility, Float, tag: "averagevisibility" + has_one :bottom, String + has_one :cave, Cave + has_one :density, Float + has_one :difficulty, Integer + has_one :global_light_intensity, String, tag: "globallightintensity" + has_one :indoor, Indoor + has_one :maximum_depth, Float, tag: "maximumdepth" + has_one :maximum_visibility, Float, tag: "maximumvisibility" + has_one :minimum_depth, Float, tag: "minimumdepth" + has_one :minimum_visibility, Float, tag: "minimumvisibility" + has_one :river, River + has_one :shore, Shore + has_one :terrain, String + has_one :wreck, Wreck + end + + class Rating + include HappyMapper + + tag "rating" + + has_one :datetime, DateTime + has_one :rating_value, Integer, tag: "ratingvalue" + end + + class Site + include HappyMapper + + tag "site" + + attribute :id, String + has_many :alias_names, String, tag: "aliasname" + has_one :ecology, Ecology + has_one :environment, String + has_one :geography, Geography + has_many :links, Link, tag: "link" + has_one :name, String + has_one :notes, Notes + has_many :ratings, Rating, tag: "rating" + has_one :side_data, SiteData, tag: "sitedata" + end + + class Membership + include HappyMapper + + tag "membership" + + attribute :organisation, String + attribute :member_id, String, tag: "memberid" + end + + class NumberOfDives + include HappyMapper + + tag "numberofdives" + + has_one :start_date, DateTime, tag: "startdate" + has_one :end_date, DateTime, tag: "enddate" + has_one :dives, Integer + end + + class Personal + include HappyMapper + + tag "personal" + + has_one :birth_date, DateTimeField, tag: "birthdate" + has_one :birth_name, String, tag: "birthname" + has_one :blood_group, String, tag: "bloodgroup" + has_one :first_name, String, tag: "firstname" + has_one :height, Float + has_one :honorific, String + has_one :last_name, String, tag: "lastname" + has_one :membership, Membership + has_one :middle_name, String, tag: "middlename" + has_one :number_of_dives, NumberOfDives, tag: "numberofdives" + has_one :sex, String + has_one :smoking, String + has_one :weight, Float + end + + class Instructor + include HappyMapper + + tag "instructor" + + has_one :address, Address + has_one :contact, Contact + has_one :personal, Personal + end + + class Doctor + include HappyMapper + + tag "doctor" + + attribute :id, String + has_one :address, Address + has_one :contact, Contact + has_one :personal, Personal + end + + class Examination + include HappyMapper + + tag "examination" + + has_one :datetime, DateTime + has_one :doctor, Doctor + has_one :examination_result, String, tag: "examinationresult" + has_many :links, Link, tag: "link" + has_one :notes, Notes + has_one :total_lung_capacity, Float, tag: "totallungcapacity" + has_one :vital_capacity, Float, tag: "vitalcapacity" + end + + class Medical + include HappyMapper + + tag "medical" + + has_one :examination, Examination + end + + class Certification + include HappyMapper + + tag "certification" + + has_one :instructor, Instructor + has_one :issue_date, DateTimeField, tag: "issuedate" + has_one :level, String + has_one :link, Link + has_one :organization, String + has_one :specialty, String + has_one :valid_date, DateTimeField, tag: "validdate" + end + + class CertificationV322 < Certification + include HappyMapper + + # Added in v3.2.2 + has_one :certificate_number, String, tag: "certificatenumber" + end + + class Education + include HappyMapper + + tag "education" + + has_many :certifications, Certification, tag: "certification" + end + + class EducationV322 < Education + include HappyMapper + + has_many :certifications, CertificationV322, tag: "certification" + end + + class Vessel + include HappyMapper + + tag "vessel" + + has_one :address, Address + has_many :alias_names, String, tag: "aliasname" + has_one :contact, Contact + has_one :marina, String + has_one :name, String + has_one :notes, Notes + has_many :ratings, Rating, tag: "rating" + has_one :ship_dimension, ShipDimension, tag: "shipdimension" + has_one :ship_type, String, tag: "shiptype" + end + + class Operator + include HappyMapper + + tag "operator" + + has_many :alias_names, String, tag: "aliasname" + has_one :address, Address + has_one :contact, Contact + has_one :name, String + has_one :notes, Notes + has_many :ratings, Rating, tag: "rating" + end + + class DateOfTrip + include HappyMapper + + tag "dateoftrip" + + attribute :start_date, DateTime, tag: "startdate" + attribute :end_date, DateTime, tag: "enddate" + end + + class Accommodation + include HappyMapper + + tag "accommodation" + + has_one :address, Address + has_many :alias_names, String, tag: "aliasname" + has_one :category, String + has_one :contact, Contact + has_one :name, String + has_one :notes, Notes + has_many :ratings, Rating, tag: "rating" + end + + class PriceDivePackage + include HappyMapper + + tag "pricedivepackage" + + attribute :currency, String + attribute :no_of_dives, Integer, tag: "noofdives" + content :value, Float + end + + class RelatedDives + include HappyMapper + + tag "relateddives" + + has_many :links, Link, tag: "link" + end + + class TripPart + include HappyMapper + + tag "trippart" + + attribute :type, String + has_one :accommodation, Accommodation + has_one :date_of_trip, DateOfTrip, tag: "dateoftrip" + has_one :geography, Geography + has_many :links, Link, tag: "link" + has_one :name, String + has_one :notes, Notes + has_one :operator, Operator + has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" + has_one :price_per_dive, Price, tag: "priceperdive" + has_one :related_dives, RelatedDives, tag: "relateddives" + has_one :vessel, Vessel + end + + class Trip + include HappyMapper + + tag "trip" + + attribute :id, String + has_many :alias_names, String, tag: "aliasname" + has_one :name, String + has_many :ratings, Rating, tag: "rating" + has_many :trip_parts, TripPart, tag: "trippart" + end + + class DiveTrip + include HappyMapper + + tag "divetrip" + + has_many :trips, Trip, tag: "trip" + end + + class Guide + include HappyMapper + + tag "guide" + + has_many :links, Link, tag: "link" + end + + class DiveBase + include HappyMapper + + tag "divebase" + + attribute :id, String + has_one :address, Address + has_many :alias_names, String, tag: "aliasname" + has_one :contact, Contact + has_many :guides, Guide, tag: "guide" + has_many :links, Link, tag: "link" + has_one :name, String + has_one :notes, Notes + has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" + has_one :price_per_dive, Price, tag: "priceperdive" + has_many :ratings, Rating, tag: "rating" + end + + class DiveSite + include HappyMapper + + tag "divesite" + + has_many :dive_bases, DiveBase, tag: "divebase" + has_many :sites, Site, tag: "site" + end + + class Insurance + include HappyMapper + + tag "insurance" + + has_many :alias_names, String, tag: "aliasname" + has_one :issue_date, DateTimeField, tag: "issuedate" + has_one :name, String + has_one :notes, Notes + has_one :valid_date, DateTimeField, tag: "validdate" + end + + class DiveInsurances + include HappyMapper + + tag "diveinsurances" + + has_many :insurances, Insurance, tag: "insurance" + end + + class Permit + include HappyMapper + + tag "permit" + + has_many :alias_names, String, tag: "aliasname" + has_one :issue_date, DateTimeField, tag: "issuedate" + has_one :name, String + has_one :notes, Notes + has_one :region, String + has_one :valid_date, DateTimeField, tag: "validdate" + end + + class DivePermissions + include HappyMapper + + tag "divepermissions" + + has_many :permits, Permit, tag: "permit" + end + end + end +end diff --git a/lib/uddf/base/models/media.rb b/lib/uddf/base/models/media.rb new file mode 100644 index 0000000..2cdd39b --- /dev/null +++ b/lib/uddf/base/models/media.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module UDDF + module Base + module Models + class ImageData + include HappyMapper + + tag "imagedata" + + has_one :aperture, Float + has_one :datetime, DateTime + has_one :exposure_compensation, Float, tag: "exposurecompensation" + has_one :film_speed, Integer, tag: "filmspeed" + has_one :focal_length, Float, tag: "focallength" + has_one :focusing_distance, Float, tag: "focusingdistance" + has_one :metering_method, String, tag: "meteringmethod" + has_one :shutter_speed, Float, tag: "shutterspeed" + end + + class Image + include HappyMapper + + tag "image" + + attribute :id, String + attribute :height, Integer + attribute :width, Integer + attribute :format, String + has_one :image_data, ImageData, tag: "imagedata" + has_one :object_name, String, tag: "objectname" + has_one :title, String + end + + class Video + include HappyMapper + + tag "video" + + attribute :id, String + has_one :object_name, String, tag: "objectname" + has_one :title, String + end + + class Audio + include HappyMapper + + tag "audio" + + attribute :id, String + has_one :object_name, String, tag: "objectname" + has_one :title, String + end + + class MediaData + include HappyMapper + + tag "mediadata" + + has_many :audio_files, Audio, tag: "audio" + has_many :image_files, Image, tag: "image" + has_many :video_files, Video, tag: "video" + end + end + end +end diff --git a/lib/uddf/v300/models.rb b/lib/uddf/v300/models.rb index d65badf..40dbcd9 100644 --- a/lib/uddf/v300/models.rb +++ b/lib/uddf/v300/models.rb @@ -6,104 +6,6 @@ module UDDF module V300 module Models - class Manufacturer - include HappyMapper - - tag "manufacturer" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - end - - class Link - include HappyMapper - - tag "link" - - attribute :ref, String - end - - class Generator - include HappyMapper - - tag "generator" - - has_many :alias_names, String, tag: "aliasname" - has_one :datetime, DateTime - has_many :links, Link, tag: "link" - has_one :name, String - has_one :type, String - has_one :version, String - end - - class Notes - include HappyMapper - - tag "notes" - - has_many :paras, String, tag: "para" - has_many :links, Link, tag: "link" - end - - class Price - include HappyMapper - - tag "price" - - attribute :currency, String - content :value, Float - end - - class Tissue - include HappyMapper - - tag "tissue" - - attribute :gas, String - attribute :half_life, Float, tag: "halflife" - attribute :number, Integer - attribute :a, Float - attribute :b, Float - end - - class DecoModel - include HappyMapper - - tag "decomodel" - - content :value, String - end - - class Mix - include HappyMapper - - tag "mix" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ar, Float - has_one :equivalent_air_depth, Float, tag: "equivalentairdepth" - has_one :h2, Float - has_one :he, Float - has_one :maximum_operation_depth, Float, tag: "maximumoperationdepth" - has_one :maximum_po2, Float, tag: "maximumpo2" - has_one :n2, Float - has_one :name, String - has_one :o2, Float - has_one :price_per_litre, Price, tag: "priceperlitre" - end - - class GasDefinitions - include HappyMapper - - tag "gasdefinitions" - - has_many :mixes, Mix, tag: "mix" - end - class WayAltitude include HappyMapper @@ -223,78 +125,29 @@ class Waypoint has_one :temperature, Float end - class Medicine - include HappyMapper - - tag "medicine" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class MedicationBeforeDive - include HappyMapper - - tag "medicationbeforedive" - - has_many :medicines, Medicine, tag: "medicine" - end - - class Drink - include HappyMapper - - tag "drink" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class AlcoholBeforeDive - include HappyMapper - - tag "alcoholbeforedive" - - has_many :drinks, Drink, tag: "drink" - end - class InformationBeforeDive include HappyMapper tag "informationbeforedive" has_one :air_temperature, Float, tag: "airtemperature" - has_one :alcohol_before_dive, AlcoholBeforeDive, tag: "alcoholbeforedive" + has_one :alcohol_before_dive, Base::Models::AlcoholBeforeDive, tag: "alcoholbeforedive" has_one :altitude, Float has_one :apparatus, String has_one :datetime, DateTime has_one :dive_number, Integer, tag: "divenumber" has_one :internal_dive_number, Integer, tag: "internaldivenumber" - has_many :links, Link, tag: "link" - has_one :medication_before_dive, MedicationBeforeDive, tag: "medicationbeforedive" + has_many :links, Base::Models::Link, tag: "link" + has_one :medication_before_dive, Base::Models::MedicationBeforeDive, tag: "medicationbeforedive" has_one :no_suit, String, tag: "nosuit" has_one :platform, String - has_one :price, Price + has_one :price, Base::Models::Price has_one :purpose, String has_one :state_of_rest_before_dive, String, tag: "stateofrestbeforedive" has_one :surface_interval_before_dive, SurfaceIntervalBeforeDive, tag: "surfaceintervalbeforedive" has_one :trip_membership, String, tag: "tripmembership" end - class Rating - include HappyMapper - - tag "rating" - - has_one :datetime, DateTime - has_one :rating_value, Integer, tag: "ratingvalue" - end - class GlobalAlarmsGiven include HappyMapper @@ -309,113 +162,7 @@ class EquipmentUsed tag "equipmentused" has_one :lead_quantity, Float, tag: "leadquantity" - has_many :links, Link, tag: "link" - end - - class AnySymptoms - include HappyMapper - - tag "anysymptoms" - - has_one :notes, Notes - end - - class Abundance - include HappyMapper - - tag "abundance" - - attribute :quality, String - attribute :occurrence, String - content :value, Integer - end - - class Species - include HappyMapper - - tag "species" - - attribute :id, String - has_one :abundance, Abundance - has_one :age, Integer - has_one :dominance, String - has_one :life_stage, String, tag: "lifestage" - has_one :notes, Notes - has_one :scientific_name, String, tag: "scientificname" - has_one :sex, String - has_one :size, Float - has_one :trivial_name, String, tag: "trivialname" - end - - class WithSpecies - include HappyMapper - - has_many :species, Species, tag: "species" - end - - class Invertebrata - include HappyMapper - - tag "invertebrata" - - has_one :ascidiacea, WithSpecies - has_one :bryozoan, WithSpecies - has_one :cnidaria, WithSpecies - has_one :coelenterata, WithSpecies - has_one :crustacea, WithSpecies - has_one :ctenophora, WithSpecies - has_one :echinodermata, WithSpecies - has_one :invertebrata_various, WithSpecies, tag: "invertebratavarious" - has_one :mollusca, WithSpecies - has_one :phoronidea, WithSpecies - has_one :plathelminthes, WithSpecies - has_one :porifera, WithSpecies - end - - class Vertebrata - include HappyMapper - - tag "vertebrata" - - has_one :amphibia, WithSpecies - has_one :chondrichthyes, WithSpecies - has_one :mammalia, WithSpecies - has_one :osteichthyes, WithSpecies - has_one :reptilia, WithSpecies - has_one :vertebrata_various, WithSpecies, tag: "vertebratavarious" - end - - class Fauna - include HappyMapper - - tag "fauna" - - has_one :invertebrata, Invertebrata - has_one :notes, Notes - has_one :vertebrata, Vertebrata - end - - class Flora - include HappyMapper - - tag "flora" - - has_one :chlorophyceae, WithSpecies - has_one :flora_various, WithSpecies, tag: "floravarious" - has_one :notes, Notes - has_one :phaeophyceae, WithSpecies - has_one :rhodophyceae, WithSpecies - has_one :spermatophyta, WithSpecies - end - - class Observations - include HappyMapper - - tag "observations" - - has_one :fauna, Fauna - has_one :flora, Flora - has_one :notes, Notes + has_many :links, Base::Models::Link, tag: "link" end class InformationAfterDive @@ -423,7 +170,7 @@ class InformationAfterDive tag "informationafterdive" - has_one :any_symptoms, AnySymptoms, tag: "anysymptoms" + has_one :any_symptoms, Base::Models::AnySymptoms, tag: "anysymptoms" has_one :current, String has_one :desaturation_time, Float, tag: "desaturationtime" has_one :dive_duration, Float, tag: "diveduration" @@ -436,11 +183,11 @@ class InformationAfterDive has_one :highest_po2, Float, tag: "highestpo2" has_one :lowest_temperature, Float, tag: "lowesttemperature" has_one :no_flight_time, Float, tag: "noflighttime" - has_one :observations, Observations + has_one :observations, Base::Models::Observations has_one :pressure_drop, Float, tag: "pressuredrop" has_many :problems, String, tag: "problems" has_one :program, String - has_many :ratings, Rating, tag: "rating" + has_many :ratings, Base::Models::Rating, tag: "rating" has_one :surface_interval_after_dive, SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive" has_one :thermal_comfort, String, tag: "thermalcomfort" has_one :visibility, Float @@ -462,32 +209,12 @@ class TankData attribute :id, String has_one :breathing_consumption_volume, Float, tag: "breathingconsumptionvolume" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :tank_pressure_begin, Float, tag: "tankpressurebegin" has_one :tank_pressure_end, Float, tag: "tankpressureend" has_one :tank_volume, Float, tag: "tankvolume" end - class Hargikas - include HappyMapper - - tag "hargikas" - - has_one :ambient, Float - has_many :tissues, Tissue, tag: "tissue" - has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel" - has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt" - has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel" - end - - class ApplicationData - include HappyMapper - - tag "applicationdata" - - has_one :hargikas, Hargikas - end - class Dive include HappyMapper @@ -496,7 +223,7 @@ class Dive attribute :id, String has_one :information_after_dive, InformationAfterDive, tag: "informationafterdive" has_one :information_before_dive, InformationBeforeDive, tag: "informationbeforedive" - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV300, tag: "applicationdata" has_one :samples, Samples has_many :tank_data, TankData, tag: "tankdata" end @@ -548,7 +275,7 @@ class InputProfile tag "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_many :waypoints, Waypoint, tag: "waypoint" end @@ -569,12 +296,12 @@ class Profile tag "profile" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :deco_model, DecoModel, tag: "decomodel" + has_one :application_data, Base::Models::ApplicationDataV300, tag: "applicationdata" + has_one :deco_model, Base::Models::DecoModel, tag: "decomodel" has_one :deep_stop_time, Float, tag: "deepstoptime" has_one :density, Float has_one :input_profile, InputProfile, tag: "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :maximum_ascending_rate, Float, tag: "maximumascendingrate" has_one :mix_change, MixChange, tag: "mixchange" has_one :output, Output @@ -645,9 +372,9 @@ class BottomTimeTable tag "bottomtimetable" attribute :id, String - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV300, tag: "applicationdata" has_one :bottom_time_table_scope, BottomTimeTableScope, tag: "bottomtimetablescope" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :output, Output has_one :title, String end @@ -670,498 +397,6 @@ class TableGeneration has_one :calculate_table, CalculateTable, tag: "calculatetable" end - class ImageData - include HappyMapper - - tag "imagedata" - - has_one :aperture, Float - has_one :datetime, DateTime - has_one :exposure_compensation, Float, tag: "exposurecompensation" - has_one :film_speed, Integer, tag: "filmspeed" - has_one :focal_length, Float, tag: "focallength" - has_one :focusing_distance, Float, tag: "focusingdistance" - has_one :metering_method, String, tag: "meteringmethod" - has_one :shutter_speed, Float, tag: "shutterspeed" - end - - class Image - include HappyMapper - - tag "image" - - attribute :id, String - attribute :height, Integer - attribute :width, Integer - attribute :format, String - has_one :image_data, ImageData, tag: "imagedata" - has_one :object_name, String, tag: "objectname" - has_one :title, String - end - - class Video - include HappyMapper - - tag "video" - - attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String - end - - class Audio - include HappyMapper - - tag "audio" - - attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String - end - - class MediaData - include HappyMapper - - tag "mediadata" - - has_many :audio_files, Audio, tag: "audio" - has_many :image_files, Image, tag: "image" - has_many :video_files, Video, tag: "video" - end - - class PriceDivePackage - include HappyMapper - - tag "pricedivepackage" - - attribute :currency, String - attribute :no_of_dives, Integer, tag: "noofdives" - content :value, Float - end - - class RelatedDives - include HappyMapper - - tag "relateddives" - - has_many :links, Link, tag: "link" - end - - class ShipDimension - include HappyMapper - - tag "shipdimension" - - has_one :beam, Float - has_one :displacement, Float - has_one :draught, Float - has_one :length, Float - has_one :tonnage, Float - end - - class Vessel - include HappyMapper - - tag "vessel" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :marina, String - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - end - - class Operator - include HappyMapper - - tag "operator" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - end - - class DateOfTrip - include HappyMapper - - tag "dateoftrip" - - attribute :start_date, DateTime, tag: "startdate" - attribute :end_date, DateTime, tag: "enddate" - end - - class Accommodation - include HappyMapper - - tag "accommodation" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :category, String - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - end - - class Geography - include HappyMapper - - tag "geography" - - has_one :address, Base::Models::Address - has_one :altitude, Float - has_one :latitude, Float - has_one :location, String - has_one :longitude, Float - has_one :time_zone, Float, tag: "timezone" - end - - class TripPart - include HappyMapper - - tag "trippart" - - attribute :type, String - has_one :accommodation, Accommodation - has_one :date_of_trip, DateOfTrip, tag: "dateoftrip" - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :operator, Operator - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_one :related_dives, RelatedDives, tag: "relateddives" - has_one :vessel, Vessel - end - - class Trip - include HappyMapper - - tag "trip" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_many :ratings, Rating, tag: "rating" - has_many :trip_parts, TripPart, tag: "trippart" - end - - class DiveTrip - include HappyMapper - - tag "divetrip" - - has_many :trips, Trip, tag: "trip" - end - - class Ecology - include HappyMapper - - tag "ecology" - - has_one :fauna, Fauna - has_one :flora, Flora - end - - class Built - include HappyMapper - - tag "built" - - has_one :launching_date, Base::Models::DateTimeField, tag: "launchingdate" - has_one :ship_yard, String, tag: "shipyard" - end - - class Wreck - include HappyMapper - - tag "wreck" - - has_many :alias_names, String, tag: "aliasname" - has_one :built, Built - has_one :name, String - has_one :nationality, String - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - has_one :sunk, Base::Models::DateTimeField - end - - class Shore - include HappyMapper - - tag "shore" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class River - include HappyMapper - - tag "river" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Lake - include HappyMapper - - tag "lake" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Indoor - include HappyMapper - - tag "indoor" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Cave - include HappyMapper - - tag "cave" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class SiteData - include HappyMapper - - tag "sidedata" - - has_one :area_length, Float, tag: "arealength" - has_one :area_width, Float, tag: "areawidth" - has_one :average_visibility, Float, tag: "averagevisibility" - has_one :bottom, String - has_one :cave, Cave - has_one :density, Float - has_one :difficulty, Integer - has_one :global_light_intensity, String, tag: "globallightintensity" - has_one :indoor, Indoor - has_one :maximum_depth, Float, tag: "maximumdepth" - has_one :maximum_visibility, Float, tag: "maximumvisibility" - has_one :minimum_depth, Float, tag: "minimumdepth" - has_one :minimum_visibility, Float, tag: "minimumvisibility" - has_one :river, River - has_one :shore, Shore - has_one :terrain, String - has_one :wreck, Wreck - end - - class Site - include HappyMapper - - tag "site" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ecology, Ecology - has_one :environment, String - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :side_data, SiteData, tag: "sitedata" - end - - class Guide - include HappyMapper - - tag "guide" - - has_many :links, Link, tag: "link" - end - - class DiveBase - include HappyMapper - - tag "divebase" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_many :guides, Guide, tag: "guide" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_many :ratings, Rating, tag: "rating" - end - - class DiveSite - include HappyMapper - - tag "divesite" - - has_many :dive_bases, DiveBase, tag: "divebase" - has_many :sites, Site, tag: "site" - end - - class Shop - include HappyMapper - - tag "shop" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Membership - include HappyMapper - - tag "membership" - - attribute :organisation, String - attribute :member_id, String, tag: "memberid" - end - - class NumberOfDives - include HappyMapper - - tag "numberofdives" - - has_one :start_date, DateTime, tag: "startdate" - has_one :end_date, DateTime, tag: "enddate" - has_one :dives, Integer - end - - class Personal - include HappyMapper - - tag "personal" - - has_one :birth_date, Base::Models::DateTimeField, tag: "birthdate" - has_one :birth_name, String, tag: "birthname" - has_one :blood_group, String, tag: "bloodgroup" - has_one :first_name, String, tag: "firstname" - has_one :height, Float - has_one :honorific, String - has_one :last_name, String, tag: "lastname" - has_one :membership, Membership - has_one :middle_name, String, tag: "middlename" - has_one :number_of_dives, NumberOfDives, tag: "numberofdives" - has_one :sex, String - has_one :smoking, String - has_one :weight, Float - end - - class Instructor - include HappyMapper - - tag "instructor" - - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Certification - include HappyMapper - - tag "certification" - - has_one :instructor, Instructor - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :level, String - has_one :link, Link - has_one :organization, String - has_one :specialty, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class Education - include HappyMapper - - tag "education" - - has_many :certifications, Certification, tag: "certification" - end - - class Insurance - include HappyMapper - - tag "insurance" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DiveInsurances - include HappyMapper - - tag "diveinsurances" - - has_many :insurances, Insurance, tag: "insurance" - end - - class Permit - include HappyMapper - - tag "permit" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :region, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DivePermissions - include HappyMapper - - tag "divepermissions" - - has_many :permits, Permit, tag: "permit" - end - - class Purchase - include HappyMapper - - tag "purchase" - - has_one :datetime, DateTime - has_one :link, Link - has_one :price, Price - has_one :shop, Shop - end - class EquipmentPart include HappyMapper @@ -1169,12 +404,12 @@ class EquipmentPart attribute :id, String has_many :alias_names, String, tag: "aliasname" - has_one :manufacturer, Manufacturer + has_one :manufacturer, Base::Models::Manufacturer has_one :model, String has_one :name, String has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase has_one :serial_number, String, tag: "serialnumber" has_one :service_interval, Integer, tag: "serviceinterval" end @@ -1251,9 +486,9 @@ class EquipmentConfiguration < EquipmentContent tag "equipmentconfiguration" has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :name, String - has_one :notes, Notes + has_one :notes, Base::Models::Notes end class Equipment < EquipmentContent @@ -1265,86 +500,37 @@ class Equipment < EquipmentContent has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" end - class Doctor - include HappyMapper - - tag "doctor" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Examination - include HappyMapper - - tag "examination" - - has_one :datetime, DateTime - has_one :doctor, Doctor - has_one :examination_result, String, tag: "examinationresult" - has_many :links, Link, tag: "link" - has_one :notes, Notes - has_one :total_lung_capacity, Float, tag: "totallungcapacity" - has_one :vital_capacity, Float, tag: "vitalcapacity" - end - - class Medical - include HappyMapper - - tag "medical" - - has_one :examination, Examination - end - class BuddyOwnerShared include HappyMapper attribute :id, String has_one :address, Base::Models::Address has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" + has_one :dive_insurances, Base::Models::DiveInsurances, tag: "diveinsurances" + has_one :dive_permissions, Base::Models::DivePermissions, tag: "divepermissions" has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal + has_one :medical, Base::Models::Medical + has_one :notes, Base::Models::Notes + has_one :personal, Base::Models::Personal end - class Buddy + class Buddy < BuddyOwnerShared include HappyMapper tag "buddy" attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :certification, Certification + has_one :certification, Base::Models::Certification has_one :student, String end - class Owner + class Owner < BuddyOwnerShared include HappyMapper tag "owner" attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :education, Education + has_one :education, Base::Models::Education end class Diver @@ -1356,146 +542,19 @@ class Diver has_one :owner, Owner end - class DCAlarm - include HappyMapper - - tag "dcalarm" - - has_one :acknowledge, String - has_one :alarm_type, Integer, tag: "alarmtype" - has_one :period, Float - end - - class SetDCDiveDepthAlarm - include HappyMapper - - tag "setdcdivedethalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :dc_alarm_depth, Float, tag: "dcalarmdepth" - end - - class SetDCDivePo2Alarm - include HappyMapper - - tag "setdcdivepo2alarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :maximum_po2, Float, tag: "maximumpo2" - end - - class SetDCDiveSiteData - include HappyMapper - - tag "setdcdivesitedata" - - attribute :dive_site, String, tag: "divesite" - end - - class SetDCDiveTimeAlarm - include HappyMapper - - tag "setdcdivetimealarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :timespan, Float - end - - class SetDCEndNDTAlarm - include HappyMapper - - tag "setdcendndtalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - end - - class SetDCDecoModel - include HappyMapper - - tag "setdcdecomodel" - - has_many :alias_names, String, tag: "aliasname" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :name, String - end - - class SetDCBuddyData - include HappyMapper - - tag "setdcbuddydata" - - attribute :buddy, String - end - - class SetDCData - include HappyMapper - - tag "setdcdata" - - has_one :set_dc_alarm_time, DateTime, tag: "setdcalarmtime" - has_one :set_dc_altitude, Float, tag: "setdcaltitude" - has_one :set_dc_buddy_data, SetDCBuddyData, tag: "setdcbuddydata" - has_one :set_dc_date_time, DateTime, tag: "setdcdatetime" - has_one :set_dc_deco_model, SetDCDecoModel, tag: "setdcdecomodel" - has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm, tag: "setdcdivedethalarm" - has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm, tag: "setdcdivepo2alarm" - has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata" - has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm, tag: "setdcdivetimealarm" - has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm, tag: "setdcendndtalarm" - has_one :set_dc_gas_definitions_data, String, tag: "setdcgasdefinitionsdata" - has_one :set_dc_owner_data, String, tag: "setdcownerdata" - has_one :set_dc_password, String, tag: "setdcpassword" - has_one :set_dc_generator_data, String, tag: "setdcgeneratordata" - end - - class GetDCData - include HappyMapper - - tag "getdcdata" - - has_one :get_dc_all_data, String, tag: "getdcalldata" - has_one :get_dc_generator_data, String, tag: "getdcgeneratordata" - has_one :get_dc_owner_data, String, tag: "getdcownerdata" - has_one :get_dc_buddy_data, String, tag: "getdcbuddydata" - has_one :get_dc_gas_definitions_data, String, tag: "getdcgasdefinitionsdata" - has_one :get_dc_dive_site_data, String, tag: "getdcdivesitedata" - has_one :get_dc_dive_trip_data, String, tag: "getdcdivetripdata" - has_one :get_dc_profile_data, String, tag: "getdcprofiledata" - end - - class DiveComputerDump - include HappyMapper - - tag "divecomputerdump" - - has_one :datetime, DateTime - has_one :dc_dump, String, tag: "dcdump" - has_one :link, Link - end - - class DiveComputerControl - include HappyMapper - - tag "divecomputercontrol" - - has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump" - has_one :get_dc_data, GetDCData, tag: "getdcdata" - has_one :set_dc_data, SetDCData, tag: "setdcdata" - end - class Uddf include HappyMapper tag "uddf" attribute :version, String - has_one :dive_computer_control, DiveComputerControl, tag: "divecomputercontrol" + has_one :dive_computer_control, Base::Models::DiveComputerControlV300, tag: "divecomputercontrol" has_one :diver, Diver - has_one :dive_site, DiveSite, tag: "divesite" - has_one :dive_trip, DiveTrip, tag: "divetrip" - has_one :gas_definitions, GasDefinitions, tag: "gasdefinitions" - has_one :generator, Generator - has_one :media_data, MediaData, tag: "mediadata" + has_one :dive_site, Base::Models::DiveSite, tag: "divesite" + has_one :dive_trip, Base::Models::DiveTrip, tag: "divetrip" + has_one :gas_definitions, Base::Models::GasDefinitions, tag: "gasdefinitions" + has_one :generator, Base::Models::Generator + has_one :media_data, Base::Models::MediaData, tag: "mediadata" has_one :profile_data, ProfileData, tag: "profiledata" has_one :table_generation, TableGeneration, tag: "tablegeneration" end diff --git a/lib/uddf/v301/models.rb b/lib/uddf/v301/models.rb index 5a79590..9afae5f 100644 --- a/lib/uddf/v301/models.rb +++ b/lib/uddf/v301/models.rb @@ -6,104 +6,6 @@ module UDDF module V301 module Models - class Manufacturer - include HappyMapper - - tag "manufacturer" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - end - - class Link - include HappyMapper - - tag "link" - - attribute :ref, String - end - - class Generator - include HappyMapper - - tag "generator" - - has_many :alias_names, String, tag: "aliasname" - has_one :datetime, DateTime - has_many :links, Link, tag: "link" - has_one :name, String - has_one :type, String - has_one :version, String - end - - class Notes - include HappyMapper - - tag "notes" - - has_many :paras, String, tag: "para" - has_many :links, Link, tag: "link" - end - - class Price - include HappyMapper - - tag "price" - - attribute :currency, String - content :value, Float - end - - class Tissue - include HappyMapper - - tag "tissue" - - attribute :gas, String - attribute :half_life, Float, tag: "halflife" - attribute :number, Integer - attribute :a, Float - attribute :b, Float - end - - class DecoModel - include HappyMapper - - tag "decomodel" - - content :value, String - end - - class Mix - include HappyMapper - - tag "mix" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ar, Float - has_one :equivalent_air_depth, Float, tag: "equivalentairdepth" - has_one :h2, Float - has_one :he, Float - has_one :maximum_operation_depth, Float, tag: "maximumoperationdepth" - has_one :maximum_po2, Float, tag: "maximumpo2" - has_one :n2, Float - has_one :name, String - has_one :o2, Float - has_one :price_per_litre, Price, tag: "priceperlitre" - end - - class GasDefinitions - include HappyMapper - - tag "gasdefinitions" - - has_many :mixes, Mix, tag: "mix" - end - class WayAltitude include HappyMapper @@ -223,78 +125,29 @@ class Waypoint has_one :temperature, Float end - class Medicine - include HappyMapper - - tag "medicine" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class MedicationBeforeDive - include HappyMapper - - tag "medicationbeforedive" - - has_many :medicines, Medicine, tag: "medicine" - end - - class Drink - include HappyMapper - - tag "drink" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class AlcoholBeforeDive - include HappyMapper - - tag "alcoholbeforedive" - - has_many :drinks, Drink, tag: "drink" - end - class InformationBeforeDive include HappyMapper tag "informationbeforedive" has_one :air_temperature, Float, tag: "airtemperature" - has_one :alcohol_before_dive, AlcoholBeforeDive, tag: "alcoholbeforedive" + has_one :alcohol_before_dive, Base::Models::AlcoholBeforeDive, tag: "alcoholbeforedive" has_one :altitude, Float has_one :apparatus, String has_one :datetime, DateTime has_one :dive_number, Integer, tag: "divenumber" has_one :internal_dive_number, Integer, tag: "internaldivenumber" - has_many :links, Link, tag: "link" - has_one :medication_before_dive, MedicationBeforeDive, tag: "medicationbeforedive" + has_many :links, Base::Models::Link, tag: "link" + has_one :medication_before_dive, Base::Models::MedicationBeforeDive, tag: "medicationbeforedive" has_one :no_suit, String, tag: "nosuit" has_one :platform, String - has_one :price, Price + has_one :price, Base::Models::Price has_one :purpose, String has_one :state_of_rest_before_dive, String, tag: "stateofrestbeforedive" has_one :surface_interval_before_dive, SurfaceIntervalBeforeDive, tag: "surfaceintervalbeforedive" has_one :trip_membership, String, tag: "tripmembership" end - class Rating - include HappyMapper - - tag "rating" - - has_one :datetime, DateTime - has_one :rating_value, Integer, tag: "ratingvalue" - end - class GlobalAlarmsGiven include HappyMapper @@ -309,113 +162,7 @@ class EquipmentUsed tag "equipmentused" has_one :lead_quantity, Float, tag: "leadquantity" - has_many :links, Link, tag: "link" - end - - class AnySymptoms - include HappyMapper - - tag "anysymptoms" - - has_one :notes, Notes - end - - class Abundance - include HappyMapper - - tag "abundance" - - attribute :quality, String - attribute :occurrence, String - content :value, Integer - end - - class Species - include HappyMapper - - tag "species" - - attribute :id, String - has_one :abundance, Abundance - has_one :age, Integer - has_one :dominance, String - has_one :life_stage, String, tag: "lifestage" - has_one :notes, Notes - has_one :scientific_name, String, tag: "scientificname" - has_one :sex, String - has_one :size, Float - has_one :trivial_name, String, tag: "trivialname" - end - - class WithSpecies - include HappyMapper - - has_many :species, Species, tag: "species" - end - - class Invertebrata - include HappyMapper - - tag "invertebrata" - - has_one :ascidiacea, WithSpecies - has_one :bryozoan, WithSpecies - has_one :cnidaria, WithSpecies - has_one :coelenterata, WithSpecies - has_one :crustacea, WithSpecies - has_one :ctenophora, WithSpecies - has_one :echinodermata, WithSpecies - has_one :invertebrata_various, WithSpecies, tag: "invertebratavarious" - has_one :mollusca, WithSpecies - has_one :phoronidea, WithSpecies - has_one :plathelminthes, WithSpecies - has_one :porifera, WithSpecies - end - - class Vertebrata - include HappyMapper - - tag "vertebrata" - - has_one :amphibia, WithSpecies - has_one :chondrichthyes, WithSpecies - has_one :mammalia, WithSpecies - has_one :osteichthyes, WithSpecies - has_one :reptilia, WithSpecies - has_one :vertebrata_various, WithSpecies, tag: "vertebratavarious" - end - - class Fauna - include HappyMapper - - tag "fauna" - - has_one :invertebrata, Invertebrata - has_one :notes, Notes - has_one :vertebrata, Vertebrata - end - - class Flora - include HappyMapper - - tag "flora" - - has_one :chlorophyceae, WithSpecies - has_one :flora_various, WithSpecies, tag: "floravarious" - has_one :notes, Notes - has_one :phaeophyceae, WithSpecies - has_one :rhodophyceae, WithSpecies - has_one :spermatophyta, WithSpecies - end - - class Observations - include HappyMapper - - tag "observations" - - has_one :fauna, Fauna - has_one :flora, Flora - has_one :notes, Notes + has_many :links, Base::Models::Link, tag: "link" end class InformationAfterDive @@ -423,7 +170,7 @@ class InformationAfterDive tag "informationafterdive" - has_one :any_symptoms, AnySymptoms, tag: "anysymptoms" + has_one :any_symptoms, Base::Models::AnySymptoms, tag: "anysymptoms" has_one :current, String has_one :desaturation_time, Float, tag: "desaturationtime" has_one :dive_duration, Float, tag: "diveduration" @@ -436,12 +183,12 @@ class InformationAfterDive has_one :highest_po2, Float, tag: "highestpo2" has_one :lowest_temperature, Float, tag: "lowesttemperature" has_one :no_flight_time, Float, tag: "noflighttime" - has_one :notes, Notes - has_one :observations, Observations + has_one :notes, Base::Models::Notes + has_one :observations, Base::Models::Observations has_one :pressure_drop, Float, tag: "pressuredrop" has_many :problems, String, tag: "problems" has_one :program, String - has_many :ratings, Rating, tag: "rating" + has_many :ratings, Base::Models::Rating, tag: "rating" has_one :surface_interval_after_dive, SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive" has_one :thermal_comfort, String, tag: "thermalcomfort" has_one :visibility, Float @@ -463,32 +210,12 @@ class TankData attribute :id, String has_one :breathing_consumption_volume, Float, tag: "breathingconsumptionvolume" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :tank_pressure_begin, Float, tag: "tankpressurebegin" has_one :tank_pressure_end, Float, tag: "tankpressureend" has_one :tank_volume, Float, tag: "tankvolume" end - class Hargikas - include HappyMapper - - tag "hargikas" - - has_one :ambient, Float - has_many :tissues, Tissue, tag: "tissue" - has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel" - has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt" - has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel" - end - - class ApplicationData - include HappyMapper - - tag "applicationdata" - - has_one :hargikas, Hargikas - end - class Dive include HappyMapper @@ -497,7 +224,7 @@ class Dive attribute :id, String has_one :information_after_dive, InformationAfterDive, tag: "informationafterdive" has_one :information_before_dive, InformationBeforeDive, tag: "informationbeforedive" - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV300, tag: "applicationdata" has_one :samples, Samples has_many :tank_data, TankData, tag: "tankdata" end @@ -549,7 +276,7 @@ class InputProfile tag "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_many :waypoints, Waypoint, tag: "waypoint" end @@ -570,12 +297,12 @@ class Profile tag "profile" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :deco_model, DecoModel, tag: "decomodel" + has_one :application_data, Base::Models::ApplicationDataV300, tag: "applicationdata" + has_one :deco_model, Base::Models::DecoModel, tag: "decomodel" has_one :deep_stop_time, Float, tag: "deepstoptime" has_one :density, Float has_one :input_profile, InputProfile, tag: "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :maximum_ascending_rate, Float, tag: "maximumascendingrate" has_one :mix_change, MixChange, tag: "mixchange" has_one :output, Output @@ -646,9 +373,9 @@ class BottomTimeTable tag "bottomtimetable" attribute :id, String - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV300, tag: "applicationdata" has_one :bottom_time_table_scope, BottomTimeTableScope, tag: "bottomtimetablescope" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :output, Output has_one :title, String end @@ -671,498 +398,6 @@ class TableGeneration has_one :calculate_table, CalculateTable, tag: "calculatetable" end - class ImageData - include HappyMapper - - tag "imagedata" - - has_one :aperture, Float - has_one :datetime, DateTime - has_one :exposure_compensation, Float, tag: "exposurecompensation" - has_one :film_speed, Integer, tag: "filmspeed" - has_one :focal_length, Float, tag: "focallength" - has_one :focusing_distance, Float, tag: "focusingdistance" - has_one :metering_method, String, tag: "meteringmethod" - has_one :shutter_speed, Float, tag: "shutterspeed" - end - - class Image - include HappyMapper - - tag "image" - - attribute :id, String - attribute :height, Integer - attribute :width, Integer - attribute :format, String - has_one :image_data, ImageData, tag: "imagedata" - has_one :object_name, String, tag: "objectname" - has_one :title, String - end - - class Video - include HappyMapper - - tag "video" - - attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String - end - - class Audio - include HappyMapper - - tag "audio" - - attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String - end - - class MediaData - include HappyMapper - - tag "mediadata" - - has_many :audio_files, Audio, tag: "audio" - has_many :image_files, Image, tag: "image" - has_many :video_files, Video, tag: "video" - end - - class PriceDivePackage - include HappyMapper - - tag "pricedivepackage" - - attribute :currency, String - attribute :no_of_dives, Integer, tag: "noofdives" - content :value, Float - end - - class RelatedDives - include HappyMapper - - tag "relateddives" - - has_many :links, Link, tag: "link" - end - - class ShipDimension - include HappyMapper - - tag "shipdimension" - - has_one :beam, Float - has_one :displacement, Float - has_one :draught, Float - has_one :length, Float - has_one :tonnage, Float - end - - class Vessel - include HappyMapper - - tag "vessel" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :marina, String - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - end - - class Operator - include HappyMapper - - tag "operator" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - end - - class DateOfTrip - include HappyMapper - - tag "dateoftrip" - - attribute :start_date, DateTime, tag: "startdate" - attribute :end_date, DateTime, tag: "enddate" - end - - class Accommodation - include HappyMapper - - tag "accommodation" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :category, String - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - end - - class Geography - include HappyMapper - - tag "geography" - - has_one :address, Base::Models::Address - has_one :altitude, Float - has_one :latitude, Float - has_one :location, String - has_one :longitude, Float - has_one :time_zone, Float, tag: "timezone" - end - - class TripPart - include HappyMapper - - tag "trippart" - - attribute :type, String - has_one :accommodation, Accommodation - has_one :date_of_trip, DateOfTrip, tag: "dateoftrip" - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :operator, Operator - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_one :related_dives, RelatedDives, tag: "relateddives" - has_one :vessel, Vessel - end - - class Trip - include HappyMapper - - tag "trip" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_many :ratings, Rating, tag: "rating" - has_many :trip_parts, TripPart, tag: "trippart" - end - - class DiveTrip - include HappyMapper - - tag "divetrip" - - has_many :trips, Trip, tag: "trip" - end - - class Ecology - include HappyMapper - - tag "ecology" - - has_one :fauna, Fauna - has_one :flora, Flora - end - - class Built - include HappyMapper - - tag "built" - - has_one :launching_date, Base::Models::DateTimeField, tag: "launchingdate" - has_one :ship_yard, String, tag: "shipyard" - end - - class Wreck - include HappyMapper - - tag "wreck" - - has_many :alias_names, String, tag: "aliasname" - has_one :built, Built - has_one :name, String - has_one :nationality, String - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - has_one :sunk, Base::Models::DateTimeField - end - - class Shore - include HappyMapper - - tag "shore" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class River - include HappyMapper - - tag "river" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Lake - include HappyMapper - - tag "lake" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Indoor - include HappyMapper - - tag "indoor" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Cave - include HappyMapper - - tag "cave" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class SiteData - include HappyMapper - - tag "sidedata" - - has_one :area_length, Float, tag: "arealength" - has_one :area_width, Float, tag: "areawidth" - has_one :average_visibility, Float, tag: "averagevisibility" - has_one :bottom, String - has_one :cave, Cave - has_one :density, Float - has_one :difficulty, Integer - has_one :global_light_intensity, String, tag: "globallightintensity" - has_one :indoor, Indoor - has_one :maximum_depth, Float, tag: "maximumdepth" - has_one :maximum_visibility, Float, tag: "maximumvisibility" - has_one :minimum_depth, Float, tag: "minimumdepth" - has_one :minimum_visibility, Float, tag: "minimumvisibility" - has_one :river, River - has_one :shore, Shore - has_one :terrain, String - has_one :wreck, Wreck - end - - class Site - include HappyMapper - - tag "site" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ecology, Ecology - has_one :environment, String - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :side_data, SiteData, tag: "sitedata" - end - - class Guide - include HappyMapper - - tag "guide" - - has_many :links, Link, tag: "link" - end - - class DiveBase - include HappyMapper - - tag "divebase" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_many :guides, Guide, tag: "guide" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_many :ratings, Rating, tag: "rating" - end - - class DiveSite - include HappyMapper - - tag "divesite" - - has_many :dive_bases, DiveBase, tag: "divebase" - has_many :sites, Site, tag: "site" - end - - class Shop - include HappyMapper - - tag "shop" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Membership - include HappyMapper - - tag "membership" - - attribute :organisation, String - attribute :member_id, String, tag: "memberid" - end - - class NumberOfDives - include HappyMapper - - tag "numberofdives" - - has_one :start_date, DateTime, tag: "startdate" - has_one :end_date, DateTime, tag: "enddate" - has_one :dives, Integer - end - - class Personal - include HappyMapper - - tag "personal" - - has_one :birth_date, Base::Models::DateTimeField, tag: "birthdate" - has_one :birth_name, String, tag: "birthname" - has_one :blood_group, String, tag: "bloodgroup" - has_one :first_name, String, tag: "firstname" - has_one :height, Float - has_one :honorific, String - has_one :last_name, String, tag: "lastname" - has_one :membership, Membership - has_one :middle_name, String, tag: "middlename" - has_one :number_of_dives, NumberOfDives, tag: "numberofdives" - has_one :sex, String - has_one :smoking, String - has_one :weight, Float - end - - class Instructor - include HappyMapper - - tag "instructor" - - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Certification - include HappyMapper - - tag "certification" - - has_one :instructor, Instructor - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :level, String - has_one :link, Link - has_one :organization, String - has_one :specialty, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class Education - include HappyMapper - - tag "education" - - has_many :certifications, Certification, tag: "certification" - end - - class Insurance - include HappyMapper - - tag "insurance" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DiveInsurances - include HappyMapper - - tag "diveinsurances" - - has_many :insurances, Insurance, tag: "insurance" - end - - class Permit - include HappyMapper - - tag "permit" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :region, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DivePermissions - include HappyMapper - - tag "divepermissions" - - has_many :permits, Permit, tag: "permit" - end - - class Purchase - include HappyMapper - - tag "purchase" - - has_one :datetime, DateTime - has_one :link, Link - has_one :price, Price - has_one :shop, Shop - end - class EquipmentPart include HappyMapper @@ -1170,12 +405,12 @@ class EquipmentPart attribute :id, String has_many :alias_names, String, tag: "aliasname" - has_one :manufacturer, Manufacturer + has_one :manufacturer, Base::Models::Manufacturer has_one :model, String has_one :name, String has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase has_one :serial_number, String, tag: "serialnumber" has_one :service_interval, Integer, tag: "serviceinterval" end @@ -1252,9 +487,9 @@ class EquipmentConfiguration < EquipmentContent tag "equipmentconfiguration" has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :name, String - has_one :notes, Notes + has_one :notes, Base::Models::Notes end class Equipment < EquipmentContent @@ -1266,86 +501,37 @@ class Equipment < EquipmentContent has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" end - class Doctor - include HappyMapper - - tag "doctor" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Examination - include HappyMapper - - tag "examination" - - has_one :datetime, DateTime - has_one :doctor, Doctor - has_one :examination_result, String, tag: "examinationresult" - has_many :links, Link, tag: "link" - has_one :notes, Notes - has_one :total_lung_capacity, Float, tag: "totallungcapacity" - has_one :vital_capacity, Float, tag: "vitalcapacity" - end - - class Medical - include HappyMapper - - tag "medical" - - has_one :examination, Examination - end - class BuddyOwnerShared include HappyMapper attribute :id, String has_one :address, Base::Models::Address has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" + has_one :dive_insurances, Base::Models::DiveInsurances, tag: "diveinsurances" + has_one :dive_permissions, Base::Models::DivePermissions, tag: "divepermissions" has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal + has_one :medical, Base::Models::Medical + has_one :notes, Base::Models::Notes + has_one :personal, Base::Models::Personal end - class Buddy + class Buddy < BuddyOwnerShared include HappyMapper tag "buddy" attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :certification, Certification + has_one :certification, Base::Models::Certification has_one :student, String end - class Owner + class Owner < BuddyOwnerShared include HappyMapper tag "owner" attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :education, Education + has_one :education, Base::Models::Education end class Diver @@ -1357,146 +543,19 @@ class Diver has_one :owner, Owner end - class DCAlarm - include HappyMapper - - tag "dcalarm" - - has_one :acknowledge, String - has_one :alarm_type, Integer, tag: "alarmtype" - has_one :period, Float - end - - class SetDCDiveDepthAlarm - include HappyMapper - - tag "setdcdivedethalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :dc_alarm_depth, Float, tag: "dcalarmdepth" - end - - class SetDCDivePo2Alarm - include HappyMapper - - tag "setdcdivepo2alarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :maximum_po2, Float, tag: "maximumpo2" - end - - class SetDCDiveSiteData - include HappyMapper - - tag "setdcdivesitedata" - - attribute :dive_site, String, tag: "divesite" - end - - class SetDCDiveTimeAlarm - include HappyMapper - - tag "setdcdivetimealarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :timespan, Float - end - - class SetDCEndNDTAlarm - include HappyMapper - - tag "setdcendndtalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - end - - class SetDCDecoModel - include HappyMapper - - tag "setdcdecomodel" - - has_many :alias_names, String, tag: "aliasname" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :name, String - end - - class SetDCBuddyData - include HappyMapper - - tag "setdcbuddydata" - - attribute :buddy, String - end - - class SetDCData - include HappyMapper - - tag "setdcdata" - - has_one :set_dc_alarm_time, DateTime, tag: "setdcalarmtime" - has_one :set_dc_altitude, Float, tag: "setdcaltitude" - has_one :set_dc_buddy_data, SetDCBuddyData, tag: "setdcbuddydata" - has_one :set_dc_date_time, DateTime, tag: "setdcdatetime" - has_one :set_dc_deco_model, SetDCDecoModel, tag: "setdcdecomodel" - has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm, tag: "setdcdivedethalarm" - has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm, tag: "setdcdivepo2alarm" - has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata" - has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm, tag: "setdcdivetimealarm" - has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm, tag: "setdcendndtalarm" - has_one :set_dc_gas_definitions_data, String, tag: "setdcgasdefinitionsdata" - has_one :set_dc_owner_data, String, tag: "setdcownerdata" - has_one :set_dc_password, String, tag: "setdcpassword" - has_one :set_dc_generator_data, String, tag: "setdcgeneratordata" - end - - class GetDCData - include HappyMapper - - tag "getdcdata" - - has_one :get_dc_all_data, String, tag: "getdcalldata" - has_one :get_dc_generator_data, String, tag: "getdcgeneratordata" - has_one :get_dc_owner_data, String, tag: "getdcownerdata" - has_one :get_dc_buddy_data, String, tag: "getdcbuddydata" - has_one :get_dc_gas_definitions_data, String, tag: "getdcgasdefinitionsdata" - has_one :get_dc_dive_site_data, String, tag: "getdcdivesitedata" - has_one :get_dc_dive_trip_data, String, tag: "getdcdivetripdata" - has_one :get_dc_profile_data, String, tag: "getdcprofiledata" - end - - class DiveComputerDump - include HappyMapper - - tag "divecomputerdump" - - has_one :datetime, DateTime - has_one :dc_dump, String, tag: "dcdump" - has_one :link, Link - end - - class DiveComputerControl - include HappyMapper - - tag "divecomputercontrol" - - has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump" - has_one :get_dc_data, GetDCData, tag: "getdcdata" - has_one :set_dc_data, SetDCData, tag: "setdcdata" - end - class Uddf include HappyMapper tag "uddf" attribute :version, String - has_one :dive_computer_control, DiveComputerControl, tag: "divecomputercontrol" + has_one :dive_computer_control, Base::Models::DiveComputerControlV300, tag: "divecomputercontrol" has_one :diver, Diver - has_one :dive_site, DiveSite, tag: "divesite" - has_one :dive_trip, DiveTrip, tag: "divetrip" - has_one :gas_definitions, GasDefinitions, tag: "gasdefinitions" - has_one :generator, Generator - has_one :media_data, MediaData, tag: "mediadata" + has_one :dive_site, Base::Models::DiveSite, tag: "divesite" + has_one :dive_trip, Base::Models::DiveTrip, tag: "divetrip" + has_one :gas_definitions, Base::Models::GasDefinitions, tag: "gasdefinitions" + has_one :generator, Base::Models::Generator + has_one :media_data, Base::Models::MediaData, tag: "mediadata" has_one :profile_data, ProfileData, tag: "profiledata" has_one :table_generation, TableGeneration, tag: "tablegeneration" end diff --git a/lib/uddf/v310/models.rb b/lib/uddf/v310/models.rb index 15a229c..4525643 100644 --- a/lib/uddf/v310/models.rb +++ b/lib/uddf/v310/models.rb @@ -6,138 +6,6 @@ module UDDF module V310 module Models - class Manufacturer - include HappyMapper - - tag "manufacturer" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - end - - class Link - include HappyMapper - - tag "link" - - attribute :ref, String - end - - class Generator - include HappyMapper - - tag "generator" - - has_many :alias_names, String, tag: "aliasname" - has_one :datetime, DateTime - has_many :links, Link, tag: "link" - has_one :name, String - has_one :type, String - has_one :version, String - end - - class Notes - include HappyMapper - - tag "notes" - - has_many :paras, String, tag: "para" - has_many :links, Link, tag: "link" - end - - class Price - include HappyMapper - - tag "price" - - attribute :currency, String - content :value, Float - end - - class Tissue - include HappyMapper - - tag "tissue" - - attribute :gas, String - attribute :half_life, Float, tag: "halflife" - attribute :number, Integer - attribute :a, Float - attribute :b, Float - end - - class VPM - include HappyMapper - - tag "vpm" - - attribute :id, String - has_one :conservatism, Float - has_one :gamma, Float - has_one :gc, Float - has_one :lambda, Float - has_one :r0, Float - has_many :tissues, Tissue, tag: "tissue" - end - - class RGBM - include HappyMapper - - tag "rgbm" - - attribute :id, String - has_many :tissues, Tissue, tag: "tissue" - end - - class Buehlmann - include HappyMapper - - tag "buehlmann" - - attribute :id, String - has_many :tissues, Tissue, tag: "tissue" - end - - class DecoModel - include HappyMapper - - tag "decomodel" - - has_many :buehlmanns, Buehlmann, tag: "buehlmann" - has_many :rgbms, RGBM, tag: "rbgm" - has_many :vpms, VPM, tag: "vpm" - end - - class Mix - include HappyMapper - - tag "mix" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ar, Float - has_one :equivalent_air_depth, Float, tag: "equivalentairdepth" - has_one :h2, Float - has_one :he, Float - has_one :maximum_operation_depth, Float, tag: "maximumoperationdepth" - has_one :maximum_po2, Float, tag: "maximumpo2" - has_one :n2, Float - has_one :name, String - has_one :o2, Float - has_one :price_per_litre, Price, tag: "priceperlitre" - end - - class GasDefinitions - include HappyMapper - - tag "gasdefinitions" - - has_many :mixes, Mix, tag: "mix" - end - class WayAltitude include HappyMapper @@ -288,26 +156,6 @@ class Waypoint has_one :temperature, Float end - class Medicine - include HappyMapper - - tag "medicine" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class MedicationBeforeDive - include HappyMapper - - tag "medicationbeforedive" - - has_many :medicines, Medicine, tag: "medicine" - end - class PlannedProfile include HappyMapper @@ -318,44 +166,24 @@ class PlannedProfile has_many :waypoints, Waypoint, tag: "waypoint" end - class Drink - include HappyMapper - - tag "drink" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class AlcoholBeforeDive - include HappyMapper - - tag "alcoholbeforedive" - - has_many :drinks, Drink, tag: "drink" - end - class InformationBeforeDive include HappyMapper tag "informationbeforedive" has_one :air_temperature, Float, tag: "airtemperature" - has_one :alcohol_before_dive, AlcoholBeforeDive, tag: "alcoholbeforedive" + has_one :alcohol_before_dive, Base::Models::AlcoholBeforeDive, tag: "alcoholbeforedive" has_one :altitude, Float has_one :apparatus, String has_one :datetime, DateTime has_one :dive_number, Integer, tag: "divenumber" has_one :internal_dive_number, Integer, tag: "internaldivenumber" - has_many :links, Link, tag: "link" - has_one :medication_before_dive, MedicationBeforeDive, tag: "medicationbeforedive" + has_many :links, Base::Models::Link, tag: "link" + has_one :medication_before_dive, Base::Models::MedicationBeforeDive, tag: "medicationbeforedive" has_one :no_suit, String, tag: "nosuit" has_one :planned_profile, PlannedProfile, tag: "plannedprofile" has_one :platform, String - has_one :price, Price + has_one :price, Base::Models::Price has_one :purpose, String has_one :state_of_rest_before_dive, String, tag: "stateofrestbeforedive" has_one :surface_interval_before_dive, SurfaceIntervalBeforeDive, tag: "surfaceintervalbeforedive" @@ -363,15 +191,6 @@ class InformationBeforeDive has_one :trip_membership, String, tag: "tripmembership" end - class Rating - include HappyMapper - - tag "rating" - - has_one :datetime, DateTime - has_one :rating_value, Integer, tag: "ratingvalue" - end - class GlobalAlarmsGiven include HappyMapper @@ -386,113 +205,7 @@ class EquipmentUsed tag "equipmentused" has_one :lead_quantity, Float, tag: "leadquantity" - has_many :links, Link, tag: "link" - end - - class AnySymptoms - include HappyMapper - - tag "anysymptoms" - - has_one :notes, Notes - end - - class Abundance - include HappyMapper - - tag "abundance" - - attribute :quality, String - attribute :occurrence, String - content :value, Integer - end - - class Species - include HappyMapper - - tag "species" - - attribute :id, String - has_one :abundance, Abundance - has_one :age, Integer - has_one :dominance, String - has_one :life_stage, String, tag: "lifestage" - has_one :notes, Notes - has_one :scientific_name, String, tag: "scientificname" - has_one :sex, String - has_one :size, Float - has_one :trivial_name, String, tag: "trivialname" - end - - class WithSpecies - include HappyMapper - - has_many :species, Species, tag: "species" - end - - class Invertebrata - include HappyMapper - - tag "invertebrata" - - has_one :ascidiacea, WithSpecies - has_one :bryozoan, WithSpecies - has_one :cnidaria, WithSpecies - has_one :coelenterata, WithSpecies - has_one :crustacea, WithSpecies - has_one :ctenophora, WithSpecies - has_one :echinodermata, WithSpecies - has_one :invertebrata_various, WithSpecies, tag: "invertebratavarious" - has_one :mollusca, WithSpecies - has_one :phoronidea, WithSpecies - has_one :plathelminthes, WithSpecies - has_one :porifera, WithSpecies - end - - class Vertebrata - include HappyMapper - - tag "vertebrata" - - has_one :amphibia, WithSpecies - has_one :chondrichthyes, WithSpecies - has_one :mammalia, WithSpecies - has_one :osteichthyes, WithSpecies - has_one :reptilia, WithSpecies - has_one :vertebrata_various, WithSpecies, tag: "vertebratavarious" - end - - class Fauna - include HappyMapper - - tag "fauna" - - has_one :invertebrata, Invertebrata - has_one :notes, Notes - has_one :vertebrata, Vertebrata - end - - class Flora - include HappyMapper - - tag "flora" - - has_one :chlorophyceae, WithSpecies - has_one :flora_various, WithSpecies, tag: "floravarious" - has_one :notes, Notes - has_one :phaeophyceae, WithSpecies - has_one :rhodophyceae, WithSpecies - has_one :spermatophyta, WithSpecies - end - - class Observations - include HappyMapper - - tag "observations" - - has_one :fauna, Fauna - has_one :flora, Flora - has_one :notes, Notes + has_many :links, Base::Models::Link, tag: "link" end class InformationAfterDive @@ -500,7 +213,7 @@ class InformationAfterDive tag "informationafterdive" - has_one :any_symptoms, AnySymptoms, tag: "anysymptoms" + has_one :any_symptoms, Base::Models::AnySymptoms, tag: "anysymptoms" has_one :average_depth, Float, tag: "averagedepth" has_one :current, String has_one :desaturation_time, Float, tag: "desaturationtime" @@ -514,12 +227,12 @@ class InformationAfterDive has_one :highest_po2, Float, tag: "highestpo2" has_one :lowest_temperature, Float, tag: "lowesttemperature" has_one :no_flight_time, Float, tag: "noflighttime" - has_one :notes, Notes - has_one :observations, Observations + has_one :notes, Base::Models::Notes + has_one :observations, Base::Models::Observations has_one :pressure_drop, Float, tag: "pressuredrop" has_many :problems, String, tag: "problems" has_one :program, String - has_many :ratings, Rating, tag: "rating" + has_many :ratings, Base::Models::Rating, tag: "rating" has_one :surface_interval_after_dive, SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive" has_one :thermal_comfort, String, tag: "thermalcomfort" has_one :visibility, Float @@ -541,33 +254,12 @@ class TankData attribute :id, String has_one :breathing_consumption_volume, Float, tag: "breathingconsumptionvolume" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :tank_pressure_begin, Float, tag: "tankpressurebegin" has_one :tank_pressure_end, Float, tag: "tankpressureend" has_one :tank_volume, Float, tag: "tankvolume" end - class Hargikas - include HappyMapper - - tag "hargikas" - - has_one :ambient, Float - has_many :tissues, Tissue, tag: "tissue" - has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel" - has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt" - has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel" - end - - class ApplicationData - include HappyMapper - - tag "applicationdata" - - has_one :deco_trainer, String, tag: "decotrainer" - has_one :hargikas, Hargikas - end - class Dive include HappyMapper @@ -576,7 +268,7 @@ class Dive attribute :id, String has_one :information_after_dive, InformationAfterDive, tag: "informationafterdive" has_one :information_before_dive, InformationBeforeDive, tag: "informationbeforedive" - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" has_one :samples, Samples has_many :tank_data, TankData, tag: "tankdata" end @@ -628,7 +320,7 @@ class InputProfile tag "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_many :waypoints, Waypoint, tag: "waypoint" end @@ -649,12 +341,12 @@ class Profile tag "profile" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :deco_model, DecoModel, tag: "decomodel" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" + has_one :deco_model, Base::Models::DecoModelV310, tag: "decomodel" has_one :deep_stop_time, Float, tag: "deepstoptime" has_one :density, Float has_one :input_profile, InputProfile, tag: "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :maximum_ascending_rate, Float, tag: "maximumascendingrate" has_one :mix_change, MixChange, tag: "mixchange" has_one :output, Output @@ -725,9 +417,9 @@ class BottomTimeTable tag "bottomtimetable" attribute :id, String - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" has_one :bottom_time_table_scope, BottomTimeTableScope, tag: "bottomtimetablescope" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :output, Output has_one :title, String end @@ -750,835 +442,167 @@ class TableGeneration has_one :calculate_table, CalculateTable, tag: "calculatetable" end - class ImageData - include HappyMapper - - tag "imagedata" - - has_one :aperture, Float - has_one :datetime, DateTime - has_one :exposure_compensation, Float, tag: "exposurecompensation" - has_one :film_speed, Integer, tag: "filmspeed" - has_one :focal_length, Float, tag: "focallength" - has_one :focusing_distance, Float, tag: "focusingdistance" - has_one :metering_method, String, tag: "meteringmethod" - has_one :shutter_speed, Float, tag: "shutterspeed" - end - - class Image - include HappyMapper - - tag "image" - - attribute :id, String - attribute :height, Integer - attribute :width, Integer - attribute :format, String - has_one :image_data, ImageData, tag: "imagedata" - has_one :object_name, String, tag: "objectname" - has_one :title, String - end - - class Video + class EquipmentPart include HappyMapper - tag "video" + tag "equipmentpart" attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_many :alias_names, String, tag: "aliasname" + has_one :manufacturer, Base::Models::Manufacturer + has_one :model, String + has_one :name, String + has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase + has_one :serial_number, String, tag: "serialnumber" + has_one :service_interval, Integer, tag: "serviceinterval" end - class Audio + class Lead < EquipmentPart include HappyMapper - tag "audio" + tag "lead" - attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_one :lead_quantity, Integer, tag: "leadquantity" end - class MediaData + class Rebreather < EquipmentPart include HappyMapper - tag "mediadata" + tag "rebreather" - has_many :audio_files, Audio, tag: "audio" - has_many :image_files, Image, tag: "image" - has_many :video_files, Video, tag: "video" + has_many :o2_sensors, EquipmentPart, tag: "o2sensor" end - class PriceDivePackage + class Suit < EquipmentPart include HappyMapper - tag "pricedivepackage" + tag "suit" - attribute :currency, String - attribute :no_of_dives, Integer, tag: "noofdives" - content :value, Float + has_one :suit_type, String, tag: "suittype" end - class RelatedDives + class Tank < EquipmentPart include HappyMapper - tag "relateddives" + tag "tank" - has_many :links, Link, tag: "link" + has_one :tank_material, String, tag: "tankmaterial" + has_one :tank_volume, Float, tag: "tankvolume" end - class ShipDimension + class Camera include HappyMapper - tag "shipdimension" + tag "camera" - has_one :beam, Float - has_one :displacement, Float - has_one :draught, Float - has_one :length, Float - has_one :tonnage, Float + has_one :body, EquipmentPart + has_many :flashes, EquipmentPart, tag: "flash" + has_one :housing, EquipmentPart + has_one :lens, EquipmentPart end - class Vessel + class EquipmentContent include HappyMapper - tag "vessel" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :marina, String - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" + has_many :boots, EquipmentPart, tag: "boots" + has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" + has_many :cameras, Camera, tag: "camera" + has_many :compasses, EquipmentPart, tag: "compass" + has_many :dive_computers, EquipmentPart, tag: "divecomputer" + has_many :fins, EquipmentPart, tag: "fins" + has_many :gloves, EquipmentPart, tag: "gloves" + has_many :knives, EquipmentPart, tag: "knife" + has_many :leads, Lead, tag: "lead" + has_many :lights, EquipmentPart, tag: "light" + has_many :masks, EquipmentPart, tag: "mask" + has_many :rebreathers, Rebreather, tag: "rebreather" + has_many :regulators, EquipmentPart, tag: "regulator" + has_many :scooters, EquipmentPart, tag: "scooter" + has_many :suits, Suit, tag: "suit" + has_many :tanks, Tank, tag: "tank" + has_many :various_pieces, EquipmentPart, tag: "variouspieces" + has_many :video_cameras, EquipmentPart, tag: "videocamera" + has_many :watches, EquipmentPart, tag: "watch" end - class Operator + class EquipmentConfiguration < EquipmentContent include HappyMapper - tag "operator" + tag "equipmentconfiguration" has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact + has_many :links, Base::Models::Link, tag: "link" has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_one :notes, Base::Models::Notes end - class DateOfTrip + class Equipment < EquipmentContent include HappyMapper - tag "dateoftrip" + tag "equipment" - attribute :start_date, DateTime, tag: "startdate" - attribute :end_date, DateTime, tag: "enddate" + has_many :compressors, EquipmentPart, tag: "compressor" + has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" end - class Accommodation + class BuddyOwnerShared include HappyMapper - tag "accommodation" - + attribute :id, String has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :category, String has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_one :dive_insurances, Base::Models::DiveInsurances, tag: "diveinsurances" + has_one :dive_permissions, Base::Models::DivePermissions, tag: "divepermissions" + has_one :equipment, Equipment + has_one :medical, Base::Models::Medical + has_one :notes, Base::Models::Notes + has_one :personal, Base::Models::Personal end - class Geography + class Buddy < BuddyOwnerShared include HappyMapper - tag "geography" + tag "buddy" - has_one :address, Base::Models::Address - has_one :altitude, Float - has_one :latitude, Float - has_one :location, String - has_one :longitude, Float - has_one :time_zone, Float, tag: "timezone" + attribute :id, String + has_one :certification, Base::Models::Certification + has_one :student, String end - class TripPart + class Owner < BuddyOwnerShared include HappyMapper - tag "trippart" + tag "owner" - attribute :type, String - has_one :accommodation, Accommodation - has_one :date_of_trip, DateOfTrip, tag: "dateoftrip" - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :operator, Operator - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_one :related_dives, RelatedDives, tag: "relateddives" - has_one :vessel, Vessel + attribute :id, String + has_one :education, Base::Models::Education end - class Trip + class Diver include HappyMapper - tag "trip" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_many :ratings, Rating, tag: "rating" - has_many :trip_parts, TripPart, tag: "trippart" - end - - class DiveTrip - include HappyMapper - - tag "divetrip" - - has_many :trips, Trip, tag: "trip" - end - - class Ecology - include HappyMapper - - tag "ecology" - - has_one :fauna, Fauna - has_one :flora, Flora - end - - class Built - include HappyMapper - - tag "built" - - has_one :launching_date, Base::Models::DateTimeField, tag: "launchingdate" - has_one :ship_yard, String, tag: "shipyard" - end - - class Wreck - include HappyMapper - - tag "wreck" - - has_many :alias_names, String, tag: "aliasname" - has_one :built, Built - has_one :name, String - has_one :nationality, String - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - has_one :sunk, Base::Models::DateTimeField - end - - class Shore - include HappyMapper - - tag "shore" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class River - include HappyMapper - - tag "river" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Lake - include HappyMapper - - tag "lake" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Indoor - include HappyMapper - - tag "indoor" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Cave - include HappyMapper - - tag "cave" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class SiteData - include HappyMapper - - tag "sidedata" - - has_one :area_length, Float, tag: "arealength" - has_one :area_width, Float, tag: "areawidth" - has_one :average_visibility, Float, tag: "averagevisibility" - has_one :bottom, String - has_one :cave, Cave - has_one :density, Float - has_one :difficulty, Integer - has_one :global_light_intensity, String, tag: "globallightintensity" - has_one :indoor, Indoor - has_one :maximum_depth, Float, tag: "maximumdepth" - has_one :maximum_visibility, Float, tag: "maximumvisibility" - has_one :minimum_depth, Float, tag: "minimumdepth" - has_one :minimum_visibility, Float, tag: "minimumvisibility" - has_one :river, River - has_one :shore, Shore - has_one :terrain, String - has_one :wreck, Wreck - end - - class Site - include HappyMapper - - tag "site" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ecology, Ecology - has_one :environment, String - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :side_data, SiteData, tag: "sitedata" - end - - class Guide - include HappyMapper - - tag "guide" - - has_many :links, Link, tag: "link" - end - - class DiveBase - include HappyMapper - - tag "divebase" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_many :guides, Guide, tag: "guide" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_many :ratings, Rating, tag: "rating" - end - - class DiveSite - include HappyMapper - - tag "divesite" - - has_many :dive_bases, DiveBase, tag: "divebase" - has_many :sites, Site, tag: "site" - end - - class Shop - include HappyMapper - - tag "shop" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Membership - include HappyMapper - - tag "membership" - - attribute :organisation, String - attribute :member_id, String, tag: "memberid" - end - - class NumberOfDives - include HappyMapper - - tag "numberofdives" - - has_one :start_date, DateTime, tag: "startdate" - has_one :end_date, DateTime, tag: "enddate" - has_one :dives, Integer - end - - class Personal - include HappyMapper - - tag "personal" - - has_one :birth_date, Base::Models::DateTimeField, tag: "birthdate" - has_one :birth_name, String, tag: "birthname" - has_one :blood_group, String, tag: "bloodgroup" - has_one :first_name, String, tag: "firstname" - has_one :height, Float - has_one :honorific, String - has_one :last_name, String, tag: "lastname" - has_one :membership, Membership - has_one :middle_name, String, tag: "middlename" - has_one :number_of_dives, NumberOfDives, tag: "numberofdives" - has_one :sex, String - has_one :smoking, String - has_one :weight, Float - end - - class Instructor - include HappyMapper - - tag "instructor" - - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Certification - include HappyMapper - - tag "certification" - - has_one :instructor, Instructor - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :level, String - has_one :link, Link - has_one :organization, String - has_one :specialty, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class Education - include HappyMapper - - tag "education" - - has_many :certifications, Certification, tag: "certification" - end - - class Insurance - include HappyMapper - - tag "insurance" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DiveInsurances - include HappyMapper - - tag "diveinsurances" - - has_many :insurances, Insurance, tag: "insurance" - end - - class Permit - include HappyMapper - - tag "permit" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :region, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DivePermissions - include HappyMapper - - tag "divepermissions" - - has_many :permits, Permit, tag: "permit" - end - - class Purchase - include HappyMapper - - tag "purchase" - - has_one :datetime, DateTime - has_one :link, Link - has_one :price, Price - has_one :shop, Shop - end - - class EquipmentPart - include HappyMapper - - tag "equipmentpart" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :manufacturer, Manufacturer - has_one :model, String - has_one :name, String - has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase - has_one :serial_number, String, tag: "serialnumber" - has_one :service_interval, Integer, tag: "serviceinterval" - end - - class Lead < EquipmentPart - include HappyMapper - - tag "lead" - - has_one :lead_quantity, Integer, tag: "leadquantity" - end - - class Rebreather < EquipmentPart - include HappyMapper - - tag "rebreather" - - has_many :o2_sensors, EquipmentPart, tag: "o2sensor" - end - - class Suit < EquipmentPart - include HappyMapper - - tag "suit" - - has_one :suit_type, String, tag: "suittype" - end - - class Tank < EquipmentPart - include HappyMapper - - tag "tank" - - has_one :tank_material, String, tag: "tankmaterial" - has_one :tank_volume, Float, tag: "tankvolume" - end - - class Camera - include HappyMapper - - tag "camera" - - has_one :body, EquipmentPart - has_many :flashes, EquipmentPart, tag: "flash" - has_one :housing, EquipmentPart - has_one :lens, EquipmentPart - end - - class EquipmentContent - include HappyMapper - - has_many :boots, EquipmentPart, tag: "boots" - has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" - has_many :cameras, Camera, tag: "camera" - has_many :compasses, EquipmentPart, tag: "compass" - has_many :dive_computers, EquipmentPart, tag: "divecomputer" - has_many :fins, EquipmentPart, tag: "fins" - has_many :gloves, EquipmentPart, tag: "gloves" - has_many :knives, EquipmentPart, tag: "knife" - has_many :leads, Lead, tag: "lead" - has_many :lights, EquipmentPart, tag: "light" - has_many :masks, EquipmentPart, tag: "mask" - has_many :rebreathers, Rebreather, tag: "rebreather" - has_many :regulators, EquipmentPart, tag: "regulator" - has_many :scooters, EquipmentPart, tag: "scooter" - has_many :suits, Suit, tag: "suit" - has_many :tanks, Tank, tag: "tank" - has_many :various_pieces, EquipmentPart, tag: "variouspieces" - has_many :video_cameras, EquipmentPart, tag: "videocamera" - has_many :watches, EquipmentPart, tag: "watch" - end - - class EquipmentConfiguration < EquipmentContent - include HappyMapper - - tag "equipmentconfiguration" - - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - end - - class Equipment < EquipmentContent - include HappyMapper - - tag "equipment" - - has_many :compressors, EquipmentPart, tag: "compressor" - has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" - end - - class Doctor - include HappyMapper - - tag "doctor" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Examination - include HappyMapper - - tag "examination" - - has_one :datetime, DateTime - has_one :doctor, Doctor - has_one :examination_result, String, tag: "examinationresult" - has_many :links, Link, tag: "link" - has_one :notes, Notes - has_one :total_lung_capacity, Float, tag: "totallungcapacity" - has_one :vital_capacity, Float, tag: "vitalcapacity" - end - - class Medical - include HappyMapper - - tag "medical" - - has_one :examination, Examination - end - - class BuddyOwnerShared - include HappyMapper - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - end - - class Buddy - include HappyMapper - - tag "buddy" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :certification, Certification - has_one :student, String - end - - class Owner - include HappyMapper - - tag "owner" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :education, Education - end - - class Diver - include HappyMapper - - tag "diver" + tag "diver" has_many :buddies, Buddy, tag: "buddy" has_one :owner, Owner end - class DCAlarm - include HappyMapper - - tag "dcalarm" - - has_one :acknowledge, String - has_one :alarm_type, Integer, tag: "alarmtype" - has_one :period, Float - end - - class SetDCDiveDepthAlarm - include HappyMapper - - tag "setdcdivedethalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :dc_alarm_depth, Float, tag: "dcalarmdepth" - end - - class SetDCDivePo2Alarm - include HappyMapper - - tag "setdcdivepo2alarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :maximum_po2, Float, tag: "maximumpo2" - end - - class SetDCDiveSiteData - include HappyMapper - - tag "setdcdivesitedata" - - attribute :dive_site, String, tag: "divesite" - end - - class SetDCDiveTimeAlarm - include HappyMapper - - tag "setdcdivetimealarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :timespan, Float - end - - class SetDCEndNDTAlarm - include HappyMapper - - tag "setdcendndtalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - end - - class SetDCDecoModel - include HappyMapper - - tag "setdcdecomodel" - - has_many :alias_names, String, tag: "aliasname" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :name, String - end - - class SetDCBuddyData - include HappyMapper - - tag "setdcbuddydata" - - attribute :buddy, String - end - - class SetDCData - include HappyMapper - - tag "setdcdata" - - has_one :set_dc_alarm_time, DateTime, tag: "setdcalarmtime" - has_one :set_dc_altitude, Float, tag: "setdcaltitude" - has_one :set_dc_buddy_data, SetDCBuddyData, tag: "setdcbuddydata" - has_one :set_dc_date_time, DateTime, tag: "setdcdatetime" - has_one :set_dc_deco_model, SetDCDecoModel, tag: "setdcdecomodel" - has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm, tag: "setdcdivedethalarm" - has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm, tag: "setdcdivepo2alarm" - has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata" - has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm, tag: "setdcdivetimealarm" - has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm, tag: "setdcendndtalarm" - has_one :set_dc_gas_definitions_data, String, tag: "setdcgasdefinitionsdata" - has_one :set_dc_owner_data, String, tag: "setdcownerdata" - has_one :set_dc_password, String, tag: "setdcpassword" - has_one :set_dc_generator_data, String, tag: "setdcgeneratordata" - end - - class GetDCData - include HappyMapper - - tag "getdcdata" - - has_one :get_dc_all_data, String, tag: "getdcalldata" - has_one :get_dc_generator_data, String, tag: "getdcgeneratordata" - has_one :get_dc_owner_data, String, tag: "getdcownerdata" - has_one :get_dc_buddy_data, String, tag: "getdcbuddydata" - has_one :get_dc_gas_definitions_data, String, tag: "getdcgasdefinitionsdata" - has_one :get_dc_dive_site_data, String, tag: "getdcdivesitedata" - has_one :get_dc_dive_trip_data, String, tag: "getdcdivetripdata" - has_one :get_dc_profile_data, String, tag: "getdcprofiledata" - end - - class DiveComputerDump - include HappyMapper - - tag "divecomputerdump" - - has_one :datetime, DateTime - has_one :dc_dump, String, tag: "dcdump" - has_one :link, Link - end - - class DiveComputerControl - include HappyMapper - - tag "divecomputercontrol" - - has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump" - has_one :get_dc_data, GetDCData, tag: "getdcdata" - has_one :set_dc_data, SetDCData, tag: "setdcdata" - end - class Uddf include HappyMapper tag "uddf" attribute :version, String - has_one :deco_model, DecoModel, tag: "decomodel" - has_one :dive_computer_control, DiveComputerControl, tag: "divecomputercontrol" + has_one :deco_model, Base::Models::DecoModelV310, tag: "decomodel" + has_one :dive_computer_control, Base::Models::DiveComputerControlV310, tag: "divecomputercontrol" has_one :diver, Diver - has_one :dive_site, DiveSite, tag: "divesite" - has_one :dive_trip, DiveTrip, tag: "divetrip" - has_one :gas_definitions, GasDefinitions, tag: "gasdefinitions" - has_one :generator, Generator - has_one :media_data, MediaData, tag: "mediadata" + has_one :dive_site, Base::Models::DiveSite, tag: "divesite" + has_one :dive_trip, Base::Models::DiveTrip, tag: "divetrip" + has_one :gas_definitions, Base::Models::GasDefinitions, tag: "gasdefinitions" + has_one :generator, Base::Models::Generator + has_one :media_data, Base::Models::MediaData, tag: "mediadata" has_one :profile_data, ProfileData, tag: "profiledata" has_one :table_generation, TableGeneration, tag: "tablegeneration" end diff --git a/lib/uddf/v320/models.rb b/lib/uddf/v320/models.rb index 3760d5d..7e99788 100644 --- a/lib/uddf/v320/models.rb +++ b/lib/uddf/v320/models.rb @@ -6,140 +6,6 @@ module UDDF module V320 module Models - class Manufacturer - include HappyMapper - - tag "manufacturer" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - end - - class Link - include HappyMapper - - tag "link" - - attribute :ref, String - end - - class Generator - include HappyMapper - - tag "generator" - - has_many :alias_names, String, tag: "aliasname" - has_one :datetime, DateTime - has_many :links, Link, tag: "link" - has_one :name, String - has_one :type, String - has_one :version, String - end - - class Notes - include HappyMapper - - tag "notes" - - has_many :paras, String, tag: "para" - has_many :links, Link, tag: "link" - end - - class Price - include HappyMapper - - tag "price" - - attribute :currency, String - content :value, Float - end - - class Tissue - include HappyMapper - - tag "tissue" - - attribute :gas, String - attribute :half_life, Float, tag: "halflife" - attribute :number, Integer - attribute :a, Float - attribute :b, Float - end - - class VPM - include HappyMapper - - tag "vpm" - - attribute :id, String - has_one :conservatism, Float - has_one :gamma, Float - has_one :gc, Float - has_one :lambda, Float - has_one :r0, Float - has_many :tissues, Tissue, tag: "tissue" - end - - class RGBM - include HappyMapper - - tag "rgbm" - - attribute :id, String - has_many :tissues, Tissue, tag: "tissue" - end - - class Buehlmann - include HappyMapper - - tag "buehlmann" - - attribute :id, String - has_one :gradient_factor_high, Float, tag: "gradientfactorhigh" - has_one :gradient_factor_low, Float, tag: "gradientfactorlow" - has_many :tissues, Tissue, tag: "tissue" - end - - class DecoModel - include HappyMapper - - tag "decomodel" - - has_many :buehlmanns, Buehlmann, tag: "buehlmann" - has_many :rgbms, RGBM, tag: "rbgm" - has_many :vpms, VPM, tag: "vpm" - end - - class Mix - include HappyMapper - - tag "mix" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ar, Float - has_one :equivalent_air_depth, Float, tag: "equivalentairdepth" - has_one :h2, Float - has_one :he, Float - has_one :maximum_operation_depth, Float, tag: "maximumoperationdepth" - has_one :maximum_po2, Float, tag: "maximumpo2" - has_one :n2, Float - has_one :name, String - has_one :o2, Float - has_one :price_per_litre, Price, tag: "priceperlitre" - end - - class GasDefinitions - include HappyMapper - - tag "gasdefinitions" - - has_many :mixes, Mix, tag: "mix" - end - class WayAltitude include HappyMapper @@ -291,26 +157,6 @@ class Waypoint has_one :temperature, Float end - class Medicine - include HappyMapper - - tag "medicine" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class MedicationBeforeDive - include HappyMapper - - tag "medicationbeforedive" - - has_many :medicines, Medicine, tag: "medicine" - end - class PlannedProfile include HappyMapper @@ -321,45 +167,25 @@ class PlannedProfile has_many :waypoints, Waypoint, tag: "waypoint" end - class Drink - include HappyMapper - - tag "drink" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class AlcoholBeforeDive - include HappyMapper - - tag "alcoholbeforedive" - - has_many :drinks, Drink, tag: "drink" - end - class InformationBeforeDive include HappyMapper tag "informationbeforedive" has_one :air_temperature, Float, tag: "airtemperature" - has_one :alcohol_before_dive, AlcoholBeforeDive, tag: "alcoholbeforedive" + has_one :alcohol_before_dive, Base::Models::AlcoholBeforeDive, tag: "alcoholbeforedive" has_one :altitude, Float has_one :apparatus, String has_one :datetime, DateTime has_one :dive_number, Integer, tag: "divenumber" has_one :dive_number_of_day, Integer, tag: "divenumberofday" has_one :internal_dive_number, Integer, tag: "internaldivenumber" - has_many :links, Link, tag: "link" - has_one :medication_before_dive, MedicationBeforeDive, tag: "medicationbeforedive" + has_many :links, Base::Models::Link, tag: "link" + has_one :medication_before_dive, Base::Models::MedicationBeforeDive, tag: "medicationbeforedive" has_one :no_suit, String, tag: "nosuit" has_one :planned_profile, PlannedProfile, tag: "plannedprofile" has_one :platform, String - has_one :price, Price + has_one :price, Base::Models::Price has_one :purpose, String has_one :state_of_rest_before_dive, String, tag: "stateofrestbeforedive" has_one :surface_interval_before_dive, SurfaceIntervalBeforeDive, tag: "surfaceintervalbeforedive" @@ -367,15 +193,6 @@ class InformationBeforeDive has_one :trip_membership, String, tag: "tripmembership" end - class Rating - include HappyMapper - - tag "rating" - - has_one :datetime, DateTime - has_one :rating_value, Integer, tag: "ratingvalue" - end - class GlobalAlarmsGiven include HappyMapper @@ -390,113 +207,7 @@ class EquipmentUsed tag "equipmentused" has_one :lead_quantity, Float, tag: "leadquantity" - has_many :links, Link, tag: "link" - end - - class AnySymptoms - include HappyMapper - - tag "anysymptoms" - - has_one :notes, Notes - end - - class Abundance - include HappyMapper - - tag "abundance" - - attribute :quality, String - attribute :occurrence, String - content :value, Integer - end - - class Species - include HappyMapper - - tag "species" - - attribute :id, String - has_one :abundance, Abundance - has_one :age, Integer - has_one :dominance, String - has_one :life_stage, String, tag: "lifestage" - has_one :notes, Notes - has_one :scientific_name, String, tag: "scientificname" - has_one :sex, String - has_one :size, Float - has_one :trivial_name, String, tag: "trivialname" - end - - class WithSpecies - include HappyMapper - - has_many :species, Species, tag: "species" - end - - class Invertebrata - include HappyMapper - - tag "invertebrata" - - has_one :ascidiacea, WithSpecies - has_one :bryozoan, WithSpecies - has_one :cnidaria, WithSpecies - has_one :coelenterata, WithSpecies - has_one :crustacea, WithSpecies - has_one :ctenophora, WithSpecies - has_one :echinodermata, WithSpecies - has_one :invertebrata_various, WithSpecies, tag: "invertebratavarious" - has_one :mollusca, WithSpecies - has_one :phoronidea, WithSpecies - has_one :plathelminthes, WithSpecies - has_one :porifera, WithSpecies - end - - class Vertebrata - include HappyMapper - - tag "vertebrata" - - has_one :amphibia, WithSpecies - has_one :chondrichthyes, WithSpecies - has_one :mammalia, WithSpecies - has_one :osteichthyes, WithSpecies - has_one :reptilia, WithSpecies - has_one :vertebrata_various, WithSpecies, tag: "vertebratavarious" - end - - class Fauna - include HappyMapper - - tag "fauna" - - has_one :invertebrata, Invertebrata - has_one :notes, Notes - has_one :vertebrata, Vertebrata - end - - class Flora - include HappyMapper - - tag "flora" - - has_one :chlorophyceae, WithSpecies - has_one :flora_various, WithSpecies, tag: "floravarious" - has_one :notes, Notes - has_one :phaeophyceae, WithSpecies - has_one :rhodophyceae, WithSpecies - has_one :spermatophyta, WithSpecies - end - - class Observations - include HappyMapper - - tag "observations" - - has_one :fauna, Fauna - has_one :flora, Flora - has_one :notes, Notes + has_many :links, Base::Models::Link, tag: "link" end class InformationAfterDive @@ -504,7 +215,7 @@ class InformationAfterDive tag "informationafterdive" - has_one :any_symptoms, AnySymptoms, tag: "anysymptoms" + has_one :any_symptoms, Base::Models::AnySymptoms, tag: "anysymptoms" has_one :average_depth, Float, tag: "averagedepth" has_one :current, String has_one :desaturation_time, Float, tag: "desaturationtime" @@ -518,12 +229,12 @@ class InformationAfterDive has_one :highest_po2, Float, tag: "highestpo2" has_one :lowest_temperature, Float, tag: "lowesttemperature" has_one :no_flight_time, Float, tag: "noflighttime" - has_one :notes, Notes - has_one :observations, Observations + has_one :notes, Base::Models::Notes + has_one :observations, Base::Models::Observations has_one :pressure_drop, Float, tag: "pressuredrop" has_many :problems, String, tag: "problems" has_one :program, String - has_many :ratings, Rating, tag: "rating" + has_many :ratings, Base::Models::Rating, tag: "rating" has_one :surface_interval_after_dive, SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive" has_one :thermal_comfort, String, tag: "thermalcomfort" has_one :visibility, Float @@ -545,33 +256,12 @@ class TankData attribute :id, String has_one :breathing_consumption_volume, Float, tag: "breathingconsumptionvolume" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :tank_pressure_begin, Float, tag: "tankpressurebegin" has_one :tank_pressure_end, Float, tag: "tankpressureend" has_one :tank_volume, Float, tag: "tankvolume" end - class Hargikas - include HappyMapper - - tag "hargikas" - - has_one :ambient, Float - has_many :tissues, Tissue, tag: "tissue" - has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel" - has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt" - has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel" - end - - class ApplicationData - include HappyMapper - - tag "applicationdata" - - has_one :deco_trainer, String, tag: "decotrainer" - has_one :hargikas, Hargikas - end - class Dive include HappyMapper @@ -580,7 +270,7 @@ class Dive attribute :id, String has_one :information_after_dive, InformationAfterDive, tag: "informationafterdive" has_one :information_before_dive, InformationBeforeDive, tag: "informationbeforedive" - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" has_one :samples, Samples has_many :tank_data, TankData, tag: "tankdata" end @@ -632,7 +322,7 @@ class InputProfile tag "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_many :waypoints, Waypoint, tag: "waypoint" end @@ -653,12 +343,12 @@ class Profile tag "profile" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :deco_model, DecoModel, tag: "decomodel" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" has_one :deep_stop_time, Float, tag: "deepstoptime" has_one :density, Float has_one :input_profile, InputProfile, tag: "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :maximum_ascending_rate, Float, tag: "maximumascendingrate" has_one :mix_change, MixChange, tag: "mixchange" has_one :output, Output @@ -729,9 +419,9 @@ class BottomTimeTable tag "bottomtimetable" attribute :id, String - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" has_one :bottom_time_table_scope, BottomTimeTableScope, tag: "bottomtimetablescope" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :output, Output has_one :title, String end @@ -754,838 +444,170 @@ class TableGeneration has_one :calculate_table, CalculateTable, tag: "calculatetable" end - class ImageData - include HappyMapper - - tag "imagedata" - - has_one :aperture, Float - has_one :datetime, DateTime - has_one :exposure_compensation, Float, tag: "exposurecompensation" - has_one :film_speed, Integer, tag: "filmspeed" - has_one :focal_length, Float, tag: "focallength" - has_one :focusing_distance, Float, tag: "focusingdistance" - has_one :metering_method, String, tag: "meteringmethod" - has_one :shutter_speed, Float, tag: "shutterspeed" - end - - class Image + class Maker include HappyMapper - tag "image" + tag "maker" - attribute :id, String - attribute :height, Integer - attribute :width, Integer - attribute :format, String - has_one :image_data, ImageData, tag: "imagedata" - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_many :manufacturers, Base::Models::Manufacturer, tag: "manufacturer" end - class Video + class Business include HappyMapper - tag "video" + tag "business" - attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_one :shop, Base::Models::Shop end - class Audio + class EquipmentPart include HappyMapper - tag "audio" + tag "equipmentpart" attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_many :alias_names, String, tag: "aliasname" + has_many :links, Base::Models::Link, tag: "link" + has_one :manufacturer, Base::Models::Manufacturer + has_one :model, String + has_one :name, String + has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase + has_one :serial_number, String, tag: "serialnumber" + has_one :service_interval, Integer, tag: "serviceinterval" end - class MediaData + class Lead < EquipmentPart include HappyMapper - tag "mediadata" + tag "lead" - has_many :audio_files, Audio, tag: "audio" - has_many :image_files, Image, tag: "image" - has_many :video_files, Video, tag: "video" + has_one :lead_quantity, Integer, tag: "leadquantity" end - class Maker + class Rebreather < EquipmentPart include HappyMapper - tag "maker" + tag "rebreather" - has_many :manufacturers, Manufacturer, tag: "manufacturer" + has_many :o2_sensors, EquipmentPart, tag: "o2sensor" end - class PriceDivePackage + class Suit < EquipmentPart include HappyMapper - tag "pricedivepackage" + tag "suit" - attribute :currency, String - attribute :no_of_dives, Integer, tag: "noofdives" - content :value, Float + has_one :suit_type, String, tag: "suittype" end - class RelatedDives + class Tank < EquipmentPart include HappyMapper - tag "relateddives" + tag "tank" - has_many :links, Link, tag: "link" + has_one :tank_material, String, tag: "tankmaterial" + has_one :tank_volume, Float, tag: "tankvolume" end - class ShipDimension + class Camera include HappyMapper - tag "shipdimension" + tag "camera" - has_one :beam, Float - has_one :displacement, Float - has_one :draught, Float - has_one :length, Float - has_one :tonnage, Float + has_one :body, EquipmentPart + has_many :flashes, EquipmentPart, tag: "flash" + has_one :housing, EquipmentPart + has_one :lens, EquipmentPart end - class Vessel + class EquipmentContent include HappyMapper - tag "vessel" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :marina, String - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" + has_many :boots, EquipmentPart, tag: "boots" + has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" + has_many :cameras, Camera, tag: "camera" + has_many :compasses, EquipmentPart, tag: "compass" + has_many :dive_computers, EquipmentPart, tag: "divecomputer" + has_many :fins, EquipmentPart, tag: "fins" + has_many :gloves, EquipmentPart, tag: "gloves" + has_many :knives, EquipmentPart, tag: "knife" + has_many :leads, Lead, tag: "lead" + has_many :lights, EquipmentPart, tag: "light" + has_many :masks, EquipmentPart, tag: "mask" + has_many :rebreathers, Rebreather, tag: "rebreather" + has_many :regulators, EquipmentPart, tag: "regulator" + has_many :scooters, EquipmentPart, tag: "scooter" + has_many :suits, Suit, tag: "suit" + has_many :tanks, Tank, tag: "tank" + has_many :various_pieces, EquipmentPart, tag: "variouspieces" + has_many :video_cameras, EquipmentPart, tag: "videocamera" + has_many :watches, EquipmentPart, tag: "watch" end - class Operator + class EquipmentConfiguration < EquipmentContent include HappyMapper - tag "operator" + tag "equipmentconfiguration" has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact + has_many :links, Base::Models::Link, tag: "link" has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_one :notes, Base::Models::Notes end - class DateOfTrip + class Equipment < EquipmentContent include HappyMapper - tag "dateoftrip" + tag "equipment" - attribute :start_date, DateTime, tag: "startdate" - attribute :end_date, DateTime, tag: "enddate" + has_many :compressors, EquipmentPart, tag: "compressor" + has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" end - class Accommodation + class BuddyOwnerShared include HappyMapper - tag "accommodation" - + attribute :id, String has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :category, String has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_one :dive_insurances, Base::Models::DiveInsurances, tag: "diveinsurances" + has_one :dive_permissions, Base::Models::DivePermissions, tag: "divepermissions" + has_one :equipment, Equipment + has_one :medical, Base::Models::Medical + has_one :notes, Base::Models::Notes + has_one :personal, Base::Models::Personal end - class Geography + class Buddy < BuddyOwnerShared include HappyMapper - tag "geography" + tag "buddy" - has_one :address, Base::Models::Address - has_one :altitude, Float - has_one :latitude, Float - has_one :location, String - has_one :longitude, Float - has_one :time_zone, Float, tag: "timezone" + attribute :id, String + has_one :certification, Base::Models::Certification + has_one :student, String end - class TripPart + class Owner < BuddyOwnerShared include HappyMapper - tag "trippart" + tag "owner" - attribute :type, String - has_one :accommodation, Accommodation - has_one :date_of_trip, DateOfTrip, tag: "dateoftrip" - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :operator, Operator - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_one :related_dives, RelatedDives, tag: "relateddives" - has_one :vessel, Vessel + attribute :id, String + has_one :education, Base::Models::Education end - class Trip + class Diver include HappyMapper - tag "trip" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_many :ratings, Rating, tag: "rating" - has_many :trip_parts, TripPart, tag: "trippart" - end - - class DiveTrip - include HappyMapper - - tag "divetrip" - - has_many :trips, Trip, tag: "trip" - end - - class Ecology - include HappyMapper - - tag "ecology" - - has_one :fauna, Fauna - has_one :flora, Flora - end - - class Built - include HappyMapper - - tag "built" - - has_one :launching_date, Base::Models::DateTimeField, tag: "launchingdate" - has_one :ship_yard, String, tag: "shipyard" - end - - class Wreck - include HappyMapper - - tag "wreck" - - has_many :alias_names, String, tag: "aliasname" - has_one :built, Built - has_one :name, String - has_one :nationality, String - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - has_one :sunk, Base::Models::DateTimeField - end - - class Shore - include HappyMapper - - tag "shore" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class River - include HappyMapper - - tag "river" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Lake - include HappyMapper - - tag "lake" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Indoor - include HappyMapper - - tag "indoor" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Cave - include HappyMapper - - tag "cave" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class SiteData - include HappyMapper - - tag "sidedata" - - has_one :area_length, Float, tag: "arealength" - has_one :area_width, Float, tag: "areawidth" - has_one :average_visibility, Float, tag: "averagevisibility" - has_one :bottom, String - has_one :cave, Cave - has_one :density, Float - has_one :difficulty, Integer - has_one :global_light_intensity, String, tag: "globallightintensity" - has_one :indoor, Indoor - has_one :maximum_depth, Float, tag: "maximumdepth" - has_one :maximum_visibility, Float, tag: "maximumvisibility" - has_one :minimum_depth, Float, tag: "minimumdepth" - has_one :minimum_visibility, Float, tag: "minimumvisibility" - has_one :river, River - has_one :shore, Shore - has_one :terrain, String - has_one :wreck, Wreck - end - - class Site - include HappyMapper - - tag "site" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ecology, Ecology - has_one :environment, String - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :side_data, SiteData, tag: "sitedata" - end - - class Guide - include HappyMapper - - tag "guide" - - has_many :links, Link, tag: "link" - end - - class DiveBase - include HappyMapper - - tag "divebase" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_many :guides, Guide, tag: "guide" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_many :ratings, Rating, tag: "rating" - end - - class DiveSite - include HappyMapper - - tag "divesite" - - has_many :dive_bases, DiveBase, tag: "divebase" - has_many :sites, Site, tag: "site" - end - - class Shop - include HappyMapper - - tag "shop" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Business - include HappyMapper - - tag "business" - - has_one :shop, Shop - end - - class Membership - include HappyMapper - - tag "membership" - - attribute :organisation, String - attribute :member_id, String, tag: "memberid" - end - - class NumberOfDives - include HappyMapper - - tag "numberofdives" - - has_one :start_date, DateTime, tag: "startdate" - has_one :end_date, DateTime, tag: "enddate" - has_one :dives, Integer - end - - class Personal - include HappyMapper - - tag "personal" - - has_one :birth_date, Base::Models::DateTimeField, tag: "birthdate" - has_one :birth_name, String, tag: "birthname" - has_one :blood_group, String, tag: "bloodgroup" - has_one :first_name, String, tag: "firstname" - has_one :height, Float - has_one :honorific, String - has_one :last_name, String, tag: "lastname" - has_one :membership, Membership - has_one :middle_name, String, tag: "middlename" - has_one :number_of_dives, NumberOfDives, tag: "numberofdives" - has_one :sex, String - has_one :smoking, String - has_one :weight, Float - end - - class Instructor - include HappyMapper - - tag "instructor" - - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Certification - include HappyMapper - - tag "certification" - - has_one :instructor, Instructor - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :level, String - has_one :link, Link - has_one :organization, String - has_one :specialty, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class Education - include HappyMapper - - tag "education" - - has_many :certifications, Certification, tag: "certification" - end - - class Insurance - include HappyMapper - - tag "insurance" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DiveInsurances - include HappyMapper - - tag "diveinsurances" - - has_many :insurances, Insurance, tag: "insurance" - end - - class Permit - include HappyMapper - - tag "permit" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :region, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DivePermissions - include HappyMapper - - tag "divepermissions" - - has_many :permits, Permit, tag: "permit" - end - - class Purchase - include HappyMapper - - tag "purchase" - - has_one :datetime, DateTime - has_one :link, Link - has_one :price, Price - has_one :shop, Shop - end - - class EquipmentPart - include HappyMapper - - tag "equipmentpart" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :manufacturer, Manufacturer - has_one :model, String - has_one :name, String - has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase - has_one :serial_number, String, tag: "serialnumber" - has_one :service_interval, Integer, tag: "serviceinterval" - end - - class Lead < EquipmentPart - include HappyMapper - - tag "lead" - - has_one :lead_quantity, Integer, tag: "leadquantity" - end - - class Rebreather < EquipmentPart - include HappyMapper - - tag "rebreather" - - has_many :o2_sensors, EquipmentPart, tag: "o2sensor" - end - - class Suit < EquipmentPart - include HappyMapper - - tag "suit" - - has_one :suit_type, String, tag: "suittype" - end - - class Tank < EquipmentPart - include HappyMapper - - tag "tank" - - has_one :tank_material, String, tag: "tankmaterial" - has_one :tank_volume, Float, tag: "tankvolume" - end - - class Camera - include HappyMapper - - tag "camera" - - has_one :body, EquipmentPart - has_many :flashes, EquipmentPart, tag: "flash" - has_one :housing, EquipmentPart - has_one :lens, EquipmentPart - end - - class EquipmentContent - include HappyMapper - - has_many :boots, EquipmentPart, tag: "boots" - has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" - has_many :cameras, Camera, tag: "camera" - has_many :compasses, EquipmentPart, tag: "compass" - has_many :dive_computers, EquipmentPart, tag: "divecomputer" - has_many :fins, EquipmentPart, tag: "fins" - has_many :gloves, EquipmentPart, tag: "gloves" - has_many :knives, EquipmentPart, tag: "knife" - has_many :leads, Lead, tag: "lead" - has_many :lights, EquipmentPart, tag: "light" - has_many :masks, EquipmentPart, tag: "mask" - has_many :rebreathers, Rebreather, tag: "rebreather" - has_many :regulators, EquipmentPart, tag: "regulator" - has_many :scooters, EquipmentPart, tag: "scooter" - has_many :suits, Suit, tag: "suit" - has_many :tanks, Tank, tag: "tank" - has_many :various_pieces, EquipmentPart, tag: "variouspieces" - has_many :video_cameras, EquipmentPart, tag: "videocamera" - has_many :watches, EquipmentPart, tag: "watch" - end - - class EquipmentConfiguration < EquipmentContent - include HappyMapper - - tag "equipmentconfiguration" - - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - end - - class Equipment < EquipmentContent - include HappyMapper - - tag "equipment" - - has_many :compressors, EquipmentPart, tag: "compressor" - has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" - end - - class Doctor - include HappyMapper - - tag "doctor" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Examination - include HappyMapper - - tag "examination" - - has_one :datetime, DateTime - has_one :doctor, Doctor - has_one :examination_result, String, tag: "examinationresult" - has_many :links, Link, tag: "link" - has_one :notes, Notes - has_one :total_lung_capacity, Float, tag: "totallungcapacity" - has_one :vital_capacity, Float, tag: "vitalcapacity" - end - - class Medical - include HappyMapper - - tag "medical" - - has_one :examination, Examination - end - - class BuddyOwnerShared - include HappyMapper - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - end - - class Buddy - include HappyMapper - - tag "buddy" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :certification, Certification - has_one :student, String - end - - class Owner - include HappyMapper - - tag "owner" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :education, Education - end - - class Diver - include HappyMapper - - tag "diver" + tag "diver" has_many :buddies, Buddy, tag: "buddy" has_one :owner, Owner end - class DCAlarm - include HappyMapper - - tag "dcalarm" - - has_one :acknowledge, String - has_one :alarm_type, Integer, tag: "alarmtype" - has_one :period, Float - end - - class SetDCDiveDepthAlarm - include HappyMapper - - tag "setdcdivedethalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :dc_alarm_depth, Float, tag: "dcalarmdepth" - end - - class SetDCDivePo2Alarm - include HappyMapper - - tag "setdcdivepo2alarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :maximum_po2, Float, tag: "maximumpo2" - end - - class SetDCDiveSiteData - include HappyMapper - - tag "setdcdivesitedata" - - attribute :dive_site, String, tag: "divesite" - end - - class SetDCDiveTimeAlarm - include HappyMapper - - tag "setdcdivetimealarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :timespan, Float - end - - class SetDCEndNDTAlarm - include HappyMapper - - tag "setdcendndtalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - end - - class SetDCDecoModel - include HappyMapper - - tag "setdcdecomodel" - - has_many :alias_names, String, tag: "aliasname" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :name, String - end - - class SetDCBuddyData - include HappyMapper - - tag "setdcbuddydata" - - attribute :buddy, String - end - - class SetDCData - include HappyMapper - - tag "setdcdata" - - has_one :set_dc_alarm_time, DateTime, tag: "setdcalarmtime" - has_one :set_dc_altitude, Float, tag: "setdcaltitude" - has_one :set_dc_buddy_data, SetDCBuddyData, tag: "setdcbuddydata" - has_one :set_dc_date_time, DateTime, tag: "setdcdatetime" - has_one :set_dc_deco_model, SetDCDecoModel, tag: "setdcdecomodel" - has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm, tag: "setdcdivedethalarm" - has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm, tag: "setdcdivepo2alarm" - has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata" - has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm, tag: "setdcdivetimealarm" - has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm, tag: "setdcendndtalarm" - has_one :set_dc_gas_definitions_data, String, tag: "setdcgasdefinitionsdata" - has_one :set_dc_owner_data, String, tag: "setdcownerdata" - has_one :set_dc_password, String, tag: "setdcpassword" - has_one :set_dc_generator_data, String, tag: "setdcgeneratordata" - end - - class GetDCData - include HappyMapper - - tag "getdcdata" - - has_one :get_dc_all_data, String, tag: "getdcalldata" - has_one :get_dc_generator_data, String, tag: "getdcgeneratordata" - has_one :get_dc_owner_data, String, tag: "getdcownerdata" - has_one :get_dc_buddy_data, String, tag: "getdcbuddydata" - has_one :get_dc_gas_definitions_data, String, tag: "getdcgasdefinitionsdata" - has_one :get_dc_dive_site_data, String, tag: "getdcdivesitedata" - has_one :get_dc_dive_trip_data, String, tag: "getdcdivetripdata" - has_one :get_dc_profile_data, String, tag: "getdcprofiledata" - end - - class DiveComputerDump - include HappyMapper - - tag "divecomputerdump" - - has_one :datetime, DateTime - has_one :dc_dump, String, tag: "dcdump" - has_one :link, Link - end - - class DiveComputerControl - include HappyMapper - - tag "divecomputercontrol" - - has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump" - has_one :get_dc_data, GetDCData, tag: "getdcdata" - has_one :set_dc_data, SetDCData, tag: "setdcdata" - end - class Uddf include HappyMapper @@ -1593,15 +615,15 @@ class Uddf attribute :version, String has_one :business, Business - has_one :deco_model, DecoModel, tag: "decomodel" - has_one :dive_computer_control, DiveComputerControl, tag: "divecomputercontrol" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" + has_one :dive_computer_control, Base::Models::DiveComputerControlV310, tag: "divecomputercontrol" has_one :diver, Diver - has_one :dive_site, DiveSite, tag: "divesite" - has_one :dive_trip, DiveTrip, tag: "divetrip" - has_one :gas_definitions, GasDefinitions, tag: "gasdefinitions" - has_one :generator, Generator + has_one :dive_site, Base::Models::DiveSite, tag: "divesite" + has_one :dive_trip, Base::Models::DiveTrip, tag: "divetrip" + has_one :gas_definitions, Base::Models::GasDefinitions, tag: "gasdefinitions" + has_one :generator, Base::Models::Generator has_one :maker, Maker - has_one :media_data, MediaData, tag: "mediadata" + has_one :media_data, Base::Models::MediaData, tag: "mediadata" has_one :profile_data, ProfileData, tag: "profiledata" has_one :table_generation, TableGeneration, tag: "tablegeneration" end diff --git a/lib/uddf/v322/models.rb b/lib/uddf/v322/models.rb index 84340bb..c715d68 100644 --- a/lib/uddf/v322/models.rb +++ b/lib/uddf/v322/models.rb @@ -6,140 +6,6 @@ module UDDF module V322 module Models - class Manufacturer - include HappyMapper - - tag "manufacturer" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - end - - class Link - include HappyMapper - - tag "link" - - attribute :ref, String - end - - class Generator - include HappyMapper - - tag "generator" - - has_many :alias_names, String, tag: "aliasname" - has_one :datetime, DateTime - has_many :links, Link, tag: "link" - has_one :name, String - has_one :type, String - has_one :version, String - end - - class Notes - include HappyMapper - - tag "notes" - - has_many :paras, String, tag: "para" - has_many :links, Link, tag: "link" - end - - class Price - include HappyMapper - - tag "price" - - attribute :currency, String - content :value, Float - end - - class Tissue - include HappyMapper - - tag "tissue" - - attribute :gas, String - attribute :half_life, Float, tag: "halflife" - attribute :number, Integer - attribute :a, Float - attribute :b, Float - end - - class VPM - include HappyMapper - - tag "vpm" - - attribute :id, String - has_one :conservatism, Float - has_one :gamma, Float - has_one :gc, Float - has_one :lambda, Float - has_one :r0, Float - has_many :tissues, Tissue, tag: "tissue" - end - - class RGBM - include HappyMapper - - tag "rgbm" - - attribute :id, String - has_many :tissues, Tissue, tag: "tissue" - end - - class Buehlmann - include HappyMapper - - tag "buehlmann" - - attribute :id, String - has_one :gradient_factor_high, Float, tag: "gradientfactorhigh" - has_one :gradient_factor_low, Float, tag: "gradientfactorlow" - has_many :tissues, Tissue, tag: "tissue" - end - - class DecoModel - include HappyMapper - - tag "decomodel" - - has_many :buehlmanns, Buehlmann, tag: "buehlmann" - has_many :rgbms, RGBM, tag: "rbgm" - has_many :vpms, VPM, tag: "vpm" - end - - class Mix - include HappyMapper - - tag "mix" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ar, Float - has_one :equivalent_air_depth, Float, tag: "equivalentairdepth" - has_one :h2, Float - has_one :he, Float - has_one :maximum_operation_depth, Float, tag: "maximumoperationdepth" - has_one :maximum_po2, Float, tag: "maximumpo2" - has_one :n2, Float - has_one :name, String - has_one :o2, Float - has_one :price_per_litre, Price, tag: "priceperlitre" - end - - class GasDefinitions - include HappyMapper - - tag "gasdefinitions" - - has_many :mixes, Mix, tag: "mix" - end - class WayAltitude include HappyMapper @@ -295,26 +161,6 @@ class Waypoint has_many :set_markers, String, tag: "setmarker" end - class Medicine - include HappyMapper - - tag "medicine" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class MedicationBeforeDive - include HappyMapper - - tag "medicationbeforedive" - - has_many :medicines, Medicine, tag: "medicine" - end - class PlannedProfile include HappyMapper @@ -325,45 +171,25 @@ class PlannedProfile has_many :waypoints, Waypoint, tag: "waypoint" end - class Drink - include HappyMapper - - tag "drink" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class AlcoholBeforeDive - include HappyMapper - - tag "alcoholbeforedive" - - has_many :drinks, Drink, tag: "drink" - end - class InformationBeforeDive include HappyMapper tag "informationbeforedive" has_one :air_temperature, Float, tag: "airtemperature" - has_one :alcohol_before_dive, AlcoholBeforeDive, tag: "alcoholbeforedive" + has_one :alcohol_before_dive, Base::Models::AlcoholBeforeDive, tag: "alcoholbeforedive" has_one :altitude, Float has_one :apparatus, String has_one :datetime, DateTime has_one :dive_number, Integer, tag: "divenumber" has_one :dive_number_of_day, Integer, tag: "divenumberofday" has_one :internal_dive_number, Integer, tag: "internaldivenumber" - has_many :links, Link, tag: "link" - has_one :medication_before_dive, MedicationBeforeDive, tag: "medicationbeforedive" + has_many :links, Base::Models::Link, tag: "link" + has_one :medication_before_dive, Base::Models::MedicationBeforeDive, tag: "medicationbeforedive" has_one :no_suit, String, tag: "nosuit" has_one :planned_profile, PlannedProfile, tag: "plannedprofile" has_one :platform, String - has_one :price, Price + has_one :price, Base::Models::Price has_one :purpose, String has_one :state_of_rest_before_dive, String, tag: "stateofrestbeforedive" has_one :surface_interval_before_dive, SurfaceIntervalBeforeDive, tag: "surfaceintervalbeforedive" @@ -371,15 +197,6 @@ class InformationBeforeDive has_one :trip_membership, String, tag: "tripmembership" end - class Rating - include HappyMapper - - tag "rating" - - has_one :datetime, DateTime - has_one :rating_value, Integer, tag: "ratingvalue" - end - class GlobalAlarmsGiven include HappyMapper @@ -394,113 +211,7 @@ class EquipmentUsed tag "equipmentused" has_one :lead_quantity, Float, tag: "leadquantity" - has_many :links, Link, tag: "link" - end - - class AnySymptoms - include HappyMapper - - tag "anysymptoms" - - has_one :notes, Notes - end - - class Abundance - include HappyMapper - - tag "abundance" - - attribute :quality, String - attribute :occurrence, String - content :value, Integer - end - - class Species - include HappyMapper - - tag "species" - - attribute :id, String - has_one :abundance, Abundance - has_one :age, Integer - has_one :dominance, String - has_one :life_stage, String, tag: "lifestage" - has_one :notes, Notes - has_one :scientific_name, String, tag: "scientificname" - has_one :sex, String - has_one :size, Float - has_one :trivial_name, String, tag: "trivialname" - end - - class WithSpecies - include HappyMapper - - has_many :species, Species, tag: "species" - end - - class Invertebrata - include HappyMapper - - tag "invertebrata" - - has_one :ascidiacea, WithSpecies - has_one :bryozoan, WithSpecies - has_one :cnidaria, WithSpecies - has_one :coelenterata, WithSpecies - has_one :crustacea, WithSpecies - has_one :ctenophora, WithSpecies - has_one :echinodermata, WithSpecies - has_one :invertebrata_various, WithSpecies, tag: "invertebratavarious" - has_one :mollusca, WithSpecies - has_one :phoronidea, WithSpecies - has_one :plathelminthes, WithSpecies - has_one :porifera, WithSpecies - end - - class Vertebrata - include HappyMapper - - tag "vertebrata" - - has_one :amphibia, WithSpecies - has_one :chondrichthyes, WithSpecies - has_one :mammalia, WithSpecies - has_one :osteichthyes, WithSpecies - has_one :reptilia, WithSpecies - has_one :vertebrata_various, WithSpecies, tag: "vertebratavarious" - end - - class Fauna - include HappyMapper - - tag "fauna" - - has_one :invertebrata, Invertebrata - has_one :notes, Notes - has_one :vertebrata, Vertebrata - end - - class Flora - include HappyMapper - - tag "flora" - - has_one :chlorophyceae, WithSpecies - has_one :flora_various, WithSpecies, tag: "floravarious" - has_one :notes, Notes - has_one :phaeophyceae, WithSpecies - has_one :rhodophyceae, WithSpecies - has_one :spermatophyta, WithSpecies - end - - class Observations - include HappyMapper - - tag "observations" - - has_one :fauna, Fauna - has_one :flora, Flora - has_one :notes, Notes + has_many :links, Base::Models::Link, tag: "link" end class InformationAfterDive @@ -508,7 +219,7 @@ class InformationAfterDive tag "informationafterdive" - has_one :any_symptoms, AnySymptoms, tag: "anysymptoms" + has_one :any_symptoms, Base::Models::AnySymptoms, tag: "anysymptoms" has_one :average_depth, Float, tag: "averagedepth" has_one :current, String has_one :desaturation_time, Float, tag: "desaturationtime" @@ -522,12 +233,12 @@ class InformationAfterDive has_one :highest_po2, Float, tag: "highestpo2" has_one :lowest_temperature, Float, tag: "lowesttemperature" has_one :no_flight_time, Float, tag: "noflighttime" - has_one :notes, Notes - has_one :observations, Observations + has_one :notes, Base::Models::Notes + has_one :observations, Base::Models::Observations has_one :pressure_drop, Float, tag: "pressuredrop" has_many :problems, String, tag: "problems" has_one :program, String - has_many :ratings, Rating, tag: "rating" + has_many :ratings, Base::Models::Rating, tag: "rating" has_one :surface_interval_after_dive, SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive" has_one :thermal_comfort, String, tag: "thermalcomfort" has_one :visibility, Float @@ -549,33 +260,12 @@ class TankData attribute :id, String has_one :breathing_consumption_volume, Float, tag: "breathingconsumptionvolume" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :tank_pressure_begin, Float, tag: "tankpressurebegin" has_one :tank_pressure_end, Float, tag: "tankpressureend" has_one :tank_volume, Float, tag: "tankvolume" end - class Hargikas - include HappyMapper - - tag "hargikas" - - has_one :ambient, Float - has_many :tissues, Tissue, tag: "tissue" - has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel" - has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt" - has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel" - end - - class ApplicationData - include HappyMapper - - tag "applicationdata" - - has_one :deco_trainer, String, tag: "decotrainer" - has_one :hargikas, Hargikas - end - class Dive include HappyMapper @@ -584,7 +274,7 @@ class Dive attribute :id, String has_one :information_after_dive, InformationAfterDive, tag: "informationafterdive" has_one :information_before_dive, InformationBeforeDive, tag: "informationbeforedive" - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" has_one :samples, Samples has_many :tank_data, TankData, tag: "tankdata" end @@ -636,7 +326,7 @@ class InputProfile tag "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_many :waypoints, Waypoint, tag: "waypoint" end @@ -657,12 +347,12 @@ class Profile tag "profile" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :deco_model, DecoModel, tag: "decomodel" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" has_one :deep_stop_time, Float, tag: "deepstoptime" has_one :density, Float has_one :input_profile, InputProfile, tag: "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :maximum_ascending_rate, Float, tag: "maximumascendingrate" has_one :mix_change, MixChange, tag: "mixchange" has_one :output, Output @@ -733,9 +423,9 @@ class BottomTimeTable tag "bottomtimetable" attribute :id, String - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" has_one :bottom_time_table_scope, BottomTimeTableScope, tag: "bottomtimetablescope" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :output, Output has_one :title, String end @@ -758,840 +448,170 @@ class TableGeneration has_one :calculate_table, CalculateTable, tag: "calculatetable" end - class ImageData - include HappyMapper - - tag "imagedata" - - has_one :aperture, Float - has_one :datetime, DateTime - has_one :exposure_compensation, Float, tag: "exposurecompensation" - has_one :film_speed, Integer, tag: "filmspeed" - has_one :focal_length, Float, tag: "focallength" - has_one :focusing_distance, Float, tag: "focusingdistance" - has_one :metering_method, String, tag: "meteringmethod" - has_one :shutter_speed, Float, tag: "shutterspeed" - end - - class Image + class Maker include HappyMapper - tag "image" + tag "maker" - attribute :id, String - attribute :height, Integer - attribute :width, Integer - attribute :format, String - has_one :image_data, ImageData, tag: "imagedata" - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_many :manufacturers, Base::Models::Manufacturer, tag: "manufacturer" end - class Video + class Business include HappyMapper - tag "video" + tag "business" - attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_one :shop, Base::Models::Shop end - class Audio + class EquipmentPart include HappyMapper - tag "audio" + tag "equipmentpart" attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_many :alias_names, String, tag: "aliasname" + has_many :links, Base::Models::Link, tag: "link" + has_one :manufacturer, Base::Models::Manufacturer + has_one :model, String + has_one :name, String + has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase + has_one :serial_number, String, tag: "serialnumber" + has_one :service_interval, Integer, tag: "serviceinterval" end - class MediaData + class Lead < EquipmentPart include HappyMapper - tag "mediadata" + tag "lead" - has_many :audio_files, Audio, tag: "audio" - has_many :image_files, Image, tag: "image" - has_many :video_files, Video, tag: "video" + has_one :lead_quantity, Integer, tag: "leadquantity" end - class Maker + class Rebreather < EquipmentPart include HappyMapper - tag "maker" + tag "rebreather" - has_many :manufacturers, Manufacturer, tag: "manufacturer" + has_many :o2_sensors, EquipmentPart, tag: "o2sensor" end - class PriceDivePackage + class Suit < EquipmentPart include HappyMapper - tag "pricedivepackage" + tag "suit" - attribute :currency, String - attribute :no_of_dives, Integer, tag: "noofdives" - content :value, Float + has_one :suit_type, String, tag: "suittype" end - class RelatedDives + class Tank < EquipmentPart include HappyMapper - tag "relateddives" + tag "tank" - has_many :links, Link, tag: "link" + has_one :tank_material, String, tag: "tankmaterial" + has_one :tank_volume, Float, tag: "tankvolume" end - class ShipDimension + class Camera include HappyMapper - tag "shipdimension" + tag "camera" - has_one :beam, Float - has_one :displacement, Float - has_one :draught, Float - has_one :length, Float - has_one :tonnage, Float + has_one :body, EquipmentPart + has_many :flashes, EquipmentPart, tag: "flash" + has_one :housing, EquipmentPart + has_one :lens, EquipmentPart end - class Vessel + class EquipmentContent include HappyMapper - tag "vessel" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :marina, String - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" + has_many :boots, EquipmentPart, tag: "boots" + has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" + has_many :cameras, Camera, tag: "camera" + has_many :compasses, EquipmentPart, tag: "compass" + has_many :dive_computers, EquipmentPart, tag: "divecomputer" + has_many :fins, EquipmentPart, tag: "fins" + has_many :gloves, EquipmentPart, tag: "gloves" + has_many :knives, EquipmentPart, tag: "knife" + has_many :leads, Lead, tag: "lead" + has_many :lights, EquipmentPart, tag: "light" + has_many :masks, EquipmentPart, tag: "mask" + has_many :rebreathers, Rebreather, tag: "rebreather" + has_many :regulators, EquipmentPart, tag: "regulator" + has_many :scooters, EquipmentPart, tag: "scooter" + has_many :suits, Suit, tag: "suit" + has_many :tanks, Tank, tag: "tank" + has_many :various_pieces, EquipmentPart, tag: "variouspieces" + has_many :video_cameras, EquipmentPart, tag: "videocamera" + has_many :watches, EquipmentPart, tag: "watch" end - class Operator + class EquipmentConfiguration < EquipmentContent include HappyMapper - tag "operator" + tag "equipmentconfiguration" has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact + has_many :links, Base::Models::Link, tag: "link" has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_one :notes, Base::Models::Notes end - class DateOfTrip + class Equipment < EquipmentContent include HappyMapper - tag "dateoftrip" + tag "equipment" - attribute :start_date, DateTime, tag: "startdate" - attribute :end_date, DateTime, tag: "enddate" + has_many :compressors, EquipmentPart, tag: "compressor" + has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" end - class Accommodation + class BuddyOwnerShared include HappyMapper - tag "accommodation" - + attribute :id, String has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :category, String has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_one :dive_insurances, Base::Models::DiveInsurances, tag: "diveinsurances" + has_one :dive_permissions, Base::Models::DivePermissions, tag: "divepermissions" + has_one :equipment, Equipment + has_one :medical, Base::Models::Medical + has_one :notes, Base::Models::Notes + has_one :personal, Base::Models::Personal end - class Geography + class Buddy < BuddyOwnerShared include HappyMapper - tag "geography" + tag "buddy" - has_one :address, Base::Models::Address - has_one :altitude, Float - has_one :latitude, Float - has_one :location, String - has_one :longitude, Float - has_one :time_zone, Float, tag: "timezone" + attribute :id, String + has_one :certification, Base::Models::CertificationV322 + has_one :student, String end - class TripPart + class Owner < BuddyOwnerShared include HappyMapper - tag "trippart" + tag "owner" - attribute :type, String - has_one :accommodation, Accommodation - has_one :date_of_trip, DateOfTrip, tag: "dateoftrip" - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :operator, Operator - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_one :related_dives, RelatedDives, tag: "relateddives" - has_one :vessel, Vessel + attribute :id, String + has_one :education, Base::Models::EducationV322 end - class Trip + class Diver include HappyMapper - tag "trip" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_many :ratings, Rating, tag: "rating" - has_many :trip_parts, TripPart, tag: "trippart" - end - - class DiveTrip - include HappyMapper - - tag "divetrip" - - has_many :trips, Trip, tag: "trip" - end - - class Ecology - include HappyMapper - - tag "ecology" - - has_one :fauna, Fauna - has_one :flora, Flora - end - - class Built - include HappyMapper - - tag "built" - - has_one :launching_date, Base::Models::DateTimeField, tag: "launchingdate" - has_one :ship_yard, String, tag: "shipyard" - end - - class Wreck - include HappyMapper - - tag "wreck" - - has_many :alias_names, String, tag: "aliasname" - has_one :built, Built - has_one :name, String - has_one :nationality, String - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - has_one :sunk, Base::Models::DateTimeField - end - - class Shore - include HappyMapper - - tag "shore" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class River - include HappyMapper - - tag "river" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Lake - include HappyMapper - - tag "lake" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Indoor - include HappyMapper - - tag "indoor" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Cave - include HappyMapper - - tag "cave" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class SiteData - include HappyMapper - - tag "sidedata" - - has_one :area_length, Float, tag: "arealength" - has_one :area_width, Float, tag: "areawidth" - has_one :average_visibility, Float, tag: "averagevisibility" - has_one :bottom, String - has_one :cave, Cave - has_one :density, Float - has_one :difficulty, Integer - has_one :global_light_intensity, String, tag: "globallightintensity" - has_one :indoor, Indoor - has_one :maximum_depth, Float, tag: "maximumdepth" - has_one :maximum_visibility, Float, tag: "maximumvisibility" - has_one :minimum_depth, Float, tag: "minimumdepth" - has_one :minimum_visibility, Float, tag: "minimumvisibility" - has_one :river, River - has_one :shore, Shore - has_one :terrain, String - has_one :wreck, Wreck - end - - class Site - include HappyMapper - - tag "site" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ecology, Ecology - has_one :environment, String - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :side_data, SiteData, tag: "sitedata" - end - - class Guide - include HappyMapper - - tag "guide" - - has_many :links, Link, tag: "link" - end - - class DiveBase - include HappyMapper - - tag "divebase" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_many :guides, Guide, tag: "guide" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_many :ratings, Rating, tag: "rating" - end - - class DiveSite - include HappyMapper - - tag "divesite" - - has_many :dive_bases, DiveBase, tag: "divebase" - has_many :sites, Site, tag: "site" - end - - class Shop - include HappyMapper - - tag "shop" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Business - include HappyMapper - - tag "business" - - has_one :shop, Shop - end - - class Membership - include HappyMapper - - tag "membership" - - attribute :organisation, String - attribute :member_id, String, tag: "memberid" - end - - class NumberOfDives - include HappyMapper - - tag "numberofdives" - - has_one :start_date, DateTime, tag: "startdate" - has_one :end_date, DateTime, tag: "enddate" - has_one :dives, Integer - end - - class Personal - include HappyMapper - - tag "personal" - - has_one :birth_date, Base::Models::DateTimeField, tag: "birthdate" - has_one :birth_name, String, tag: "birthname" - has_one :blood_group, String, tag: "bloodgroup" - has_one :first_name, String, tag: "firstname" - has_one :height, Float - has_one :honorific, String - has_one :last_name, String, tag: "lastname" - has_one :membership, Membership - has_one :middle_name, String, tag: "middlename" - has_one :number_of_dives, NumberOfDives, tag: "numberofdives" - has_one :sex, String - has_one :smoking, String - has_one :weight, Float - end - - class Instructor - include HappyMapper - - tag "instructor" - - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Certification - include HappyMapper - - tag "certification" - - has_one :instructor, Instructor - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :level, String - has_one :link, Link - has_one :organization, String - has_one :specialty, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - # Added in v3.2.2 - has_one :certificate_number, String, tag: "certificatenumber" - end - - class Education - include HappyMapper - - tag "education" - - has_many :certifications, Certification, tag: "certification" - end - - class Insurance - include HappyMapper - - tag "insurance" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DiveInsurances - include HappyMapper - - tag "diveinsurances" - - has_many :insurances, Insurance, tag: "insurance" - end - - class Permit - include HappyMapper - - tag "permit" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :region, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DivePermissions - include HappyMapper - - tag "divepermissions" - - has_many :permits, Permit, tag: "permit" - end - - class Purchase - include HappyMapper - - tag "purchase" - - has_one :datetime, DateTime - has_one :link, Link - has_one :price, Price - has_one :shop, Shop - end - - class EquipmentPart - include HappyMapper - - tag "equipmentpart" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :manufacturer, Manufacturer - has_one :model, String - has_one :name, String - has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase - has_one :serial_number, String, tag: "serialnumber" - has_one :service_interval, Integer, tag: "serviceinterval" - end - - class Lead < EquipmentPart - include HappyMapper - - tag "lead" - - has_one :lead_quantity, Integer, tag: "leadquantity" - end - - class Rebreather < EquipmentPart - include HappyMapper - - tag "rebreather" - - has_many :o2_sensors, EquipmentPart, tag: "o2sensor" - end - - class Suit < EquipmentPart - include HappyMapper - - tag "suit" - - has_one :suit_type, String, tag: "suittype" - end - - class Tank < EquipmentPart - include HappyMapper - - tag "tank" - - has_one :tank_material, String, tag: "tankmaterial" - has_one :tank_volume, Float, tag: "tankvolume" - end - - class Camera - include HappyMapper - - tag "camera" - - has_one :body, EquipmentPart - has_many :flashes, EquipmentPart, tag: "flash" - has_one :housing, EquipmentPart - has_one :lens, EquipmentPart - end - - class EquipmentContent - include HappyMapper - - has_many :boots, EquipmentPart, tag: "boots" - has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" - has_many :cameras, Camera, tag: "camera" - has_many :compasses, EquipmentPart, tag: "compass" - has_many :dive_computers, EquipmentPart, tag: "divecomputer" - has_many :fins, EquipmentPart, tag: "fins" - has_many :gloves, EquipmentPart, tag: "gloves" - has_many :knives, EquipmentPart, tag: "knife" - has_many :leads, Lead, tag: "lead" - has_many :lights, EquipmentPart, tag: "light" - has_many :masks, EquipmentPart, tag: "mask" - has_many :rebreathers, Rebreather, tag: "rebreather" - has_many :regulators, EquipmentPart, tag: "regulator" - has_many :scooters, EquipmentPart, tag: "scooter" - has_many :suits, Suit, tag: "suit" - has_many :tanks, Tank, tag: "tank" - has_many :various_pieces, EquipmentPart, tag: "variouspieces" - has_many :video_cameras, EquipmentPart, tag: "videocamera" - has_many :watches, EquipmentPart, tag: "watch" - end - - class EquipmentConfiguration < EquipmentContent - include HappyMapper - - tag "equipmentconfiguration" - - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - end - - class Equipment < EquipmentContent - include HappyMapper - - tag "equipment" - - has_many :compressors, EquipmentPart, tag: "compressor" - has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" - end - - class Doctor - include HappyMapper - - tag "doctor" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Examination - include HappyMapper - - tag "examination" - - has_one :datetime, DateTime - has_one :doctor, Doctor - has_one :examination_result, String, tag: "examinationresult" - has_many :links, Link, tag: "link" - has_one :notes, Notes - has_one :total_lung_capacity, Float, tag: "totallungcapacity" - has_one :vital_capacity, Float, tag: "vitalcapacity" - end - - class Medical - include HappyMapper - - tag "medical" - - has_one :examination, Examination - end - - class BuddyOwnerShared - include HappyMapper - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - end - - class Buddy - include HappyMapper - - tag "buddy" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :certification, Certification - has_one :student, String - end - - class Owner - include HappyMapper - - tag "owner" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :education, Education - end - - class Diver - include HappyMapper - - tag "diver" + tag "diver" has_many :buddies, Buddy, tag: "buddy" has_one :owner, Owner end - class DCAlarm - include HappyMapper - - tag "dcalarm" - - has_one :acknowledge, String - has_one :alarm_type, Integer, tag: "alarmtype" - has_one :period, Float - end - - class SetDCDiveDepthAlarm - include HappyMapper - - tag "setdcdivedethalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :dc_alarm_depth, Float, tag: "dcalarmdepth" - end - - class SetDCDivePo2Alarm - include HappyMapper - - tag "setdcdivepo2alarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :maximum_po2, Float, tag: "maximumpo2" - end - - class SetDCDiveSiteData - include HappyMapper - - tag "setdcdivesitedata" - - attribute :dive_site, String, tag: "divesite" - end - - class SetDCDiveTimeAlarm - include HappyMapper - - tag "setdcdivetimealarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :timespan, Float - end - - class SetDCEndNDTAlarm - include HappyMapper - - tag "setdcendndtalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - end - - class SetDCDecoModel - include HappyMapper - - tag "setdcdecomodel" - - has_many :alias_names, String, tag: "aliasname" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :name, String - end - - class SetDCBuddyData - include HappyMapper - - tag "setdcbuddydata" - - attribute :buddy, String - end - - class SetDCData - include HappyMapper - - tag "setdcdata" - - has_one :set_dc_alarm_time, DateTime, tag: "setdcalarmtime" - has_one :set_dc_altitude, Float, tag: "setdcaltitude" - has_one :set_dc_buddy_data, SetDCBuddyData, tag: "setdcbuddydata" - has_one :set_dc_date_time, DateTime, tag: "setdcdatetime" - has_one :set_dc_deco_model, SetDCDecoModel, tag: "setdcdecomodel" - has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm, tag: "setdcdivedethalarm" - has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm, tag: "setdcdivepo2alarm" - has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata" - has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm, tag: "setdcdivetimealarm" - has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm, tag: "setdcendndtalarm" - has_one :set_dc_gas_definitions_data, String, tag: "setdcgasdefinitionsdata" - has_one :set_dc_owner_data, String, tag: "setdcownerdata" - has_one :set_dc_password, String, tag: "setdcpassword" - has_one :set_dc_generator_data, String, tag: "setdcgeneratordata" - end - - class GetDCData - include HappyMapper - - tag "getdcdata" - - has_one :get_dc_all_data, String, tag: "getdcalldata" - has_one :get_dc_generator_data, String, tag: "getdcgeneratordata" - has_one :get_dc_owner_data, String, tag: "getdcownerdata" - has_one :get_dc_buddy_data, String, tag: "getdcbuddydata" - has_one :get_dc_gas_definitions_data, String, tag: "getdcgasdefinitionsdata" - has_one :get_dc_dive_site_data, String, tag: "getdcdivesitedata" - has_one :get_dc_dive_trip_data, String, tag: "getdcdivetripdata" - has_one :get_dc_profile_data, String, tag: "getdcprofiledata" - end - - class DiveComputerDump - include HappyMapper - - tag "divecomputerdump" - - has_one :datetime, DateTime - has_one :dc_dump, String, tag: "dcdump" - has_one :link, Link - end - - class DiveComputerControl - include HappyMapper - - tag "divecomputercontrol" - - has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump" - has_one :get_dc_data, GetDCData, tag: "getdcdata" - has_one :set_dc_data, SetDCData, tag: "setdcdata" - end - class Uddf include HappyMapper @@ -1599,15 +619,15 @@ class Uddf attribute :version, String has_one :business, Business - has_one :deco_model, DecoModel, tag: "decomodel" - has_one :dive_computer_control, DiveComputerControl, tag: "divecomputercontrol" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" + has_one :dive_computer_control, Base::Models::DiveComputerControlV310, tag: "divecomputercontrol" has_one :diver, Diver - has_one :dive_site, DiveSite, tag: "divesite" - has_one :dive_trip, DiveTrip, tag: "divetrip" - has_one :gas_definitions, GasDefinitions, tag: "gasdefinitions" - has_one :generator, Generator + has_one :dive_site, Base::Models::DiveSite, tag: "divesite" + has_one :dive_trip, Base::Models::DiveTrip, tag: "divetrip" + has_one :gas_definitions, Base::Models::GasDefinitions, tag: "gasdefinitions" + has_one :generator, Base::Models::Generator has_one :maker, Maker - has_one :media_data, MediaData, tag: "mediadata" + has_one :media_data, Base::Models::MediaData, tag: "mediadata" has_one :profile_data, ProfileData, tag: "profiledata" has_one :table_generation, TableGeneration, tag: "tablegeneration" end diff --git a/lib/uddf/v323/models.rb b/lib/uddf/v323/models.rb index 88915a0..71095a0 100644 --- a/lib/uddf/v323/models.rb +++ b/lib/uddf/v323/models.rb @@ -6,140 +6,6 @@ module UDDF module V323 module Models - class Manufacturer - include HappyMapper - - tag "manufacturer" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - end - - class Link - include HappyMapper - - tag "link" - - attribute :ref, String - end - - class Generator - include HappyMapper - - tag "generator" - - has_many :alias_names, String, tag: "aliasname" - has_one :datetime, DateTime - has_many :links, Link, tag: "link" - has_one :name, String - has_one :type, String - has_one :version, String - end - - class Notes - include HappyMapper - - tag "notes" - - has_many :paras, String, tag: "para" - has_many :links, Link, tag: "link" - end - - class Price - include HappyMapper - - tag "price" - - attribute :currency, String - content :value, Float - end - - class Tissue - include HappyMapper - - tag "tissue" - - attribute :gas, String - attribute :half_life, Float, tag: "halflife" - attribute :number, Integer - attribute :a, Float - attribute :b, Float - end - - class VPM - include HappyMapper - - tag "vpm" - - attribute :id, String - has_one :conservatism, Float - has_one :gamma, Float - has_one :gc, Float - has_one :lambda, Float - has_one :r0, Float - has_many :tissues, Tissue, tag: "tissue" - end - - class RGBM - include HappyMapper - - tag "rgbm" - - attribute :id, String - has_many :tissues, Tissue, tag: "tissue" - end - - class Buehlmann - include HappyMapper - - tag "buehlmann" - - attribute :id, String - has_one :gradient_factor_high, Float, tag: "gradientfactorhigh" - has_one :gradient_factor_low, Float, tag: "gradientfactorlow" - has_many :tissues, Tissue, tag: "tissue" - end - - class DecoModel - include HappyMapper - - tag "decomodel" - - has_many :buehlmanns, Buehlmann, tag: "buehlmann" - has_many :rgbms, RGBM, tag: "rbgm" - has_many :vpms, VPM, tag: "vpm" - end - - class Mix - include HappyMapper - - tag "mix" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ar, Float - has_one :equivalent_air_depth, Float, tag: "equivalentairdepth" - has_one :h2, Float - has_one :he, Float - has_one :maximum_operation_depth, Float, tag: "maximumoperationdepth" - has_one :maximum_po2, Float, tag: "maximumpo2" - has_one :n2, Float - has_one :name, String - has_one :o2, Float - has_one :price_per_litre, Price, tag: "priceperlitre" - end - - class GasDefinitions - include HappyMapper - - tag "gasdefinitions" - - has_many :mixes, Mix, tag: "mix" - end - class WayAltitude include HappyMapper @@ -296,26 +162,6 @@ class Waypoint has_many :set_markers, String, tag: "setmarker" end - class Medicine - include HappyMapper - - tag "medicine" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class MedicationBeforeDive - include HappyMapper - - tag "medicationbeforedive" - - has_many :medicines, Medicine, tag: "medicine" - end - class PlannedProfile include HappyMapper @@ -326,45 +172,25 @@ class PlannedProfile has_many :waypoints, Waypoint, tag: "waypoint" end - class Drink - include HappyMapper - - tag "drink" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class AlcoholBeforeDive - include HappyMapper - - tag "alcoholbeforedive" - - has_many :drinks, Drink, tag: "drink" - end - class InformationBeforeDive include HappyMapper tag "informationbeforedive" has_one :air_temperature, Float, tag: "airtemperature" - has_one :alcohol_before_dive, AlcoholBeforeDive, tag: "alcoholbeforedive" + has_one :alcohol_before_dive, Base::Models::AlcoholBeforeDive, tag: "alcoholbeforedive" has_one :altitude, Float has_one :apparatus, String has_one :datetime, DateTime has_one :dive_number, Integer, tag: "divenumber" has_one :dive_number_of_day, Integer, tag: "divenumberofday" has_one :internal_dive_number, Integer, tag: "internaldivenumber" - has_many :links, Link, tag: "link" - has_one :medication_before_dive, MedicationBeforeDive, tag: "medicationbeforedive" + has_many :links, Base::Models::Link, tag: "link" + has_one :medication_before_dive, Base::Models::MedicationBeforeDive, tag: "medicationbeforedive" has_one :no_suit, String, tag: "nosuit" has_one :planned_profile, PlannedProfile, tag: "plannedprofile" has_one :platform, String - has_one :price, Price + has_one :price, Base::Models::Price has_one :purpose, String has_one :state_of_rest_before_dive, String, tag: "stateofrestbeforedive" has_one :surface_interval_before_dive, SurfaceIntervalBeforeDive, tag: "surfaceintervalbeforedive" @@ -372,15 +198,6 @@ class InformationBeforeDive has_one :trip_membership, String, tag: "tripmembership" end - class Rating - include HappyMapper - - tag "rating" - - has_one :datetime, DateTime - has_one :rating_value, Integer, tag: "ratingvalue" - end - class GlobalAlarmsGiven include HappyMapper @@ -395,113 +212,7 @@ class EquipmentUsed tag "equipmentused" has_one :lead_quantity, Float, tag: "leadquantity" - has_many :links, Link, tag: "link" - end - - class AnySymptoms - include HappyMapper - - tag "anysymptoms" - - has_one :notes, Notes - end - - class Abundance - include HappyMapper - - tag "abundance" - - attribute :quality, String - attribute :occurrence, String - content :value, Integer - end - - class Species - include HappyMapper - - tag "species" - - attribute :id, String - has_one :abundance, Abundance - has_one :age, Integer - has_one :dominance, String - has_one :life_stage, String, tag: "lifestage" - has_one :notes, Notes - has_one :scientific_name, String, tag: "scientificname" - has_one :sex, String - has_one :size, Float - has_one :trivial_name, String, tag: "trivialname" - end - - class WithSpecies - include HappyMapper - - has_many :species, Species, tag: "species" - end - - class Invertebrata - include HappyMapper - - tag "invertebrata" - - has_one :ascidiacea, WithSpecies - has_one :bryozoan, WithSpecies - has_one :cnidaria, WithSpecies - has_one :coelenterata, WithSpecies - has_one :crustacea, WithSpecies - has_one :ctenophora, WithSpecies - has_one :echinodermata, WithSpecies - has_one :invertebrata_various, WithSpecies, tag: "invertebratavarious" - has_one :mollusca, WithSpecies - has_one :phoronidea, WithSpecies - has_one :plathelminthes, WithSpecies - has_one :porifera, WithSpecies - end - - class Vertebrata - include HappyMapper - - tag "vertebrata" - - has_one :amphibia, WithSpecies - has_one :chondrichthyes, WithSpecies - has_one :mammalia, WithSpecies - has_one :osteichthyes, WithSpecies - has_one :reptilia, WithSpecies - has_one :vertebrata_various, WithSpecies, tag: "vertebratavarious" - end - - class Fauna - include HappyMapper - - tag "fauna" - - has_one :invertebrata, Invertebrata - has_one :notes, Notes - has_one :vertebrata, Vertebrata - end - - class Flora - include HappyMapper - - tag "flora" - - has_one :chlorophyceae, WithSpecies - has_one :flora_various, WithSpecies, tag: "floravarious" - has_one :notes, Notes - has_one :phaeophyceae, WithSpecies - has_one :rhodophyceae, WithSpecies - has_one :spermatophyta, WithSpecies - end - - class Observations - include HappyMapper - - tag "observations" - - has_one :fauna, Fauna - has_one :flora, Flora - has_one :notes, Notes + has_many :links, Base::Models::Link, tag: "link" end class InformationAfterDive @@ -509,7 +220,7 @@ class InformationAfterDive tag "informationafterdive" - has_one :any_symptoms, AnySymptoms, tag: "anysymptoms" + has_one :any_symptoms, Base::Models::AnySymptoms, tag: "anysymptoms" has_one :average_depth, Float, tag: "averagedepth" has_one :current, String has_one :desaturation_time, Float, tag: "desaturationtime" @@ -523,12 +234,12 @@ class InformationAfterDive has_one :highest_po2, Float, tag: "highestpo2" has_one :lowest_temperature, Float, tag: "lowesttemperature" has_one :no_flight_time, Float, tag: "noflighttime" - has_one :notes, Notes - has_one :observations, Observations + has_one :notes, Base::Models::Notes + has_one :observations, Base::Models::Observations has_one :pressure_drop, Float, tag: "pressuredrop" has_many :problems, String, tag: "problems" has_one :program, String - has_many :ratings, Rating, tag: "rating" + has_many :ratings, Base::Models::Rating, tag: "rating" has_one :surface_interval_after_dive, SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive" has_one :thermal_comfort, String, tag: "thermalcomfort" has_one :visibility, Float @@ -550,33 +261,12 @@ class TankData attribute :id, String has_one :breathing_consumption_volume, Float, tag: "breathingconsumptionvolume" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :tank_pressure_begin, Float, tag: "tankpressurebegin" has_one :tank_pressure_end, Float, tag: "tankpressureend" has_one :tank_volume, Float, tag: "tankvolume" end - class Hargikas - include HappyMapper - - tag "hargikas" - - has_one :ambient, Float - has_many :tissues, Tissue, tag: "tissue" - has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel" - has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt" - has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel" - end - - class ApplicationData - include HappyMapper - - tag "applicationdata" - - has_one :deco_trainer, String, tag: "decotrainer" - has_one :hargikas, Hargikas - end - class Dive include HappyMapper @@ -585,7 +275,7 @@ class Dive attribute :id, String has_one :information_after_dive, InformationAfterDive, tag: "informationafterdive" has_one :information_before_dive, InformationBeforeDive, tag: "informationbeforedive" - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" has_one :samples, Samples has_many :tank_data, TankData, tag: "tankdata" end @@ -637,7 +327,7 @@ class InputProfile tag "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_many :waypoints, Waypoint, tag: "waypoint" end @@ -658,12 +348,12 @@ class Profile tag "profile" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :deco_model, DecoModel, tag: "decomodel" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" has_one :deep_stop_time, Float, tag: "deepstoptime" has_one :density, Float has_one :input_profile, InputProfile, tag: "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :maximum_ascending_rate, Float, tag: "maximumascendingrate" has_one :mix_change, MixChange, tag: "mixchange" has_one :output, Output @@ -734,9 +424,9 @@ class BottomTimeTable tag "bottomtimetable" attribute :id, String - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV310, tag: "applicationdata" has_one :bottom_time_table_scope, BottomTimeTableScope, tag: "bottomtimetablescope" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :output, Output has_one :title, String end @@ -759,840 +449,170 @@ class TableGeneration has_one :calculate_table, CalculateTable, tag: "calculatetable" end - class ImageData - include HappyMapper - - tag "imagedata" - - has_one :aperture, Float - has_one :datetime, DateTime - has_one :exposure_compensation, Float, tag: "exposurecompensation" - has_one :film_speed, Integer, tag: "filmspeed" - has_one :focal_length, Float, tag: "focallength" - has_one :focusing_distance, Float, tag: "focusingdistance" - has_one :metering_method, String, tag: "meteringmethod" - has_one :shutter_speed, Float, tag: "shutterspeed" - end - - class Image + class Maker include HappyMapper - tag "image" + tag "maker" - attribute :id, String - attribute :height, Integer - attribute :width, Integer - attribute :format, String - has_one :image_data, ImageData, tag: "imagedata" - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_many :manufacturers, Base::Models::Manufacturer, tag: "manufacturer" end - class Video + class Business include HappyMapper - tag "video" + tag "business" - attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_one :shop, Base::Models::Shop end - class Audio + class EquipmentPart include HappyMapper - tag "audio" + tag "equipmentpart" attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_many :alias_names, String, tag: "aliasname" + has_many :links, Base::Models::Link, tag: "link" + has_one :manufacturer, Base::Models::Manufacturer + has_one :model, String + has_one :name, String + has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase + has_one :serial_number, String, tag: "serialnumber" + has_one :service_interval, Integer, tag: "serviceinterval" end - class MediaData + class Lead < EquipmentPart include HappyMapper - tag "mediadata" + tag "lead" - has_many :audio_files, Audio, tag: "audio" - has_many :image_files, Image, tag: "image" - has_many :video_files, Video, tag: "video" + has_one :lead_quantity, Integer, tag: "leadquantity" end - class Maker + class Rebreather < EquipmentPart include HappyMapper - tag "maker" + tag "rebreather" - has_many :manufacturers, Manufacturer, tag: "manufacturer" + has_many :o2_sensors, EquipmentPart, tag: "o2sensor" end - class PriceDivePackage + class Suit < EquipmentPart include HappyMapper - tag "pricedivepackage" + tag "suit" - attribute :currency, String - attribute :no_of_dives, Integer, tag: "noofdives" - content :value, Float + has_one :suit_type, String, tag: "suittype" end - class RelatedDives + class Tank < EquipmentPart include HappyMapper - tag "relateddives" + tag "tank" - has_many :links, Link, tag: "link" + has_one :tank_material, String, tag: "tankmaterial" + has_one :tank_volume, Float, tag: "tankvolume" end - class ShipDimension + class Camera include HappyMapper - tag "shipdimension" + tag "camera" - has_one :beam, Float - has_one :displacement, Float - has_one :draught, Float - has_one :length, Float - has_one :tonnage, Float + has_one :body, EquipmentPart + has_many :flashes, EquipmentPart, tag: "flash" + has_one :housing, EquipmentPart + has_one :lens, EquipmentPart end - class Vessel + class EquipmentContent include HappyMapper - tag "vessel" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :marina, String - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" + has_many :boots, EquipmentPart, tag: "boots" + has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" + has_many :cameras, Camera, tag: "camera" + has_many :compasses, EquipmentPart, tag: "compass" + has_many :dive_computers, EquipmentPart, tag: "divecomputer" + has_many :fins, EquipmentPart, tag: "fins" + has_many :gloves, EquipmentPart, tag: "gloves" + has_many :knives, EquipmentPart, tag: "knife" + has_many :leads, Lead, tag: "lead" + has_many :lights, EquipmentPart, tag: "light" + has_many :masks, EquipmentPart, tag: "mask" + has_many :rebreathers, Rebreather, tag: "rebreather" + has_many :regulators, EquipmentPart, tag: "regulator" + has_many :scooters, EquipmentPart, tag: "scooter" + has_many :suits, Suit, tag: "suit" + has_many :tanks, Tank, tag: "tank" + has_many :various_pieces, EquipmentPart, tag: "variouspieces" + has_many :video_cameras, EquipmentPart, tag: "videocamera" + has_many :watches, EquipmentPart, tag: "watch" end - class Operator + class EquipmentConfiguration < EquipmentContent include HappyMapper - tag "operator" + tag "equipmentconfiguration" has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact + has_many :links, Base::Models::Link, tag: "link" has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_one :notes, Base::Models::Notes end - class DateOfTrip + class Equipment < EquipmentContent include HappyMapper - tag "dateoftrip" + tag "equipment" - attribute :start_date, DateTime, tag: "startdate" - attribute :end_date, DateTime, tag: "enddate" + has_many :compressors, EquipmentPart, tag: "compressor" + has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" end - class Accommodation + class BuddyOwnerShared include HappyMapper - tag "accommodation" - + attribute :id, String has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :category, String has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_one :dive_insurances, Base::Models::DiveInsurances, tag: "diveinsurances" + has_one :dive_permissions, Base::Models::DivePermissions, tag: "divepermissions" + has_one :equipment, Equipment + has_one :medical, Base::Models::Medical + has_one :notes, Base::Models::Notes + has_one :personal, Base::Models::Personal end - class Geography + class Buddy < BuddyOwnerShared include HappyMapper - tag "geography" + tag "buddy" - has_one :address, Base::Models::Address - has_one :altitude, Float - has_one :latitude, Float - has_one :location, String - has_one :longitude, Float - has_one :time_zone, Float, tag: "timezone" + attribute :id, String + has_one :certification, Base::Models::CertificationV322 + has_one :student, String end - class TripPart + class Owner < BuddyOwnerShared include HappyMapper - tag "trippart" + tag "owner" - attribute :type, String - has_one :accommodation, Accommodation - has_one :date_of_trip, DateOfTrip, tag: "dateoftrip" - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :operator, Operator - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_one :related_dives, RelatedDives, tag: "relateddives" - has_one :vessel, Vessel + attribute :id, String + has_one :education, Base::Models::EducationV322 end - class Trip + class Diver include HappyMapper - tag "trip" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_many :ratings, Rating, tag: "rating" - has_many :trip_parts, TripPart, tag: "trippart" - end - - class DiveTrip - include HappyMapper - - tag "divetrip" - - has_many :trips, Trip, tag: "trip" - end - - class Ecology - include HappyMapper - - tag "ecology" - - has_one :fauna, Fauna - has_one :flora, Flora - end - - class Built - include HappyMapper - - tag "built" - - has_one :launching_date, Base::Models::DateTimeField, tag: "launchingdate" - has_one :ship_yard, String, tag: "shipyard" - end - - class Wreck - include HappyMapper - - tag "wreck" - - has_many :alias_names, String, tag: "aliasname" - has_one :built, Built - has_one :name, String - has_one :nationality, String - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - has_one :sunk, Base::Models::DateTimeField - end - - class Shore - include HappyMapper - - tag "shore" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class River - include HappyMapper - - tag "river" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Lake - include HappyMapper - - tag "lake" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Indoor - include HappyMapper - - tag "indoor" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Cave - include HappyMapper - - tag "cave" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class SiteData - include HappyMapper - - tag "sidedata" - - has_one :area_length, Float, tag: "arealength" - has_one :area_width, Float, tag: "areawidth" - has_one :average_visibility, Float, tag: "averagevisibility" - has_one :bottom, String - has_one :cave, Cave - has_one :density, Float - has_one :difficulty, Integer - has_one :global_light_intensity, String, tag: "globallightintensity" - has_one :indoor, Indoor - has_one :maximum_depth, Float, tag: "maximumdepth" - has_one :maximum_visibility, Float, tag: "maximumvisibility" - has_one :minimum_depth, Float, tag: "minimumdepth" - has_one :minimum_visibility, Float, tag: "minimumvisibility" - has_one :river, River - has_one :shore, Shore - has_one :terrain, String - has_one :wreck, Wreck - end - - class Site - include HappyMapper - - tag "site" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ecology, Ecology - has_one :environment, String - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :side_data, SiteData, tag: "sitedata" - end - - class Guide - include HappyMapper - - tag "guide" - - has_many :links, Link, tag: "link" - end - - class DiveBase - include HappyMapper - - tag "divebase" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_many :guides, Guide, tag: "guide" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_many :ratings, Rating, tag: "rating" - end - - class DiveSite - include HappyMapper - - tag "divesite" - - has_many :dive_bases, DiveBase, tag: "divebase" - has_many :sites, Site, tag: "site" - end - - class Shop - include HappyMapper - - tag "shop" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Business - include HappyMapper - - tag "business" - - has_one :shop, Shop - end - - class Membership - include HappyMapper - - tag "membership" - - attribute :organisation, String - attribute :member_id, String, tag: "memberid" - end - - class NumberOfDives - include HappyMapper - - tag "numberofdives" - - has_one :start_date, DateTime, tag: "startdate" - has_one :end_date, DateTime, tag: "enddate" - has_one :dives, Integer - end - - class Personal - include HappyMapper - - tag "personal" - - has_one :birth_date, Base::Models::DateTimeField, tag: "birthdate" - has_one :birth_name, String, tag: "birthname" - has_one :blood_group, String, tag: "bloodgroup" - has_one :first_name, String, tag: "firstname" - has_one :height, Float - has_one :honorific, String - has_one :last_name, String, tag: "lastname" - has_one :membership, Membership - has_one :middle_name, String, tag: "middlename" - has_one :number_of_dives, NumberOfDives, tag: "numberofdives" - has_one :sex, String - has_one :smoking, String - has_one :weight, Float - end - - class Instructor - include HappyMapper - - tag "instructor" - - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Certification - include HappyMapper - - tag "certification" - - has_one :instructor, Instructor - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :level, String - has_one :link, Link - has_one :organization, String - has_one :specialty, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - # Added in v3.2.2 - has_one :certificate_number, String, tag: "certificatenumber" - end - - class Education - include HappyMapper - - tag "education" - - has_many :certifications, Certification, tag: "certification" - end - - class Insurance - include HappyMapper - - tag "insurance" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DiveInsurances - include HappyMapper - - tag "diveinsurances" - - has_many :insurances, Insurance, tag: "insurance" - end - - class Permit - include HappyMapper - - tag "permit" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :region, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DivePermissions - include HappyMapper - - tag "divepermissions" - - has_many :permits, Permit, tag: "permit" - end - - class Purchase - include HappyMapper - - tag "purchase" - - has_one :datetime, DateTime - has_one :link, Link - has_one :price, Price - has_one :shop, Shop - end - - class EquipmentPart - include HappyMapper - - tag "equipmentpart" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :manufacturer, Manufacturer - has_one :model, String - has_one :name, String - has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase - has_one :serial_number, String, tag: "serialnumber" - has_one :service_interval, Integer, tag: "serviceinterval" - end - - class Lead < EquipmentPart - include HappyMapper - - tag "lead" - - has_one :lead_quantity, Integer, tag: "leadquantity" - end - - class Rebreather < EquipmentPart - include HappyMapper - - tag "rebreather" - - has_many :o2_sensors, EquipmentPart, tag: "o2sensor" - end - - class Suit < EquipmentPart - include HappyMapper - - tag "suit" - - has_one :suit_type, String, tag: "suittype" - end - - class Tank < EquipmentPart - include HappyMapper - - tag "tank" - - has_one :tank_material, String, tag: "tankmaterial" - has_one :tank_volume, Float, tag: "tankvolume" - end - - class Camera - include HappyMapper - - tag "camera" - - has_one :body, EquipmentPart - has_many :flashes, EquipmentPart, tag: "flash" - has_one :housing, EquipmentPart - has_one :lens, EquipmentPart - end - - class EquipmentContent - include HappyMapper - - has_many :boots, EquipmentPart, tag: "boots" - has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" - has_many :cameras, Camera, tag: "camera" - has_many :compasses, EquipmentPart, tag: "compass" - has_many :dive_computers, EquipmentPart, tag: "divecomputer" - has_many :fins, EquipmentPart, tag: "fins" - has_many :gloves, EquipmentPart, tag: "gloves" - has_many :knives, EquipmentPart, tag: "knife" - has_many :leads, Lead, tag: "lead" - has_many :lights, EquipmentPart, tag: "light" - has_many :masks, EquipmentPart, tag: "mask" - has_many :rebreathers, Rebreather, tag: "rebreather" - has_many :regulators, EquipmentPart, tag: "regulator" - has_many :scooters, EquipmentPart, tag: "scooter" - has_many :suits, Suit, tag: "suit" - has_many :tanks, Tank, tag: "tank" - has_many :various_pieces, EquipmentPart, tag: "variouspieces" - has_many :video_cameras, EquipmentPart, tag: "videocamera" - has_many :watches, EquipmentPart, tag: "watch" - end - - class EquipmentConfiguration < EquipmentContent - include HappyMapper - - tag "equipmentconfiguration" - - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - end - - class Equipment < EquipmentContent - include HappyMapper - - tag "equipment" - - has_many :compressors, EquipmentPart, tag: "compressor" - has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" - end - - class Doctor - include HappyMapper - - tag "doctor" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Examination - include HappyMapper - - tag "examination" - - has_one :datetime, DateTime - has_one :doctor, Doctor - has_one :examination_result, String, tag: "examinationresult" - has_many :links, Link, tag: "link" - has_one :notes, Notes - has_one :total_lung_capacity, Float, tag: "totallungcapacity" - has_one :vital_capacity, Float, tag: "vitalcapacity" - end - - class Medical - include HappyMapper - - tag "medical" - - has_one :examination, Examination - end - - class BuddyOwnerShared - include HappyMapper - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - end - - class Buddy - include HappyMapper - - tag "buddy" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :certification, Certification - has_one :student, String - end - - class Owner - include HappyMapper - - tag "owner" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" - has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal - has_one :education, Education - end - - class Diver - include HappyMapper - - tag "diver" + tag "diver" has_many :buddies, Buddy, tag: "buddy" has_one :owner, Owner end - class DCAlarm - include HappyMapper - - tag "dcalarm" - - has_one :acknowledge, String - has_one :alarm_type, Integer, tag: "alarmtype" - has_one :period, Float - end - - class SetDCDiveDepthAlarm - include HappyMapper - - tag "setdcdivedethalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :dc_alarm_depth, Float, tag: "dcalarmdepth" - end - - class SetDCDivePo2Alarm - include HappyMapper - - tag "setdcdivepo2alarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :maximum_po2, Float, tag: "maximumpo2" - end - - class SetDCDiveSiteData - include HappyMapper - - tag "setdcdivesitedata" - - attribute :dive_site, String, tag: "divesite" - end - - class SetDCDiveTimeAlarm - include HappyMapper - - tag "setdcdivetimealarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - has_one :timespan, Float - end - - class SetDCEndNDTAlarm - include HappyMapper - - tag "setdcendndtalarm" - - has_one :dc_alarm, DCAlarm, tag: "dcalarm" - end - - class SetDCDecoModel - include HappyMapper - - tag "setdcdecomodel" - - has_many :alias_names, String, tag: "aliasname" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :name, String - end - - class SetDCBuddyData - include HappyMapper - - tag "setdcbuddydata" - - attribute :buddy, String - end - - class SetDCData - include HappyMapper - - tag "setdcdata" - - has_one :set_dc_alarm_time, DateTime, tag: "setdcalarmtime" - has_one :set_dc_altitude, Float, tag: "setdcaltitude" - has_one :set_dc_buddy_data, SetDCBuddyData, tag: "setdcbuddydata" - has_one :set_dc_date_time, DateTime, tag: "setdcdatetime" - has_one :set_dc_deco_model, SetDCDecoModel, tag: "setdcdecomodel" - has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm, tag: "setdcdivedethalarm" - has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm, tag: "setdcdivepo2alarm" - has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata" - has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm, tag: "setdcdivetimealarm" - has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm, tag: "setdcendndtalarm" - has_one :set_dc_gas_definitions_data, String, tag: "setdcgasdefinitionsdata" - has_one :set_dc_owner_data, String, tag: "setdcownerdata" - has_one :set_dc_password, String, tag: "setdcpassword" - has_one :set_dc_generator_data, String, tag: "setdcgeneratordata" - end - - class GetDCData - include HappyMapper - - tag "getdcdata" - - has_one :get_dc_all_data, String, tag: "getdcalldata" - has_one :get_dc_generator_data, String, tag: "getdcgeneratordata" - has_one :get_dc_owner_data, String, tag: "getdcownerdata" - has_one :get_dc_buddy_data, String, tag: "getdcbuddydata" - has_one :get_dc_gas_definitions_data, String, tag: "getdcgasdefinitionsdata" - has_one :get_dc_dive_site_data, String, tag: "getdcdivesitedata" - has_one :get_dc_dive_trip_data, String, tag: "getdcdivetripdata" - has_one :get_dc_profile_data, String, tag: "getdcprofiledata" - end - - class DiveComputerDump - include HappyMapper - - tag "divecomputerdump" - - has_one :datetime, DateTime - has_one :dc_dump, String, tag: "dcdump" - has_one :link, Link - end - - class DiveComputerControl - include HappyMapper - - tag "divecomputercontrol" - - has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump" - has_one :get_dc_data, GetDCData, tag: "getdcdata" - has_one :set_dc_data, SetDCData, tag: "setdcdata" - end - class Uddf include HappyMapper @@ -1600,15 +620,15 @@ class Uddf attribute :version, String has_one :business, Business - has_one :deco_model, DecoModel, tag: "decomodel" - has_one :dive_computer_control, DiveComputerControl, tag: "divecomputercontrol" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" + has_one :dive_computer_control, Base::Models::DiveComputerControlV310, tag: "divecomputercontrol" has_one :diver, Diver - has_one :dive_site, DiveSite, tag: "divesite" - has_one :dive_trip, DiveTrip, tag: "divetrip" - has_one :gas_definitions, GasDefinitions, tag: "gasdefinitions" - has_one :generator, Generator + has_one :dive_site, Base::Models::DiveSite, tag: "divesite" + has_one :dive_trip, Base::Models::DiveTrip, tag: "divetrip" + has_one :gas_definitions, Base::Models::GasDefinitions, tag: "gasdefinitions" + has_one :generator, Base::Models::Generator has_one :maker, Maker - has_one :media_data, MediaData, tag: "mediadata" + has_one :media_data, Base::Models::MediaData, tag: "mediadata" has_one :profile_data, ProfileData, tag: "profiledata" has_one :table_generation, TableGeneration, tag: "tablegeneration" end diff --git a/lib/uddf/v330/models.rb b/lib/uddf/v330/models.rb index bedb2d5..679cd4a 100644 --- a/lib/uddf/v330/models.rb +++ b/lib/uddf/v330/models.rb @@ -61,140 +61,6 @@ class Scrubber content :value, Float end - class Manufacturer - include HappyMapper - - tag "manufacturer" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - end - - class Link - include HappyMapper - - tag "link" - - attribute :ref, String - end - - class Generator - include HappyMapper - - tag "generator" - - has_many :alias_names, String, tag: "aliasname" - has_one :datetime, DateTime - has_many :links, Link, tag: "link" - has_one :name, String - has_one :type, String - has_one :version, String - end - - class Notes - include HappyMapper - - tag "notes" - - has_many :paras, String, tag: "para" - has_many :links, Link, tag: "link" - end - - class Price - include HappyMapper - - tag "price" - - attribute :currency, String - content :value, Float - end - - class Tissue - include HappyMapper - - tag "tissue" - - attribute :gas, String - attribute :half_life, Float - attribute :number, Integer - attribute :a, Float - attribute :b, Float - end - - class VPM - include HappyMapper - - tag "vpm" - - attribute :id, String - has_one :conservatism, Float - has_one :gamma, Float - has_one :gc, Float - has_one :lambda, Float - has_one :r0, Float - has_many :tissues, Tissue, tag: "tissue" - end - - class RGBM - include HappyMapper - - tag "rgbm" - - attribute :id, String - has_many :tissues, Tissue, tag: "tissue" - end - - class Buehlmann - include HappyMapper - - tag "buehlmann" - - attribute :id, String - has_one :gradient_factor_high, Float, tag: "gradientfactorhigh" - has_one :gradient_factor_low, Float, tag: "gradientfactorlow" - has_many :tissues, Tissue, tag: "tissue" - end - - class DecoModel - include HappyMapper - - tag "decomodel" - - has_many :buehlmanns, Buehlmann, tag: "buehlmann" - has_many :rgbms, RGBM, tag: "rbgm" - has_many :vpms, VPM, tag: "vpm" - end - - class Mix - include HappyMapper - - tag "mix" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ar, Float - has_one :equivalent_air_depth, Float, tag: "equivalentairdepth" - has_one :h2, Float - has_one :he, Float - has_one :maximum_operation_depth, Float, tag: "maximumoperationdepth" - has_one :maximum_po2, Float, tag: "maximumpo2" - has_one :n2, Float - has_one :name, String - has_one :o2, Float - has_one :price_per_litre, Price, tag: "priceperlitre" - end - - class GasDefinitions - include HappyMapper - - tag "gasdefinitions" - - has_many :mixes, Mix, tag: "mix" - end - class WayAltitude include HappyMapper @@ -393,26 +259,6 @@ class Waypoint has_many :set_markers, String, tag: "setmarker" end - class Medicine - include HappyMapper - - tag "medicine" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class MedicationBeforeDive - include HappyMapper - - tag "medicationbeforedive" - - has_many :medicines, Medicine, tag: "medicine" - end - class PlannedProfile include HappyMapper @@ -423,33 +269,13 @@ class PlannedProfile has_many :waypoints, Waypoint, tag: "waypoint" end - class Drink - include HappyMapper - - tag "drink" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class AlcoholBeforeDive - include HappyMapper - - tag "alcoholbeforedive" - - has_many :drinks, Drink, tag: "drink" - end - class InformationBeforeDive include HappyMapper tag "informationbeforedive" has_one :air_temperature, Float, tag: "airtemperature" - has_one :alcohol_before_dive, AlcoholBeforeDive, tag: "alcoholbeforedive" + has_one :alcohol_before_dive, Base::Models::AlcoholBeforeDive, tag: "alcoholbeforedive" has_one :altitude, Float has_one :apparatus, String has_one :datetime, DateTime @@ -457,12 +283,12 @@ class InformationBeforeDive has_one :dive_number, Integer, tag: "divenumber" has_one :dive_number_of_day, Integer, tag: "divenumberofday" has_one :internal_dive_number, Integer, tag: "internaldivenumber" - has_many :links, Link, tag: "link" - has_one :medication_before_dive, MedicationBeforeDive, tag: "medicationbeforedive" + has_many :links, Base::Models::Link, tag: "link" + has_one :medication_before_dive, Base::Models::MedicationBeforeDive, tag: "medicationbeforedive" has_one :no_suit, String, tag: "nosuit" has_one :planned_profile, PlannedProfile, tag: "plannedprofile" has_one :platform, String - has_one :price, Price + has_one :price, Base::Models::Price has_one :purpose, String has_many :rebreather_self_tests, RebreatherSelfTest, tag: "rebreatherselftest" has_one :state_of_rest_before_dive, String, tag: "stateofrestbeforedive" @@ -473,15 +299,6 @@ class InformationBeforeDive has_many :timers, Timer, tag: "timer" end - class Rating - include HappyMapper - - tag "rating" - - has_one :datetime, DateTime - has_one :rating_value, Integer, tag: "ratingvalue" - end - class GlobalAlarmsGiven include HappyMapper @@ -496,113 +313,7 @@ class EquipmentUsed tag "equipmentused" has_one :lead_quantity, Float, tag: "leadquantity" - has_many :links, Link, tag: "link" - end - - class AnySymptoms - include HappyMapper - - tag "anysymptoms" - - has_one :notes, Notes - end - - class Abundance - include HappyMapper - - tag "abundance" - - attribute :quality, String - attribute :occurrence, String - content :value, Integer - end - - class Species - include HappyMapper - - tag "species" - - attribute :id, String - has_one :abundance, Abundance - has_one :age, Integer - has_one :dominance, String - has_one :life_stage, String, tag: "lifestage" - has_one :notes, Notes - has_one :scientific_name, String, tag: "scientificname" - has_one :sex, String - has_one :size, Float - has_one :trivial_name, String, tag: "trivialname" - end - - class WithSpecies - include HappyMapper - - has_many :species, Species, tag: "species" - end - - class Invertebrata - include HappyMapper - - tag "invertebrata" - - has_one :ascidiacea, WithSpecies - has_one :bryozoan, WithSpecies - has_one :cnidaria, WithSpecies - has_one :coelenterata, WithSpecies - has_one :crustacea, WithSpecies - has_one :ctenophora, WithSpecies - has_one :echinodermata, WithSpecies - has_one :invertebrata_various, WithSpecies, tag: "invertebratavarious" - has_one :mollusca, WithSpecies - has_one :phoronidea, WithSpecies - has_one :plathelminthes, WithSpecies - has_one :porifera, WithSpecies - end - - class Vertebrata - include HappyMapper - - tag "vertebrata" - - has_one :amphibia, WithSpecies - has_one :chondrichthyes, WithSpecies - has_one :mammalia, WithSpecies - has_one :osteichthyes, WithSpecies - has_one :reptilia, WithSpecies - has_one :vertebrata_various, WithSpecies, tag: "vertebratavarious" - end - - class Fauna - include HappyMapper - - tag "fauna" - - has_one :invertebrata, Invertebrata - has_one :notes, Notes - has_one :vertebrata, Vertebrata - end - - class Flora - include HappyMapper - - tag "flora" - - has_one :chlorophyceae, WithSpecies - has_one :flora_various, WithSpecies, tag: "floravarious" - has_one :notes, Notes - has_one :phaeophyceae, WithSpecies - has_one :rhodophyceae, WithSpecies - has_one :spermatophyta, WithSpecies - end - - class Observations - include HappyMapper - - tag "observations" - - has_one :fauna, Fauna - has_one :flora, Flora - has_one :notes, Notes + has_many :links, Base::Models::Link, tag: "link" end class InformationAfterDive @@ -610,7 +321,7 @@ class InformationAfterDive tag "informationafterdive" - has_one :any_symptoms, AnySymptoms, tag: "anysymptoms" + has_one :any_symptoms, Base::Models::AnySymptoms, tag: "anysymptoms" has_one :average_depth, Float, tag: "averagedepth" has_one :current, String has_one :desaturation_time, Float, tag: "desaturationtime" @@ -624,12 +335,12 @@ class InformationAfterDive has_one :highest_po2, Float, tag: "highestpo2" has_one :lowest_temperature, Float, tag: "lowesttemperature" has_one :no_flight_time, Float, tag: "noflighttime" - has_one :notes, Notes - has_one :observations, Observations + has_one :notes, Base::Models::Notes + has_one :observations, Base::Models::Observations has_one :pressure_drop, Float, tag: "pressuredrop" has_many :problems, String, tag: "problems" has_one :program, String - has_many :ratings, Rating, tag: "rating" + has_many :ratings, Base::Models::Rating, tag: "rating" has_one :surface_interval_after_dive, SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive" has_one :thermal_comfort, String, tag: "thermalcomfort" has_many :timers, Timer, tag: "timer" @@ -655,35 +366,12 @@ class TankData has_one :analysed_he, Float, tag: "analysedhe" has_one :analysed_o2, Float, tag: "analysedo2" has_one :breathing_consumption_volume, Float, tag: "breathingconsumptionvolume" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :tank_pressure_begin, Float, tag: "tankpressurebegin" has_one :tank_pressure_end, Float, tag: "tankpressureend" has_one :tank_volume, Float, tag: "tankvolume" end - class Hargikas - include HappyMapper - - tag "hargikas" - - has_one :ambient, Float - has_many :tissues, Tissue, tag: "tissue" - has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel" - has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt" - has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel" - end - - class ApplicationData - include HappyMapper - - tag "applicationdata" - - has_one :deco_trainer, String, tag: "decotrainer" - has_one :hargikas, Hargikas - has_one :apdiving, String - has_one :ratio, String - end - class Dive include HappyMapper @@ -692,7 +380,7 @@ class Dive attribute :id, String has_one :information_after_dive, InformationAfterDive, tag: "informationafterdive" has_one :information_before_dive, InformationBeforeDive, tag: "informationbeforedive" - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV330, tag: "applicationdata" has_one :samples, Samples has_many :tank_data, TankData, tag: "tankdata" end @@ -744,7 +432,7 @@ class InputProfile tag "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_many :waypoints, Waypoint, tag: "waypoint" end @@ -765,12 +453,12 @@ class Profile tag "profile" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :deco_model, DecoModel, tag: "decomodel" + has_one :application_data, Base::Models::ApplicationDataV330, tag: "applicationdata" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" has_one :deep_stops, DeepStops, tag: "deepstops" has_one :density, Float has_one :input_profile, InputProfile, tag: "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :maximum_ascending_rate, Float, tag: "maximumascendingrate" has_one :mix_change, MixChange, tag: "mixchange" has_one :output, Output @@ -842,9 +530,9 @@ class BottomTimeTable tag "bottomtimetable" attribute :id, String - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV330, tag: "applicationdata" has_one :bottom_time_table_scope, BottomTimeTableScope, tag: "bottomtimetablescope" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :output, Output has_one :title, String end @@ -867,707 +555,180 @@ class TableGeneration has_one :calculate_table, CalculateTable, tag: "calculatetable" end - class ImageData + class Maker include HappyMapper - tag "imagedata" + tag "maker" - has_one :aperture, Float - has_one :datetime, DateTime - has_one :exposure_compensation, Float, tag: "exposurecompensation" - has_one :film_speed, Integer, tag: "filmspeed" - has_one :focal_length, Float, tag: "focallength" - has_one :focusing_distance, Float, tag: "focusingdistance" - has_one :metering_method, String, tag: "meteringmethod" - has_one :shutter_speed, Float, tag: "shutterspeed" + has_many :manufacturers, Base::Models::Manufacturer, tag: "manufacturer" end - class Image + class Business include HappyMapper - tag "image" + tag "business" - attribute :id, String - attribute :height, Integer - attribute :width, Integer - attribute :format, String - has_one :image_data, ImageData, tag: "imagedata" - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_one :shop, Base::Models::Shop end - class Video + class TemperatureSensor include HappyMapper - tag "video" + tag "temperaturesensor" attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + + has_many :alias_names, String, tag: "aliasname" + has_one :manufacturer, Base::Models::Manufacturer + has_one :model, String + has_one :name, String + has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase + has_one :serial_number, String, tag: "serialnumber" + has_one :service_interval, Integer, tag: "serviceinterval" end - class Audio + class TimerDevice include HappyMapper - tag "audio" + tag "timerdevice" attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String end - class MediaData + class EquipmentPart include HappyMapper - tag "mediadata" + tag "equipmentpart" - has_many :audio_files, Audio, tag: "audio" - has_many :image_files, Image, tag: "image" - has_many :video_files, Video, tag: "video" + attribute :id, String + has_many :alias_names, String, tag: "aliasname" + has_many :links, Base::Models::Link, tag: "link" + has_one :manufacturer, Base::Models::Manufacturer + has_one :model, String + has_one :name, String + has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase + has_one :serial_number, String, tag: "serialnumber" + has_one :service_interval, Integer, tag: "serviceinterval" end - class Maker + class Lead < EquipmentPart include HappyMapper - tag "maker" + tag "lead" - has_many :manufacturers, Manufacturer, tag: "manufacturer" + has_one :lead_quantity, Integer, tag: "leadquantity" end - class PriceDivePackage + class Rebreather < EquipmentPart include HappyMapper - tag "pricedivepackage" + tag "rebreather" - attribute :currency, String - attribute :no_of_dives, Integer - content :value, Float + has_many :batteries, Battery, tag: "battery" + has_many :o2_sensors, EquipmentPart, tag: "o2sensor" + has_many :scrubber_monitors, ScrubberMonitor, tag: "scrubbermonitor" + has_many :temperature_sensors, TemperatureSensor, tag: "temperaturesensor" + has_many :timer_devices, TimerDevice, tag: "timerdevice" end - class RelatedDives + class Suit < EquipmentPart include HappyMapper - tag "relateddives" + tag "suit" - has_many :links, Link, tag: "link" + has_one :suit_type, String, tag: "suittype" end - class ShipDimension + class Tank < EquipmentPart include HappyMapper - tag "shipdimension" + tag "tank" - has_one :beam, Float - has_one :displacement, Float - has_one :draught, Float - has_one :length, Float - has_one :tonnage, Float + has_one :tank_material, String, tag: "tankmaterial" + has_one :tank_volume, Float, tag: "tankvolume" + has_many :batteries, Battery, tag: "battery" end - class Vessel + class Camera include HappyMapper - tag "vessel" + tag "camera" - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :marina, String - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" + has_one :body, EquipmentPart + has_many :flashes, EquipmentPart, tag: "flash" + has_one :housing, EquipmentPart + has_one :lens, EquipmentPart end - class Operator + class DiveComputer < EquipmentPart include HappyMapper - tag "operator" + tag "divecomputer" - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_many :batteries, Battery, tag: "battery" + has_many :timer_devices, TimerDevice, tag: "timerdevice" end - class DateOfTrip + class EquipmentContent include HappyMapper - tag "dateoftrip" - - attribute :start_date, DateTime - attribute :end_date, DateTime + has_many :boots, EquipmentPart, tag: "boots" + has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" + has_many :cameras, Camera, tag: "camera" + has_many :compasses, EquipmentPart, tag: "compass" + has_many :dive_computers, DiveComputer, tag: "divecomputer" + has_many :fins, EquipmentPart, tag: "fins" + has_many :gloves, EquipmentPart, tag: "gloves" + has_many :knives, EquipmentPart, tag: "knife" + has_many :leads, Lead, tag: "lead" + has_many :lights, EquipmentPart, tag: "light" + has_many :masks, EquipmentPart, tag: "mask" + has_many :rebreathers, Rebreather, tag: "rebreather" + has_many :regulators, EquipmentPart, tag: "regulator" + has_many :scooters, EquipmentPart, tag: "scooter" + has_many :suits, Suit, tag: "suit" + has_many :tanks, Tank, tag: "tank" + has_many :various_pieces, EquipmentPart, tag: "variouspieces" + has_many :video_cameras, EquipmentPart, tag: "videocamera" + has_many :watches, EquipmentPart, tag: "watch" end - class Accommodation + class EquipmentConfiguration < EquipmentContent include HappyMapper - tag "accommodation" + tag "equipmentconfiguration" - has_one :address, Base::Models::Address has_many :alias_names, String, tag: "aliasname" - has_one :category, String - has_one :contact, Base::Models::Contact + has_many :links, Base::Models::Link, tag: "link" has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_one :notes, Base::Models::Notes end - class Geography + class Equipment < EquipmentContent include HappyMapper - tag "geography" - - has_one :address, Base::Models::Address - has_one :altitude, Float - has_one :latitude, Float - has_one :location, String - has_one :longitude, Float - has_one :time_zone, Float, tag: "timezone" - end - - class TripPart - include HappyMapper - - tag "trippart" - - attribute :type, String - has_one :accommodation, Accommodation - has_one :date_of_trip, DateOfTrip, tag: "dateoftrip" - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :operator, Operator - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_one :related_dives, RelatedDives, tag: "relateddives" - has_one :vessel, Vessel - end - - class Trip - include HappyMapper - - tag "trip" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_many :ratings, Rating, tag: "rating" - has_many :trip_parts, TripPart, tag: "trippart" - end - - class DiveTrip - include HappyMapper - - tag "divetrip" - - has_many :trips, Trip, tag: "trip" - end - - class Ecology - include HappyMapper - - tag "ecology" - - has_one :fauna, Fauna - has_one :flora, Flora - end - - class Built - include HappyMapper - - tag "built" - - has_one :launching_date, Base::Models::DateTimeField, tag: "launchingdate" - has_one :ship_yard, String, tag: "shipyard" - end - - class Wreck - include HappyMapper - - tag "wreck" - - has_many :alias_names, String, tag: "aliasname" - has_one :built, Built - has_one :name, String - has_one :nationality, String - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - has_one :sunk, Base::Models::DateTimeField - end - - class Shore - include HappyMapper - - tag "shore" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class River - include HappyMapper - - tag "river" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Lake - include HappyMapper - - tag "lake" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Indoor - include HappyMapper - - tag "indoor" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Cave - include HappyMapper - - tag "cave" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class SiteData - include HappyMapper - - tag "sidedata" - - has_one :area_length, Float, tag: "arealength" - has_one :area_width, Float, tag: "areawidth" - has_one :average_visibility, Float, tag: "averagevisibility" - has_one :bottom, String - has_one :cave, Cave - has_one :density, Float - has_one :difficulty, Integer - has_one :global_light_intensity, String, tag: "globallightintensity" - has_one :indoor, Indoor - has_one :maximum_depth, Float, tag: "maximumdepth" - has_one :maximum_visibility, Float, tag: "maximumvisibility" - has_one :minimum_depth, Float, tag: "minimumdepth" - has_one :minimum_visibility, Float, tag: "minimumvisibility" - has_one :river, River - has_one :shore, Shore - has_one :terrain, String - has_one :wreck, Wreck - end - - class Site - include HappyMapper - - tag "site" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ecology, Ecology - has_one :environment, String - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :side_data, SiteData, tag: "sitedata" - end - - class Guide - include HappyMapper - - tag "guide" - - has_many :links, Link, tag: "link" - end - - class DiveBase - include HappyMapper - - tag "divebase" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_many :guides, Guide, tag: "guide" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_many :ratings, Rating, tag: "rating" - end - - class DiveSite - include HappyMapper - - tag "divesite" - - has_many :dive_bases, DiveBase, tag: "divebase" - has_many :sites, Site, tag: "site" - end - - class Shop - include HappyMapper - - tag "shop" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Business - include HappyMapper - - tag "business" - - has_one :shop, Shop - end - - class Membership - include HappyMapper - - tag "membership" - - attribute :organisation, String - attribute :member_id, String - end - - class NumberOfDives - include HappyMapper - - tag "numberofdives" - - has_one :start_date, DateTime, tag: "startdate" - has_one :end_date, DateTime, tag: "enddate" - has_one :dives, Integer - end - - class Personal - include HappyMapper - - tag "personal" - - has_one :birth_date, Base::Models::DateTimeField, tag: "birthdate" - has_one :birth_name, String, tag: "birthname" - has_one :blood_group, String, tag: "bloodgroup" - has_one :first_name, String, tag: "firstname" - has_one :height, Float - has_one :honorific, String - has_one :last_name, String, tag: "lastname" - has_one :membership, Membership - has_one :middle_name, String, tag: "middlename" - has_one :number_of_dives, NumberOfDives, tag: "numberofdives" - has_one :sex, String - has_one :smoking, String - has_one :weight, Float - end - - class Instructor - include HappyMapper - - tag "instructor" - - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Certification - include HappyMapper - - tag "certification" - - has_one :instructor, Instructor - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :level, String - has_one :link, Link - has_one :organization, String - has_one :specialty, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - # Added in v3.2.2 - has_one :certificate_number, String, tag: "certificatenumber" - end - - class Education - include HappyMapper - - tag "education" - - has_many :certifications, Certification, tag: "certification" - end - - class Insurance - include HappyMapper - - tag "insurance" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DiveInsurances - include HappyMapper - - tag "diveinsurances" - - has_many :insurances, Insurance, tag: "insurance" - end - - class Permit - include HappyMapper - - tag "permit" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :region, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DivePermissions - include HappyMapper - - tag "divepermissions" - - has_many :permits, Permit, tag: "permit" - end - - class Purchase - include HappyMapper - - tag "purchase" - - has_one :datetime, DateTime - has_one :link, Link - has_one :price, Price - has_one :shop, Shop - end - - class TemperatureSensor - include HappyMapper - - tag "temperaturesensor" - - attribute :id, String - - has_many :alias_names, String, tag: "aliasname" - has_one :manufacturer, Manufacturer - has_one :model, String - has_one :name, String - has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase - has_one :serial_number, String, tag: "serialnumber" - has_one :service_interval, Integer, tag: "serviceinterval" - end - - class TimerDevice - include HappyMapper - - tag "timerdevice" - - attribute :id, String - end - - class EquipmentPart - include HappyMapper - - tag "equipmentpart" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :manufacturer, Manufacturer - has_one :model, String - has_one :name, String - has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase - has_one :serial_number, String, tag: "serialnumber" - has_one :service_interval, Integer, tag: "serviceinterval" - end - - class Lead < EquipmentPart - include HappyMapper - - tag "lead" - - has_one :lead_quantity, Integer, tag: "leadquantity" - end - - class Rebreather < EquipmentPart - include HappyMapper - - tag "rebreather" - - has_many :batteries, Battery, tag: "battery" - has_many :o2_sensors, EquipmentPart, tag: "o2sensor" - has_many :scrubber_monitors, ScrubberMonitor, tag: "scrubbermonitor" - has_many :temperature_sensors, TemperatureSensor, tag: "temperaturesensor" - has_many :timer_devices, TimerDevice, tag: "timerdevice" - end - - class Suit < EquipmentPart - include HappyMapper - - tag "suit" - - has_one :suit_type, String, tag: "suittype" - end - - class Tank < EquipmentPart - include HappyMapper - - tag "tank" - - has_one :tank_material, String, tag: "tankmaterial" - has_one :tank_volume, Float, tag: "tankvolume" - has_many :batteries, Battery, tag: "battery" - end - - class Camera - include HappyMapper - - tag "camera" - - has_one :body, EquipmentPart - has_many :flashes, EquipmentPart, tag: "flash" - has_one :housing, EquipmentPart - has_one :lens, EquipmentPart - end - - class DiveComputer < EquipmentPart - include HappyMapper - - tag "divecomputer" - - has_many :batteries, Battery, tag: "battery" - has_many :timer_devices, TimerDevice, tag: "timerdevice" - end - - class EquipmentContent - include HappyMapper - - has_many :boots, EquipmentPart, tag: "boots" - has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" - has_many :cameras, Camera, tag: "camera" - has_many :compasses, EquipmentPart, tag: "compass" - has_many :dive_computers, DiveComputer, tag: "divecomputer" - has_many :fins, EquipmentPart, tag: "fins" - has_many :gloves, EquipmentPart, tag: "gloves" - has_many :knives, EquipmentPart, tag: "knife" - has_many :leads, Lead, tag: "lead" - has_many :lights, EquipmentPart, tag: "light" - has_many :masks, EquipmentPart, tag: "mask" - has_many :rebreathers, Rebreather, tag: "rebreather" - has_many :regulators, EquipmentPart, tag: "regulator" - has_many :scooters, EquipmentPart, tag: "scooter" - has_many :suits, Suit, tag: "suit" - has_many :tanks, Tank, tag: "tank" - has_many :various_pieces, EquipmentPart, tag: "variouspieces" - has_many :video_cameras, EquipmentPart, tag: "videocamera" - has_many :watches, EquipmentPart, tag: "watch" - end - - class EquipmentConfiguration < EquipmentContent - include HappyMapper - - tag "equipmentconfiguration" - - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - end - - class Equipment < EquipmentContent - include HappyMapper - - tag "equipment" + tag "equipment" has_many :compressors, EquipmentPart, tag: "compressor" has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" end - class Doctor - include HappyMapper - - tag "doctor" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Examination - include HappyMapper - - tag "examination" - - has_one :datetime, DateTime - has_one :doctor, Doctor - has_one :examination_result, String, tag: "examinationresult" - has_many :links, Link, tag: "link" - has_one :notes, Notes - has_one :total_lung_capacity, Float, tag: "totallungcapacity" - has_one :vital_capacity, Float, tag: "vitalcapacity" - end - - class Medical - include HappyMapper - - tag "medical" - - has_one :examination, Examination - end - class BuddyOwnerShared include HappyMapper attribute :id, String has_one :address, Base::Models::Address has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" + has_one :dive_insurances, Base::Models::DiveInsurances, tag: "diveinsurances" + has_one :dive_permissions, Base::Models::DivePermissions, tag: "divepermissions" has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal + has_one :medical, Base::Models::Medical + has_one :notes, Base::Models::Notes + has_one :personal, Base::Models::Personal end class Buddy < BuddyOwnerShared @@ -1576,7 +737,7 @@ class Buddy < BuddyOwnerShared tag "buddy" attribute :id, String - has_one :certification, Certification + has_one :certification, Base::Models::CertificationV322 has_one :student, String end @@ -1586,7 +747,7 @@ class Owner < BuddyOwnerShared tag "owner" attribute :id, String - has_one :education, Education + has_one :education, Base::Models::EducationV322 end class Diver @@ -1598,133 +759,6 @@ class Diver has_one :owner, Owner end - class DCAlarm - include HappyMapper - - tag "dcalarm" - - has_one :acknowledge, String - has_one :alarm_type, Integer, tag: "alarmtype" - has_one :period, Float - end - - class SetDCDiveDepthAlarm - include HappyMapper - - tag "setdcdivedethalarm" - - has_one :dc_alarm, DCAlarm - has_one :dc_alarm_depth, Float - end - - class SetDCDivePo2Alarm - include HappyMapper - - tag "setdcdivepo2alarm" - - has_one :dc_alarm, DCAlarm - has_one :maximum_po2, Float - end - - class SetDCDiveSiteData - include HappyMapper - - tag "setdcdivesitedata" - - attribute :dive_site, String - end - - class SetDCDiveTimeAlarm - include HappyMapper - - tag "setdcdivetimealarm" - - has_one :dc_alarm, DCAlarm - has_one :timespan, Float - end - - class SetDCEndNDTAlarm - include HappyMapper - - tag "setdcendndtalarm" - - has_one :dc_alarm, DCAlarm - end - - class SetDCDecoModel - include HappyMapper - - tag "setdcdecomodel" - - has_many :alias_names, String, tag: "aliasname" - has_one :application_data, ApplicationData - has_one :name, String - end - - class SetDCBuddyData - include HappyMapper - - tag "setdcbuddydata" - - attribute :buddy, String - end - - class SetDCData - include HappyMapper - - tag "setdcdata" - - has_one :set_dc_alarm_time, DateTime - has_one :set_dc_altitude, Float - has_one :set_dc_buddy_data, SetDCBuddyData - has_one :set_dc_date_time, DateTime - has_one :set_dc_deco_model, SetDCDecoModel - has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm - has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm - has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata" - has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm - has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm - has_one :set_dc_gas_definitions_data, String - has_one :set_dc_owner_data, String - has_one :set_dc_password, String - has_one :set_dc_generator_data, String - end - - class GetDCData - include HappyMapper - - tag "getdcdata" - - has_one :get_dc_all_data, String - has_one :get_dc_generator_data, String - has_one :get_dc_owner_data, String - has_one :get_dc_buddy_data, String - has_one :get_dc_gas_definitions_data, String - has_one :get_dc_dive_site_data, String - has_one :get_dc_dive_trip_data, String - has_one :get_dc_profile_data, String - end - - class DiveComputerDump - include HappyMapper - - tag "divecomputerdump" - - has_one :datetime, DateTime - has_one :dc_dump, String - has_one :link, Link - end - - class DiveComputerControl - include HappyMapper - - tag "divecomputercontrol" - - has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump" - has_one :get_dc_data, GetDCData, tag: "getdcdata" - has_one :set_dc_data, SetDCData, tag: "setdcdata" - end - class Uddf include HappyMapper @@ -1732,15 +766,15 @@ class Uddf attribute :version, String has_one :business, Business - has_one :deco_model, DecoModel, tag: "decomodel" - has_one :dive_computer_control, DiveComputerControl, tag: "divecomputercontrol" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" + has_one :dive_computer_control, Base::Models::DiveComputerControlV330, tag: "divecomputercontrol" has_one :diver, Diver - has_one :dive_site, DiveSite, tag: "divesite" - has_one :dive_trip, DiveTrip, tag: "divetrip" - has_one :gas_definitions, GasDefinitions, tag: "gasdefinitions" - has_one :generator, Generator + has_one :dive_site, Base::Models::DiveSite, tag: "divesite" + has_one :dive_trip, Base::Models::DiveTrip, tag: "divetrip" + has_one :gas_definitions, Base::Models::GasDefinitions, tag: "gasdefinitions" + has_one :generator, Base::Models::Generator has_one :maker, Maker - has_one :media_data, MediaData, tag: "mediadata" + has_one :media_data, Base::Models::MediaData, tag: "mediadata" has_one :profile_data, ProfileData, tag: "profiledata" has_one :table_generation, TableGeneration, tag: "tablegeneration" end diff --git a/lib/uddf/v331/models.rb b/lib/uddf/v331/models.rb index bc3d4e3..44ebe56 100644 --- a/lib/uddf/v331/models.rb +++ b/lib/uddf/v331/models.rb @@ -61,140 +61,6 @@ class Scrubber content :value, Float end - class Manufacturer - include HappyMapper - - tag "manufacturer" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - end - - class Link - include HappyMapper - - tag "link" - - attribute :ref, String - end - - class Generator - include HappyMapper - - tag "generator" - - has_many :alias_names, String, tag: "aliasname" - has_one :datetime, DateTime - has_many :links, Link, tag: "link" - has_one :name, String - has_one :type, String - has_one :version, String - end - - class Notes - include HappyMapper - - tag "notes" - - has_many :paras, String, tag: "para" - has_many :links, Link, tag: "link" - end - - class Price - include HappyMapper - - tag "price" - - attribute :currency, String - content :value, Float - end - - class Tissue - include HappyMapper - - tag "tissue" - - attribute :gas, String - attribute :half_life, Float - attribute :number, Integer - attribute :a, Float - attribute :b, Float - end - - class VPM - include HappyMapper - - tag "vpm" - - attribute :id, String - has_one :conservatism, Float - has_one :gamma, Float - has_one :gc, Float - has_one :lambda, Float - has_one :r0, Float - has_many :tissues, Tissue, tag: "tissue" - end - - class RGBM - include HappyMapper - - tag "rgbm" - - attribute :id, String - has_many :tissues, Tissue, tag: "tissue" - end - - class Buehlmann - include HappyMapper - - tag "buehlmann" - - attribute :id, String - has_one :gradient_factor_high, Float, tag: "gradientfactorhigh" - has_one :gradient_factor_low, Float, tag: "gradientfactorlow" - has_many :tissues, Tissue, tag: "tissue" - end - - class DecoModel - include HappyMapper - - tag "decomodel" - - has_many :buehlmanns, Buehlmann, tag: "buehlmann" - has_many :rgbms, RGBM, tag: "rbgm" - has_many :vpms, VPM, tag: "vpm" - end - - class Mix - include HappyMapper - - tag "mix" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ar, Float - has_one :equivalent_air_depth, Float, tag: "equivalentairdepth" - has_one :h2, Float - has_one :he, Float - has_one :maximum_operation_depth, Float, tag: "maximumoperationdepth" - has_one :maximum_po2, Float, tag: "maximumpo2" - has_one :n2, Float - has_one :name, String - has_one :o2, Float - has_one :price_per_litre, Price, tag: "priceperlitre" - end - - class GasDefinitions - include HappyMapper - - tag "gasdefinitions" - - has_many :mixes, Mix, tag: "mix" - end - class WayAltitude include HappyMapper @@ -393,26 +259,6 @@ class Waypoint has_many :set_markers, String, tag: "setmarker" end - class Medicine - include HappyMapper - - tag "medicine" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class MedicationBeforeDive - include HappyMapper - - tag "medicationbeforedive" - - has_many :medicines, Medicine, tag: "medicine" - end - class PlannedProfile include HappyMapper @@ -423,33 +269,13 @@ class PlannedProfile has_many :waypoints, Waypoint, tag: "waypoint" end - class Drink - include HappyMapper - - tag "drink" - - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - has_one :periodically_taken, String, tag: "periodicallytaken" - has_one :timespan_before_dive, Float, tag: "timespanbeforedive" - end - - class AlcoholBeforeDive - include HappyMapper - - tag "alcoholbeforedive" - - has_many :drinks, Drink, tag: "drink" - end - class InformationBeforeDive include HappyMapper tag "informationbeforedive" has_one :air_temperature, Float, tag: "airtemperature" - has_one :alcohol_before_dive, AlcoholBeforeDive, tag: "alcoholbeforedive" + has_one :alcohol_before_dive, Base::Models::AlcoholBeforeDive, tag: "alcoholbeforedive" has_one :altitude, Float has_one :apparatus, String has_one :datetime, DateTime @@ -457,12 +283,12 @@ class InformationBeforeDive has_one :dive_number, Integer, tag: "divenumber" has_one :dive_number_of_day, Integer, tag: "divenumberofday" has_one :internal_dive_number, Integer, tag: "internaldivenumber" - has_many :links, Link, tag: "link" - has_one :medication_before_dive, MedicationBeforeDive, tag: "medicationbeforedive" + has_many :links, Base::Models::Link, tag: "link" + has_one :medication_before_dive, Base::Models::MedicationBeforeDive, tag: "medicationbeforedive" has_one :no_suit, String, tag: "nosuit" has_one :planned_profile, PlannedProfile, tag: "plannedprofile" has_one :platform, String - has_one :price, Price + has_one :price, Base::Models::Price has_one :purpose, String has_many :rebreather_self_tests, RebreatherSelfTest, tag: "rebreatherselftest" has_one :state_of_rest_before_dive, String, tag: "stateofrestbeforedive" @@ -473,15 +299,6 @@ class InformationBeforeDive has_many :timers, Timer, tag: "timer" end - class Rating - include HappyMapper - - tag "rating" - - has_one :datetime, DateTime - has_one :rating_value, Integer, tag: "ratingvalue" - end - class GlobalAlarmsGiven include HappyMapper @@ -496,113 +313,7 @@ class EquipmentUsed tag "equipmentused" has_one :lead_quantity, Float, tag: "leadquantity" - has_many :links, Link, tag: "link" - end - - class AnySymptoms - include HappyMapper - - tag "anysymptoms" - - has_one :notes, Notes - end - - class Abundance - include HappyMapper - - tag "abundance" - - attribute :quality, String - attribute :occurrence, String - content :value, Integer - end - - class Species - include HappyMapper - - tag "species" - - attribute :id, String - has_one :abundance, Abundance - has_one :age, Integer - has_one :dominance, String - has_one :life_stage, String, tag: "lifestage" - has_one :notes, Notes - has_one :scientific_name, String, tag: "scientificname" - has_one :sex, String - has_one :size, Float - has_one :trivial_name, String, tag: "trivialname" - end - - class WithSpecies - include HappyMapper - - has_many :species, Species, tag: "species" - end - - class Invertebrata - include HappyMapper - - tag "invertebrata" - - has_one :ascidiacea, WithSpecies - has_one :bryozoan, WithSpecies - has_one :cnidaria, WithSpecies - has_one :coelenterata, WithSpecies - has_one :crustacea, WithSpecies - has_one :ctenophora, WithSpecies - has_one :echinodermata, WithSpecies - has_one :invertebrata_various, WithSpecies, tag: "invertebratavarious" - has_one :mollusca, WithSpecies - has_one :phoronidea, WithSpecies - has_one :plathelminthes, WithSpecies - has_one :porifera, WithSpecies - end - - class Vertebrata - include HappyMapper - - tag "vertebrata" - - has_one :amphibia, WithSpecies - has_one :chondrichthyes, WithSpecies - has_one :mammalia, WithSpecies - has_one :osteichthyes, WithSpecies - has_one :reptilia, WithSpecies - has_one :vertebrata_various, WithSpecies, tag: "vertebratavarious" - end - - class Fauna - include HappyMapper - - tag "fauna" - - has_one :invertebrata, Invertebrata - has_one :notes, Notes - has_one :vertebrata, Vertebrata - end - - class Flora - include HappyMapper - - tag "flora" - - has_one :chlorophyceae, WithSpecies - has_one :flora_various, WithSpecies, tag: "floravarious" - has_one :notes, Notes - has_one :phaeophyceae, WithSpecies - has_one :rhodophyceae, WithSpecies - has_one :spermatophyta, WithSpecies - end - - class Observations - include HappyMapper - - tag "observations" - - has_one :fauna, Fauna - has_one :flora, Flora - has_one :notes, Notes + has_many :links, Base::Models::Link, tag: "link" end class InformationAfterDive @@ -610,7 +321,7 @@ class InformationAfterDive tag "informationafterdive" - has_one :any_symptoms, AnySymptoms, tag: "anysymptoms" + has_one :any_symptoms, Base::Models::AnySymptoms, tag: "anysymptoms" has_one :average_depth, Float, tag: "averagedepth" has_one :current, String has_one :desaturation_time, Float, tag: "desaturationtime" @@ -624,12 +335,12 @@ class InformationAfterDive has_one :highest_po2, Float, tag: "highestpo2" has_one :lowest_temperature, Float, tag: "lowesttemperature" has_one :no_flight_time, Float, tag: "noflighttime" - has_one :notes, Notes - has_one :observations, Observations + has_one :notes, Base::Models::Notes + has_one :observations, Base::Models::Observations has_one :pressure_drop, Float, tag: "pressuredrop" has_many :problems, String, tag: "problems" has_one :program, String - has_many :ratings, Rating, tag: "rating" + has_many :ratings, Base::Models::Rating, tag: "rating" has_one :surface_interval_after_dive, SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive" has_one :thermal_comfort, String, tag: "thermalcomfort" has_many :timers, Timer, tag: "timer" @@ -645,29 +356,6 @@ class Samples has_many :waypoints, Waypoint, tag: "waypoint" end - class Hargikas - include HappyMapper - - tag "hargikas" - - has_one :ambient, Float - has_many :tissues, Tissue, tag: "tissue" - has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel" - has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt" - has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel" - end - - class ApplicationData - include HappyMapper - - tag "applicationdata" - - has_one :deco_trainer, String, tag: "decotrainer" - has_one :hargikas, Hargikas - has_one :apdiving, String - has_one :ratio, String - end - class TankUsed include HappyMapper @@ -678,7 +366,7 @@ class TankUsed has_one :analysed_he, Float, tag: "analysedhe" has_one :analysed_o2, Float, tag: "analysedo2" has_one :breathing_consumption_volume, Float, tag: "breathingconsumptionvolume" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :tank_pressure_begin, Float, tag: "tankpressurebegin" has_one :tank_pressure_end, Float, tag: "tankpressureend" has_one :tank_volume, Float, tag: "tankvolume" @@ -700,7 +388,7 @@ class Dive attribute :id, String has_one :information_after_dive, InformationAfterDive, tag: "informationafterdive" has_one :information_before_dive, InformationBeforeDive, tag: "informationbeforedive" - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV330, tag: "applicationdata" has_one :samples, Samples has_one :tank_data, TankData, tag: "tankdata" end @@ -752,7 +440,7 @@ class InputProfile tag "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_many :waypoints, Waypoint, tag: "waypoint" end @@ -773,12 +461,12 @@ class Profile tag "profile" - has_one :application_data, ApplicationData, tag: "applicationdata" - has_one :deco_model, DecoModel, tag: "decomodel" + has_one :application_data, Base::Models::ApplicationDataV330, tag: "applicationdata" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" has_one :deep_stops, DeepStops, tag: "deepstops" has_one :density, Float has_one :input_profile, InputProfile, tag: "inputprofile" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :maximum_ascending_rate, Float, tag: "maximumascendingrate" has_one :mix_change, MixChange, tag: "mixchange" has_one :output, Output @@ -850,9 +538,9 @@ class BottomTimeTable tag "bottomtimetable" attribute :id, String - has_one :application_data, ApplicationData, tag: "applicationdata" + has_one :application_data, Base::Models::ApplicationDataV330, tag: "applicationdata" has_one :bottom_time_table_scope, BottomTimeTableScope, tag: "bottomtimetablescope" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :output, Output has_one :title, String end @@ -875,656 +563,162 @@ class TableGeneration has_one :calculate_table, CalculateTable, tag: "calculatetable" end - class ImageData + class Maker include HappyMapper - tag "imagedata" + tag "maker" - has_one :aperture, Float - has_one :datetime, DateTime - has_one :exposure_compensation, Float, tag: "exposurecompensation" - has_one :film_speed, Integer, tag: "filmspeed" - has_one :focal_length, Float, tag: "focallength" - has_one :focusing_distance, Float, tag: "focusingdistance" - has_one :metering_method, String, tag: "meteringmethod" - has_one :shutter_speed, Float, tag: "shutterspeed" + has_many :manufacturers, Base::Models::Manufacturer, tag: "manufacturer" end - class Image + class Business include HappyMapper - tag "image" + tag "business" - attribute :id, String - attribute :height, Integer - attribute :width, Integer - attribute :format, String - has_one :image_data, ImageData, tag: "imagedata" - has_one :object_name, String, tag: "objectname" - has_one :title, String + has_one :shop, Base::Models::Shop end - class Video + class TemperatureSensor include HappyMapper - tag "video" + tag "temperaturesensor" attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String + + has_many :alias_names, String, tag: "aliasname" + has_one :manufacturer, Base::Models::Manufacturer + has_one :model, String + has_one :name, String + has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase + has_one :serial_number, String, tag: "serialnumber" + has_one :service_interval, Integer, tag: "serviceinterval" end - class Audio + class TimerDevice include HappyMapper - tag "audio" + tag "timerdevice" attribute :id, String - has_one :object_name, String, tag: "objectname" - has_one :title, String end - class MediaData + class EquipmentPart include HappyMapper - tag "mediadata" + tag "equipmentpart" - has_many :audio_files, Audio, tag: "audio" - has_many :image_files, Image, tag: "image" - has_many :video_files, Video, tag: "video" + attribute :id, String + has_many :alias_names, String, tag: "aliasname" + has_many :links, Base::Models::Link, tag: "link" + has_one :manufacturer, Base::Models::Manufacturer + has_one :model, String + has_one :name, String + has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" + has_one :notes, Base::Models::Notes + has_one :purchase, Base::Models::Purchase + has_one :serial_number, String, tag: "serialnumber" + has_one :service_interval, Integer, tag: "serviceinterval" end - class Maker + class Lead < EquipmentPart include HappyMapper - tag "maker" + tag "lead" - has_many :manufacturers, Manufacturer, tag: "manufacturer" + has_one :lead_quantity, Integer, tag: "leadquantity" end - class PriceDivePackage + class Rebreather < EquipmentPart include HappyMapper - tag "pricedivepackage" + tag "rebreather" - attribute :currency, String - attribute :no_of_dives, Integer - content :value, Float + has_many :batteries, Battery, tag: "battery" + has_many :o2_sensors, EquipmentPart, tag: "o2sensor" + has_many :scrubber_monitors, ScrubberMonitor, tag: "scrubbermonitor" + has_many :temperature_sensors, TemperatureSensor, tag: "temperaturesensor" + has_many :timer_devices, TimerDevice, tag: "timerdevice" end - class RelatedDives + class Suit < EquipmentPart include HappyMapper - tag "relateddives" + tag "suit" - has_many :links, Link, tag: "link" + has_one :suit_type, String, tag: "suittype" end - class ShipDimension + class Tank < EquipmentPart include HappyMapper - tag "shipdimension" + tag "tank" - has_one :beam, Float - has_one :displacement, Float - has_one :draught, Float - has_one :length, Float - has_one :tonnage, Float + has_one :tank_material, String, tag: "tankmaterial" + has_one :tank_volume, Float, tag: "tankvolume" + has_many :batteries, Battery, tag: "battery" + has_one :hydro_service_interval, Integer, tag: "hydroserviceinterval" + has_one :next_hydro_date, Base::Models::DateTimeField, tag: "nexthydrodate" + has_one :next_visual_date, Base::Models::DateTimeField, tag: "nextvisualdate" + has_one :rated_pressure, Float, tag: "ratedpressure" + has_one :visual_service_interval, Integer, tag: "visualserviceinterval" end - class Vessel + class Camera include HappyMapper - tag "vessel" + tag "camera" - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :marina, String - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" + has_one :body, EquipmentPart + has_many :flashes, EquipmentPart, tag: "flash" + has_one :housing, EquipmentPart + has_one :lens, EquipmentPart end - class Operator + class DiveComputer < EquipmentPart include HappyMapper - tag "operator" + tag "divecomputer" - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" + has_many :batteries, Battery, tag: "battery" + has_many :timer_devices, TimerDevice, tag: "timerdevice" end - class DateOfTrip + class EquipmentContent include HappyMapper - tag "dateoftrip" - - attribute :start_date, DateTime - attribute :end_date, DateTime + has_many :boots, EquipmentPart, tag: "boots" + has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" + has_many :cameras, Camera, tag: "camera" + has_many :compasses, EquipmentPart, tag: "compass" + has_many :dive_computers, DiveComputer, tag: "divecomputer" + has_many :fins, EquipmentPart, tag: "fins" + has_many :gloves, EquipmentPart, tag: "gloves" + has_many :knives, EquipmentPart, tag: "knife" + has_many :leads, Lead, tag: "lead" + has_many :lights, EquipmentPart, tag: "light" + has_many :masks, EquipmentPart, tag: "mask" + has_many :rebreathers, Rebreather, tag: "rebreather" + has_many :regulators, EquipmentPart, tag: "regulator" + has_many :scooters, EquipmentPart, tag: "scooter" + has_many :suits, Suit, tag: "suit" + has_many :tanks, Tank, tag: "tank" + has_many :various_pieces, EquipmentPart, tag: "variouspieces" + has_many :video_cameras, EquipmentPart, tag: "videocamera" + has_many :watches, EquipmentPart, tag: "watch" end - class Accommodation - include HappyMapper - - tag "accommodation" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :category, String - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - end - - class Geography - include HappyMapper - - tag "geography" - - has_one :address, Base::Models::Address - has_one :altitude, Float - has_one :latitude, Float - has_one :location, String - has_one :longitude, Float - has_one :time_zone, Float, tag: "timezone" - end - - class TripPart - include HappyMapper - - tag "trippart" - - attribute :type, String - has_one :accommodation, Accommodation - has_one :date_of_trip, DateOfTrip, tag: "dateoftrip" - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :operator, Operator - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_one :related_dives, RelatedDives, tag: "relateddives" - has_one :vessel, Vessel - end - - class Trip - include HappyMapper - - tag "trip" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_many :ratings, Rating, tag: "rating" - has_many :trip_parts, TripPart, tag: "trippart" - end - - class DiveTrip - include HappyMapper - - tag "divetrip" - - has_many :trips, Trip, tag: "trip" - end - - class Ecology - include HappyMapper - - tag "ecology" - - has_one :fauna, Fauna - has_one :flora, Flora - end - - class Built - include HappyMapper - - tag "built" - - has_one :launching_date, Base::Models::DateTimeField, tag: "launchingdate" - has_one :ship_yard, String, tag: "shipyard" - end - - class Wreck - include HappyMapper - - tag "wreck" - - has_many :alias_names, String, tag: "aliasname" - has_one :built, Built - has_one :name, String - has_one :nationality, String - has_one :ship_dimension, ShipDimension, tag: "shipdimension" - has_one :ship_type, String, tag: "shiptype" - has_one :sunk, Base::Models::DateTimeField - end - - class Shore - include HappyMapper - - tag "shore" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class River - include HappyMapper - - tag "river" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Lake - include HappyMapper - - tag "lake" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class Indoor - include HappyMapper - - tag "indoor" - - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Cave - include HappyMapper - - tag "cave" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :name, String - has_one :notes, Notes - end - - class SiteData - include HappyMapper - - tag "sidedata" - - has_one :area_length, Float, tag: "arealength" - has_one :area_width, Float, tag: "areawidth" - has_one :average_visibility, Float, tag: "averagevisibility" - has_one :bottom, String - has_one :cave, Cave - has_one :density, Float - has_one :difficulty, Integer - has_one :global_light_intensity, String, tag: "globallightintensity" - has_one :indoor, Indoor - has_one :maximum_depth, Float, tag: "maximumdepth" - has_one :maximum_visibility, Float, tag: "maximumvisibility" - has_one :minimum_depth, Float, tag: "minimumdepth" - has_one :minimum_visibility, Float, tag: "minimumvisibility" - has_one :river, River - has_one :shore, Shore - has_one :terrain, String - has_one :wreck, Wreck - end - - class Site - include HappyMapper - - tag "site" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_one :ecology, Ecology - has_one :environment, String - has_one :geography, Geography - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_many :ratings, Rating, tag: "rating" - has_one :side_data, SiteData, tag: "sitedata" - end - - class Guide - include HappyMapper - - tag "guide" - - has_many :links, Link, tag: "link" - end - - class DiveBase - include HappyMapper - - tag "divebase" - - attribute :id, String - has_one :address, Base::Models::Address - has_many :alias_names, String, tag: "aliasname" - has_one :contact, Base::Models::Contact - has_many :guides, Guide, tag: "guide" - has_many :links, Link, tag: "link" - has_one :name, String - has_one :notes, Notes - has_one :price_dive_package, PriceDivePackage, tag: "pricedivepackage" - has_one :price_per_dive, Price, tag: "priceperdive" - has_many :ratings, Rating, tag: "rating" - end - - class DiveSite - include HappyMapper - - tag "divesite" - - has_many :dive_bases, DiveBase, tag: "divebase" - has_many :sites, Site, tag: "site" - end - - class Shop - include HappyMapper - - tag "shop" - - has_many :alias_names, String, tag: "aliasname" - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :name, String - has_one :notes, Notes - end - - class Business - include HappyMapper - - tag "business" - - has_one :shop, Shop - end - - class Membership - include HappyMapper - - tag "membership" - - attribute :organisation, String - attribute :member_id, String - end - - class NumberOfDives - include HappyMapper - - tag "numberofdives" - - has_one :start_date, DateTime, tag: "startdate" - has_one :end_date, DateTime, tag: "enddate" - has_one :dives, Integer - end - - class Personal - include HappyMapper - - tag "personal" - - has_one :birth_date, Base::Models::DateTimeField, tag: "birthdate" - has_one :birth_name, String, tag: "birthname" - has_one :blood_group, String, tag: "bloodgroup" - has_one :first_name, String, tag: "firstname" - has_one :height, Float - has_one :honorific, String - has_one :last_name, String, tag: "lastname" - has_one :membership, Membership - has_one :middle_name, String, tag: "middlename" - has_one :number_of_dives, NumberOfDives, tag: "numberofdives" - has_one :sex, String - has_one :smoking, String - has_one :weight, Float - end - - class Instructor - include HappyMapper - - tag "instructor" - - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Certification - include HappyMapper - - tag "certification" - - has_one :instructor, Instructor - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :level, String - has_one :link, Link - has_one :organization, String - has_one :specialty, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - # Added in v3.2.2 - has_one :certificate_number, String, tag: "certificatenumber" - end - - class Education - include HappyMapper - - tag "education" - - has_many :certifications, Certification, tag: "certification" - end - - class Insurance - include HappyMapper - - tag "insurance" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DiveInsurances - include HappyMapper - - tag "diveinsurances" - - has_many :insurances, Insurance, tag: "insurance" - end - - class Permit - include HappyMapper - - tag "permit" - - has_many :alias_names, String, tag: "aliasname" - has_one :issue_date, Base::Models::DateTimeField, tag: "issuedate" - has_one :name, String - has_one :notes, Notes - has_one :region, String - has_one :valid_date, Base::Models::DateTimeField, tag: "validdate" - end - - class DivePermissions - include HappyMapper - - tag "divepermissions" - - has_many :permits, Permit, tag: "permit" - end - - class Purchase - include HappyMapper - - tag "purchase" - - has_one :datetime, DateTime - has_one :link, Link - has_one :price, Price - has_one :shop, Shop - end - - class TemperatureSensor - include HappyMapper - - tag "temperaturesensor" - - attribute :id, String - - has_many :alias_names, String, tag: "aliasname" - has_one :manufacturer, Manufacturer - has_one :model, String - has_one :name, String - has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase - has_one :serial_number, String, tag: "serialnumber" - has_one :service_interval, Integer, tag: "serviceinterval" - end - - class TimerDevice - include HappyMapper - - tag "timerdevice" - - attribute :id, String - end - - class EquipmentPart - include HappyMapper - - tag "equipmentpart" - - attribute :id, String - has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" - has_one :manufacturer, Manufacturer - has_one :model, String - has_one :name, String - has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate" - has_one :notes, Notes - has_one :purchase, Purchase - has_one :serial_number, String, tag: "serialnumber" - has_one :service_interval, Integer, tag: "serviceinterval" - end - - class Lead < EquipmentPart - include HappyMapper - - tag "lead" - - has_one :lead_quantity, Integer, tag: "leadquantity" - end - - class Rebreather < EquipmentPart - include HappyMapper - - tag "rebreather" - - has_many :batteries, Battery, tag: "battery" - has_many :o2_sensors, EquipmentPart, tag: "o2sensor" - has_many :scrubber_monitors, ScrubberMonitor, tag: "scrubbermonitor" - has_many :temperature_sensors, TemperatureSensor, tag: "temperaturesensor" - has_many :timer_devices, TimerDevice, tag: "timerdevice" - end - - class Suit < EquipmentPart - include HappyMapper - - tag "suit" - - has_one :suit_type, String, tag: "suittype" - end - - class Tank < EquipmentPart - include HappyMapper - - tag "tank" - - has_one :tank_material, String, tag: "tankmaterial" - has_one :tank_volume, Float, tag: "tankvolume" - has_many :batteries, Battery, tag: "battery" - has_one :hydro_service_interval, Integer, tag: "hydroserviceinterval" - has_one :next_hydro_date, Base::Models::DateTimeField, tag: "nexthydrodate" - has_one :next_visual_date, Base::Models::DateTimeField, tag: "nextvisualdate" - has_one :rated_pressure, Float, tag: "ratedpressure" - has_one :visual_service_interval, Integer, tag: "visualserviceinterval" - end - - class Camera - include HappyMapper - - tag "camera" - - has_one :body, EquipmentPart - has_many :flashes, EquipmentPart, tag: "flash" - has_one :housing, EquipmentPart - has_one :lens, EquipmentPart - end - - class DiveComputer < EquipmentPart - include HappyMapper - - tag "divecomputer" - - has_many :batteries, Battery, tag: "battery" - has_many :timer_devices, TimerDevice, tag: "timerdevice" - end - - class EquipmentContent - include HappyMapper - - has_many :boots, EquipmentPart, tag: "boots" - has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice" - has_many :cameras, Camera, tag: "camera" - has_many :compasses, EquipmentPart, tag: "compass" - has_many :dive_computers, DiveComputer, tag: "divecomputer" - has_many :fins, EquipmentPart, tag: "fins" - has_many :gloves, EquipmentPart, tag: "gloves" - has_many :knives, EquipmentPart, tag: "knife" - has_many :leads, Lead, tag: "lead" - has_many :lights, EquipmentPart, tag: "light" - has_many :masks, EquipmentPart, tag: "mask" - has_many :rebreathers, Rebreather, tag: "rebreather" - has_many :regulators, EquipmentPart, tag: "regulator" - has_many :scooters, EquipmentPart, tag: "scooter" - has_many :suits, Suit, tag: "suit" - has_many :tanks, Tank, tag: "tank" - has_many :various_pieces, EquipmentPart, tag: "variouspieces" - has_many :video_cameras, EquipmentPart, tag: "videocamera" - has_many :watches, EquipmentPart, tag: "watch" - end - - class EquipmentConfiguration < EquipmentContent + class EquipmentConfiguration < EquipmentContent include HappyMapper tag "equipmentconfiguration" has_many :alias_names, String, tag: "aliasname" - has_many :links, Link, tag: "link" + has_many :links, Base::Models::Link, tag: "link" has_one :name, String - has_one :notes, Notes + has_one :notes, Base::Models::Notes end class Equipment < EquipmentContent @@ -1536,51 +730,18 @@ class Equipment < EquipmentContent has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration" end - class Doctor - include HappyMapper - - tag "doctor" - - attribute :id, String - has_one :address, Base::Models::Address - has_one :contact, Base::Models::Contact - has_one :personal, Personal - end - - class Examination - include HappyMapper - - tag "examination" - - has_one :datetime, DateTime - has_one :doctor, Doctor - has_one :examination_result, String, tag: "examinationresult" - has_many :links, Link, tag: "link" - has_one :notes, Notes - has_one :total_lung_capacity, Float, tag: "totallungcapacity" - has_one :vital_capacity, Float, tag: "vitalcapacity" - end - - class Medical - include HappyMapper - - tag "medical" - - has_one :examination, Examination - end - class BuddyOwnerShared include HappyMapper attribute :id, String has_one :address, Base::Models::Address has_one :contact, Base::Models::Contact - has_one :dive_insurances, DiveInsurances, tag: "diveinsurances" - has_one :dive_permissions, DivePermissions, tag: "divepermissions" + has_one :dive_insurances, Base::Models::DiveInsurances, tag: "diveinsurances" + has_one :dive_permissions, Base::Models::DivePermissions, tag: "divepermissions" has_one :equipment, Equipment - has_one :medical, Medical - has_one :notes, Notes - has_one :personal, Personal + has_one :medical, Base::Models::Medical + has_one :notes, Base::Models::Notes + has_one :personal, Base::Models::Personal end class Buddy < BuddyOwnerShared @@ -1589,7 +750,7 @@ class Buddy < BuddyOwnerShared tag "buddy" attribute :id, String - has_one :certification, Certification + has_one :certification, Base::Models::CertificationV322 has_one :student, String end @@ -1599,7 +760,7 @@ class Owner < BuddyOwnerShared tag "owner" attribute :id, String - has_one :education, Education + has_one :education, Base::Models::EducationV322 end class Diver @@ -1611,133 +772,6 @@ class Diver has_one :owner, Owner end - class DCAlarm - include HappyMapper - - tag "dcalarm" - - has_one :acknowledge, String - has_one :alarm_type, Integer, tag: "alarmtype" - has_one :period, Float - end - - class SetDCDiveDepthAlarm - include HappyMapper - - tag "setdcdivedethalarm" - - has_one :dc_alarm, DCAlarm - has_one :dc_alarm_depth, Float - end - - class SetDCDivePo2Alarm - include HappyMapper - - tag "setdcdivepo2alarm" - - has_one :dc_alarm, DCAlarm - has_one :maximum_po2, Float - end - - class SetDCDiveSiteData - include HappyMapper - - tag "setdcdivesitedata" - - attribute :dive_site, String - end - - class SetDCDiveTimeAlarm - include HappyMapper - - tag "setdcdivetimealarm" - - has_one :dc_alarm, DCAlarm - has_one :timespan, Float - end - - class SetDCEndNDTAlarm - include HappyMapper - - tag "setdcendndtalarm" - - has_one :dc_alarm, DCAlarm - end - - class SetDCDecoModel - include HappyMapper - - tag "setdcdecomodel" - - has_many :alias_names, String, tag: "aliasname" - has_one :application_data, ApplicationData - has_one :name, String - end - - class SetDCBuddyData - include HappyMapper - - tag "setdcbuddydata" - - attribute :buddy, String - end - - class SetDCData - include HappyMapper - - tag "setdcdata" - - has_one :set_dc_alarm_time, DateTime - has_one :set_dc_altitude, Float - has_one :set_dc_buddy_data, SetDCBuddyData - has_one :set_dc_date_time, DateTime - has_one :set_dc_deco_model, SetDCDecoModel - has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm - has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm - has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata" - has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm - has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm - has_one :set_dc_gas_definitions_data, String - has_one :set_dc_owner_data, String - has_one :set_dc_password, String - has_one :set_dc_generator_data, String - end - - class GetDCData - include HappyMapper - - tag "getdcdata" - - has_one :get_dc_all_data, String - has_one :get_dc_generator_data, String - has_one :get_dc_owner_data, String - has_one :get_dc_buddy_data, String - has_one :get_dc_gas_definitions_data, String - has_one :get_dc_dive_site_data, String - has_one :get_dc_dive_trip_data, String - has_one :get_dc_profile_data, String - end - - class DiveComputerDump - include HappyMapper - - tag "divecomputerdump" - - has_one :datetime, DateTime - has_one :dc_dump, String - has_one :link, Link - end - - class DiveComputerControl - include HappyMapper - - tag "divecomputercontrol" - - has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump" - has_one :get_dc_data, GetDCData, tag: "getdcdata" - has_one :set_dc_data, SetDCData, tag: "setdcdata" - end - class Uddf include HappyMapper @@ -1745,15 +779,15 @@ class Uddf attribute :version, String has_one :business, Business - has_one :deco_model, DecoModel, tag: "decomodel" - has_one :dive_computer_control, DiveComputerControl, tag: "divecomputercontrol" + has_one :deco_model, Base::Models::DecoModelV320, tag: "decomodel" + has_one :dive_computer_control, Base::Models::DiveComputerControlV330, tag: "divecomputercontrol" has_one :diver, Diver - has_one :dive_site, DiveSite, tag: "divesite" - has_one :dive_trip, DiveTrip, tag: "divetrip" - has_one :gas_definitions, GasDefinitions, tag: "gasdefinitions" - has_one :generator, Generator + has_one :dive_site, Base::Models::DiveSite, tag: "divesite" + has_one :dive_trip, Base::Models::DiveTrip, tag: "divetrip" + has_one :gas_definitions, Base::Models::GasDefinitions, tag: "gasdefinitions" + has_one :generator, Base::Models::Generator has_one :maker, Maker - has_one :media_data, MediaData, tag: "mediadata" + has_one :media_data, Base::Models::MediaData, tag: "mediadata" has_one :profile_data, ProfileData, tag: "profiledata" has_one :table_generation, TableGeneration, tag: "tablegeneration" end