uddf 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UDDF
4
+ module Base
5
+ module Models
6
+ class ImageData
7
+ include HappyMapper
8
+
9
+ tag "imagedata"
10
+
11
+ has_one :aperture, Float
12
+ has_one :datetime, DateTime
13
+ has_one :exposure_compensation, Float, tag: "exposurecompensation"
14
+ has_one :film_speed, Integer, tag: "filmspeed"
15
+ has_one :focal_length, Float, tag: "focallength"
16
+ has_one :focusing_distance, Float, tag: "focusingdistance"
17
+ has_one :metering_method, String, tag: "meteringmethod"
18
+ has_one :shutter_speed, Float, tag: "shutterspeed"
19
+ end
20
+
21
+ class Image
22
+ include HappyMapper
23
+
24
+ tag "image"
25
+
26
+ attribute :id, String
27
+ attribute :height, Integer
28
+ attribute :width, Integer
29
+ attribute :format, String
30
+ has_one :image_data, ImageData, tag: "imagedata"
31
+ has_one :object_name, String, tag: "objectname"
32
+ has_one :title, String
33
+ end
34
+
35
+ class Video
36
+ include HappyMapper
37
+
38
+ tag "video"
39
+
40
+ attribute :id, String
41
+ has_one :object_name, String, tag: "objectname"
42
+ has_one :title, String
43
+ end
44
+
45
+ class Audio
46
+ include HappyMapper
47
+
48
+ tag "audio"
49
+
50
+ attribute :id, String
51
+ has_one :object_name, String, tag: "objectname"
52
+ has_one :title, String
53
+ end
54
+
55
+ class MediaData
56
+ include HappyMapper
57
+
58
+ tag "mediadata"
59
+
60
+ has_many :audio_files, Audio, tag: "audio"
61
+ has_many :image_files, Image, tag: "image"
62
+ has_many :video_files, Video, tag: "video"
63
+ end
64
+ end
65
+ end
66
+ end
@@ -1,75 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "uddf/base/models/generic"
4
+ require "uddf/base/models/deco"
5
+ require "uddf/base/models/media"
6
+ require "uddf/base/models/dive_computer"
7
+
3
8
  module UDDF
4
9
  module Base
5
- module Models
6
- ##
7
- # Inside <address> the own (<owner> element) address data,
8
- # or that of dive buddies (<buddy> element),
9
- # or that of a shop (<shop> element) etc., are given.
10
- class Address
11
- include HappyMapper
12
-
13
- tag "address"
14
-
15
- has_one :street, String
16
- has_one :city, String
17
- has_one :postcode, String
18
- has_one :country, String
19
- has_one :province, String
20
- end
21
-
22
- ##
23
- # Inside <contact> data concerning getting in touch with some one are
24
- # given, like phone number, email address, language etc.
25
- class Contact
26
- include HappyMapper
27
-
28
- tag "contact"
29
-
30
- has_many :emails, String, tag: "email"
31
- has_many :faxes, String, tag: "fax"
32
- has_many :homepages, String, tag: "homepage"
33
- has_many :languages, String, tag: "language"
34
- has_many :mobile_phones, String, tag: "mobilephone"
35
- has_many :phones, String, tag: "phone"
36
- end
37
-
38
- class DateTimeField
39
- include HappyMapper
40
-
41
- element :raw, String, tag: "datetime"
42
-
43
- # Lazily parse on first access; memoize in @date_time
44
- def date_time
45
- return @date_time if @date_time
46
-
47
- content = raw.to_s.strip
48
- return nil if content.empty?
49
-
50
- @date_time =
51
- case content
52
- when /^\d{4}$/ # "YYYY"
53
- DateTime.new(content.to_i, 1, 1)
54
- when /^\d{4}-\d{2}$/ # "YYYY-MM"
55
- y, m = content.split("-").map!(&:to_i)
56
- DateTime.new(y, m, 1)
57
- else
58
- begin
59
- DateTime.iso8601(content)
60
- rescue ArgumentError, Date::Error
61
- begin
62
- DateTime.rfc3339(content)
63
- rescue ArgumentError, Date::Error
64
- DateTime.parse(content)
65
- end
66
- end
67
- end
68
- end
69
-
70
- # Allow manual assignment if you ever need it
71
- attr_writer :date_time
72
- end
73
- end
10
+ module Models; end
74
11
  end
75
12
  end
@@ -0,0 +1,512 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "happymapper"
4
+ require "uddf/base/models"
5
+
6
+ module UDDF
7
+ module V300
8
+ module Models
9
+ class TankPressure
10
+ include HappyMapper
11
+
12
+ tag "tankpressure"
13
+
14
+ attribute :ref, String
15
+ content :value, Float
16
+ end
17
+
18
+ class SwitchMix
19
+ include HappyMapper
20
+
21
+ tag "switchmix"
22
+
23
+ attribute :ref, String
24
+ end
25
+
26
+ class SetPo2
27
+ include HappyMapper
28
+
29
+ tag "setpo2"
30
+
31
+ content :value, Float
32
+ end
33
+
34
+ class Decostop
35
+ include HappyMapper
36
+
37
+ tag "decostop"
38
+
39
+ attribute :kind, String
40
+ attribute :deco_depth, Float, tag: "decodepth"
41
+ attribute :duration, Float
42
+ end
43
+
44
+ class BatteryChargeCondition
45
+ include HappyMapper
46
+
47
+ tag "batterychargecondition"
48
+
49
+ attribute :device_ref, String, tag: "deviceref"
50
+ attribute :tank_ref, String, tag: "tankref"
51
+ content :value, Float
52
+ end
53
+
54
+ class Alarm
55
+ include HappyMapper
56
+
57
+ tag "alarm"
58
+
59
+ attribute :value_attr, Float
60
+ attribute :tank_ref, String, tag: "tankref"
61
+ content :value, String
62
+ end
63
+
64
+ class Waypoint
65
+ include HappyMapper
66
+
67
+ tag "waypoint"
68
+
69
+ has_many :alarms, Alarm, tag: "alarm"
70
+ has_many :battery_charge_conditions, BatteryChargeCondition, tag: "batterychargecondition"
71
+ has_one :cns, Float
72
+ has_many :deco_stops, Decostop, tag: "decostop"
73
+ has_one :depth, Float
74
+ has_one :dive_time, Float, tag: "divetime"
75
+ has_one :heading, Float
76
+ has_one :otu, Float
77
+ has_one :remaining_bottom_time, Float, tag: "remainingbottomtime"
78
+ has_one :remaining_o2_time, Float, tag: "remainingo2time"
79
+ has_many :set_po2s, SetPo2, tag: "setpo2"
80
+ has_one :switch_mix, SwitchMix, tag: "switchmix"
81
+ has_many :tank_pressures, TankPressure, tag: "tankpressure"
82
+ has_one :temperature, Float
83
+ end
84
+
85
+ class InformationBeforeDive
86
+ include HappyMapper
87
+
88
+ tag "informationbeforedive"
89
+
90
+ has_one :air_temperature, Float, tag: "airtemperature"
91
+ has_one :alcohol_before_dive, Base::Models::AlcoholBeforeDive, tag: "alcoholbeforedive"
92
+ has_one :altitude, Float
93
+ has_one :apparatus, String
94
+ has_one :datetime, DateTime
95
+ has_one :dive_number, Integer, tag: "divenumber"
96
+ has_one :internal_dive_number, Integer, tag: "internaldivenumber"
97
+ has_many :links, Base::Models::Link, tag: "link"
98
+ has_one :medication_before_dive, Base::Models::MedicationBeforeDive, tag: "medicationbeforedive"
99
+ has_one :no_suit, String, tag: "nosuit"
100
+ has_one :platform, String
101
+ has_one :price, Base::Models::Price
102
+ has_one :purpose, String
103
+ has_one :state_of_rest_before_dive, String, tag: "stateofrestbeforedive"
104
+ has_one :surface_interval_before_dive, Base::Models::SurfaceIntervalBeforeDive, tag: "surfaceintervalbeforedive"
105
+ has_one :trip_membership, String, tag: "tripmembership"
106
+ end
107
+
108
+ class EquipmentUsed
109
+ include HappyMapper
110
+
111
+ tag "equipmentused"
112
+
113
+ has_one :lead_quantity, Float, tag: "leadquantity"
114
+ has_many :links, Base::Models::Link, tag: "link"
115
+ end
116
+
117
+ class InformationAfterDive
118
+ include HappyMapper
119
+
120
+ tag "informationafterdive"
121
+
122
+ has_one :any_symptoms, Base::Models::AnySymptoms, tag: "anysymptoms"
123
+ has_one :current, String
124
+ has_one :desaturation_time, Float, tag: "desaturationtime"
125
+ has_one :dive_duration, Float, tag: "diveduration"
126
+ has_one :dive_plan, String, tag: "diveplan"
127
+ has_one :dive_table, String, tag: "divetable"
128
+ has_one :equipment_malfunction, String, tag: "equipmentmalfunction"
129
+ has_one :equipment_used, EquipmentUsed, tag: "equipmentused"
130
+ has_one :global_alarms_given, Base::Models::GlobalAlarmsGiven, tag: "globalalarmsgiven"
131
+ has_one :greatest_depth, Float, tag: "greatestdepth"
132
+ has_one :highest_po2, Float, tag: "highestpo2"
133
+ has_one :lowest_temperature, Float, tag: "lowesttemperature"
134
+ has_one :no_flight_time, Float, tag: "noflighttime"
135
+ has_one :observations, Base::Models::Observations
136
+ has_one :pressure_drop, Float, tag: "pressuredrop"
137
+ has_many :problems, String, tag: "problems"
138
+ has_one :program, String
139
+ has_many :ratings, Base::Models::Rating, tag: "rating"
140
+ has_one :surface_interval_after_dive, Base::Models::SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive"
141
+ has_one :thermal_comfort, String, tag: "thermalcomfort"
142
+ has_one :visibility, Float
143
+ has_one :workload, String
144
+ end
145
+
146
+ class Samples
147
+ include HappyMapper
148
+
149
+ tag "samples"
150
+
151
+ has_many :waypoints, Waypoint, tag: "waypoint"
152
+ end
153
+
154
+ class TankData
155
+ include HappyMapper
156
+
157
+ tag "tankdata"
158
+
159
+ attribute :id, String
160
+ has_one :breathing_consumption_volume, Float, tag: "breathingconsumptionvolume"
161
+ has_many :links, Base::Models::Link, tag: "link"
162
+ has_one :tank_pressure_begin, Float, tag: "tankpressurebegin"
163
+ has_one :tank_pressure_end, Float, tag: "tankpressureend"
164
+ has_one :tank_volume, Float, tag: "tankvolume"
165
+ end
166
+
167
+ class Dive
168
+ include HappyMapper
169
+
170
+ tag "dive"
171
+
172
+ attribute :id, String
173
+ has_one :information_after_dive, InformationAfterDive, tag: "informationafterdive"
174
+ has_one :information_before_dive, InformationBeforeDive, tag: "informationbeforedive"
175
+ has_one :application_data, Base::Models::ApplicationDataV300, tag: "applicationdata"
176
+ has_one :samples, Samples
177
+ has_many :tank_data, TankData, tag: "tankdata"
178
+ end
179
+
180
+ class RepetitionGroup
181
+ include HappyMapper
182
+
183
+ tag "repetitiongroup"
184
+
185
+ attribute :id, String
186
+ has_many :dives, Dive, tag: "dive"
187
+ end
188
+
189
+ class ProfileData
190
+ include HappyMapper
191
+
192
+ tag "profiledata"
193
+
194
+ has_many :repetition_groups, RepetitionGroup, tag: "repetitiongroup"
195
+ end
196
+
197
+ class Descent
198
+ include HappyMapper
199
+
200
+ tag "descent"
201
+
202
+ has_many :waypoints, Waypoint, tag: "waypoint"
203
+ end
204
+
205
+ class Ascent
206
+ include HappyMapper
207
+
208
+ tag "ascent"
209
+
210
+ has_many :waypoints, Waypoint, tag: "waypoint"
211
+ end
212
+
213
+ class MixChange
214
+ include HappyMapper
215
+
216
+ tag "mixchange"
217
+
218
+ has_one :ascent, Ascent
219
+ has_one :descent, Descent
220
+ end
221
+
222
+ class InputProfile
223
+ include HappyMapper
224
+
225
+ tag "inputprofile"
226
+
227
+ has_many :links, Base::Models::Link, tag: "link"
228
+ has_many :waypoints, Waypoint, tag: "waypoint"
229
+ end
230
+
231
+ class Output
232
+ include HappyMapper
233
+
234
+ tag "output"
235
+
236
+ has_one :lingo, String
237
+ has_one :file_format, String, tag: "fileformat"
238
+ has_one :file_name, String, tag: "filename"
239
+ has_one :headline, String
240
+ has_one :remark, String
241
+ end
242
+
243
+ class Profile
244
+ include HappyMapper
245
+
246
+ tag "profile"
247
+
248
+ has_one :application_data, Base::Models::ApplicationDataV300, tag: "applicationdata"
249
+ has_one :deco_model, Base::Models::DecoModel, tag: "decomodel"
250
+ has_one :deep_stop_time, Float, tag: "deepstoptime"
251
+ has_one :density, Float
252
+ has_one :input_profile, InputProfile, tag: "inputprofile"
253
+ has_many :links, Base::Models::Link, tag: "link"
254
+ has_one :maximum_ascending_rate, Float, tag: "maximumascendingrate"
255
+ has_one :mix_change, MixChange, tag: "mixchange"
256
+ has_one :output, Output
257
+ has_one :surface_interval_after_dive, Base::Models::SurfaceIntervalAfterDive, tag: "surfaceintervalafterdive"
258
+ has_one :surface_interval_before_dive, Base::Models::SurfaceIntervalBeforeDive, tag: "surfaceintervalbeforedive"
259
+ has_one :title, String
260
+ end
261
+
262
+ class TableScope
263
+ include HappyMapper
264
+
265
+ tag "tablescope"
266
+
267
+ has_one :altitude, Float
268
+ has_one :bottom_time_maximum, Float, tag: "bottomtimemaximum"
269
+ has_one :bottom_time_minimum, Float, tag: "bottomtimeminimum"
270
+ has_one :bottom_time_step_begin, Float, tag: "bottomtimestepbegin"
271
+ has_one :bottom_time_step_end, Float, tag: "bottomtimestepend"
272
+ has_one :dive_depth_begin, Float, tag: "divedepthbegin"
273
+ has_one :dive_depth_end, Float, tag: "divedepthend"
274
+ has_one :dive_depth_step, Float, tag: "divedepthstep"
275
+ end
276
+
277
+ class Table
278
+ include HappyMapper
279
+
280
+ tag "table"
281
+
282
+ has_one :table_scope, TableScope, tag: "tablescope"
283
+ end
284
+
285
+ class CalculateProfile
286
+ include HappyMapper
287
+
288
+ tag "calculateprofile"
289
+
290
+ has_many :profiles, Profile, tag: "profile"
291
+ end
292
+
293
+ class CalculateTable
294
+ include HappyMapper
295
+
296
+ tag "calculatetable"
297
+
298
+ has_many :tables, Table, tag: "table"
299
+ end
300
+
301
+ class BottomTimeTableScope
302
+ include HappyMapper
303
+
304
+ tag "bottomtimetablescope"
305
+
306
+ has_one :breathing_consumption_volume_begin, Float, tag: "breathingconsumptionvolumebegin"
307
+ has_one :breathing_consumption_volume_end, Float, tag: "breathingconsumptionvolumeend"
308
+ has_one :breathing_consumption_volume_step, Float, tag: "breathingconsumptionvolumestep"
309
+ has_one :dive_depth_begin, Float, tag: "divedepthbegin"
310
+ has_one :dive_depth_end, Float, tag: "divedepthend"
311
+ has_one :dive_depth_step, Float, tag: "divedepthstep"
312
+ has_one :tank_pressure_begin, Float, tag: "tankpressurebegin"
313
+ has_one :tank_pressure_reserve, Float, tag: "tankpressurereserve"
314
+ has_one :tank_volume_begin, Float, tag: "tankvolumebegin"
315
+ has_one :tank_volume_end, Float, tag: "tankvolumeend"
316
+ end
317
+
318
+ class BottomTimeTable
319
+ include HappyMapper
320
+
321
+ tag "bottomtimetable"
322
+
323
+ attribute :id, String
324
+ has_one :application_data, Base::Models::ApplicationDataV300, tag: "applicationdata"
325
+ has_one :bottom_time_table_scope, BottomTimeTableScope, tag: "bottomtimetablescope"
326
+ has_many :links, Base::Models::Link, tag: "link"
327
+ has_one :output, Output
328
+ has_one :title, String
329
+ end
330
+
331
+ class CalculateBottomTimeTable
332
+ include HappyMapper
333
+
334
+ tag "calculatebottomtimetable"
335
+
336
+ has_many :bottom_time_tables, BottomTimeTable, tag: "bottomtimetable"
337
+ end
338
+
339
+ class TableGeneration
340
+ include HappyMapper
341
+
342
+ tag "tablegeneration"
343
+
344
+ has_one :calculate_bottom_time_table, CalculateBottomTimeTable, tag: "calculatebottomtimetable"
345
+ has_one :calculate_profile, CalculateProfile, tag: "calculateprofile"
346
+ has_one :calculate_table, CalculateTable, tag: "calculatetable"
347
+ end
348
+
349
+ class EquipmentPart
350
+ include HappyMapper
351
+
352
+ tag "equipmentpart"
353
+
354
+ attribute :id, String
355
+ has_many :alias_names, String, tag: "aliasname"
356
+ has_one :manufacturer, Base::Models::Manufacturer
357
+ has_one :model, String
358
+ has_one :name, String
359
+ has_one :next_service_date, Base::Models::DateTimeField, tag: "nextservicedate"
360
+ has_one :notes, Base::Models::Notes
361
+ has_one :purchase, Base::Models::Purchase
362
+ has_one :serial_number, String, tag: "serialnumber"
363
+ has_one :service_interval, Integer, tag: "serviceinterval"
364
+ end
365
+
366
+ class Lead < EquipmentPart
367
+ include HappyMapper
368
+
369
+ tag "lead"
370
+
371
+ has_one :lead_quantity, Integer, tag: "leadquantity"
372
+ end
373
+
374
+ class Rebreather < EquipmentPart
375
+ include HappyMapper
376
+
377
+ tag "rebreather"
378
+ end
379
+
380
+ class Suit < EquipmentPart
381
+ include HappyMapper
382
+
383
+ tag "suit"
384
+
385
+ has_one :suit_type, String, tag: "suittype"
386
+ end
387
+
388
+ class Tank < EquipmentPart
389
+ include HappyMapper
390
+
391
+ tag "tank"
392
+
393
+ has_one :tank_material, String, tag: "tankmaterial"
394
+ has_one :tank_volume, Float, tag: "tankvolume"
395
+ end
396
+
397
+ class Camera
398
+ include HappyMapper
399
+
400
+ tag "camera"
401
+
402
+ has_one :body, EquipmentPart
403
+ has_many :flashes, EquipmentPart, tag: "flash"
404
+ has_one :housing, EquipmentPart
405
+ has_one :lens, EquipmentPart
406
+ end
407
+
408
+ class EquipmentContent
409
+ include HappyMapper
410
+
411
+ has_many :boots, EquipmentPart, tag: "boots"
412
+ has_many :buoyancy_control_devices, EquipmentPart, tag: "buoyancycontroldevice"
413
+ has_many :cameras, Camera, tag: "camera"
414
+ has_many :compasses, EquipmentPart, tag: "compass"
415
+ has_many :dive_computers, EquipmentPart, tag: "divecomputer"
416
+ has_many :fins, EquipmentPart, tag: "fins"
417
+ has_many :gloves, EquipmentPart, tag: "gloves"
418
+ has_many :knives, EquipmentPart, tag: "knife"
419
+ has_many :leads, Lead, tag: "lead"
420
+ has_many :lights, EquipmentPart, tag: "light"
421
+ has_many :masks, EquipmentPart, tag: "mask"
422
+ has_many :rebreathers, Rebreather, tag: "rebreather"
423
+ has_many :regulators, EquipmentPart, tag: "regulator"
424
+ has_many :scooters, EquipmentPart, tag: "scooter"
425
+ has_many :suits, Suit, tag: "suit"
426
+ has_many :tanks, Tank, tag: "tank"
427
+ has_many :various_pieces, EquipmentPart, tag: "variouspieces"
428
+ has_many :video_cameras, EquipmentPart, tag: "videocamera"
429
+ has_many :watches, EquipmentPart, tag: "watch"
430
+ end
431
+
432
+ class EquipmentConfiguration < EquipmentContent
433
+ include HappyMapper
434
+
435
+ tag "equipmentconfiguration"
436
+
437
+ has_many :alias_names, String, tag: "aliasname"
438
+ has_many :links, Base::Models::Link, tag: "link"
439
+ has_one :name, String
440
+ has_one :notes, Base::Models::Notes
441
+ end
442
+
443
+ class Equipment < EquipmentContent
444
+ include HappyMapper
445
+
446
+ tag "equipment"
447
+
448
+ has_many :compressors, EquipmentPart, tag: "compressor"
449
+ has_one :equipment_configuration, EquipmentConfiguration, tag: "equipmentconfiguration"
450
+ end
451
+
452
+ class BuddyOwnerShared
453
+ include HappyMapper
454
+
455
+ attribute :id, String
456
+ has_one :address, Base::Models::Address
457
+ has_one :contact, Base::Models::Contact
458
+ has_one :dive_insurances, Base::Models::DiveInsurances, tag: "diveinsurances"
459
+ has_one :dive_permissions, Base::Models::DivePermissions, tag: "divepermissions"
460
+ has_one :equipment, Equipment
461
+ has_one :medical, Base::Models::Medical
462
+ has_one :notes, Base::Models::Notes
463
+ has_one :personal, Base::Models::Personal
464
+ end
465
+
466
+ class Buddy < BuddyOwnerShared
467
+ include HappyMapper
468
+
469
+ tag "buddy"
470
+
471
+ attribute :id, String
472
+ has_one :certification, Base::Models::Certification
473
+ has_one :student, String
474
+ end
475
+
476
+ class Owner < BuddyOwnerShared
477
+ include HappyMapper
478
+
479
+ tag "owner"
480
+
481
+ attribute :id, String
482
+ has_one :education, Base::Models::Education
483
+ end
484
+
485
+ class Diver
486
+ include HappyMapper
487
+
488
+ tag "diver"
489
+
490
+ has_many :buddies, Buddy, tag: "buddy"
491
+ has_one :owner, Owner
492
+ end
493
+
494
+ class Uddf
495
+ include HappyMapper
496
+
497
+ tag "uddf"
498
+
499
+ attribute :version, String
500
+ has_one :dive_computer_control, Base::Models::DiveComputerControlV300, tag: "divecomputercontrol"
501
+ has_one :diver, Diver
502
+ has_one :dive_site, Base::Models::DiveSite, tag: "divesite"
503
+ has_one :dive_trip, Base::Models::DiveTrip, tag: "divetrip"
504
+ has_one :gas_definitions, Base::Models::GasDefinitions, tag: "gasdefinitions"
505
+ has_one :generator, Base::Models::Generator
506
+ has_one :media_data, Base::Models::MediaData, tag: "mediadata"
507
+ has_one :profile_data, ProfileData, tag: "profiledata"
508
+ has_one :table_generation, TableGeneration, tag: "tablegeneration"
509
+ end
510
+ end
511
+ end
512
+ end