dina 3.2.4.0 → 3.3.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eea9336b00c838a2be0237867e77e6eb9dd9e435bc79d59ab50ee77ec6f4987b
4
- data.tar.gz: 6fec0c850001711a8d2dde7ea1b454b44feb7659c8cabbc2b944bcb510283f1b
3
+ metadata.gz: 4088094ab4899f78647b11b7b0da9d979eb222984e2f2f1b2b678f08e98e04c0
4
+ data.tar.gz: a5e772cac4cf7cd3075f05e88df710bd46a9c64a123fd97d7defae84af8b93be
5
5
  SHA512:
6
- metadata.gz: 69b3299bbc31dadd6acca040cf8c27bda7f0368909575c8da26c9c76e925ecae4a42b972a6e0f14f747b70cef1a76f42f12cb5d74f21ec0225343ae5ee0832a9
7
- data.tar.gz: b6e5d5e1534a82a6c3b1d91ce9d988e56e82d9e8be13d813cafe3efb70ff2ae4965ebc2b1cc169f0cdd33c10b3eb4f7e39ba98bb75418ba9be991a54cbf769a9
6
+ metadata.gz: 579c66634326646ebd0e31c74efedab223213dc3e7afe467774aaf1b73f910004281915a88db541533b63d3e3564201fb42939ac8036b0b32c3f4523b07602fd
7
+ data.tar.gz: 0ab584ad3816634c6d37fa23508ec8bec544349e63358566cb14d20b4ad6b7fc7513f03a1cf7339a64428260e3d81f2bd592647c22e8404437ee2af5bb862d93
@@ -0,0 +1,23 @@
1
+ module Dina
2
+ class Geospatial
3
+ attr_accessor :type
4
+ attr_accessor :coordinates
5
+
6
+ def initialize(opts = {})
7
+ @type = ""
8
+ @coordinates = []
9
+ if opts[:type]
10
+ @type = opts[:type]
11
+ end
12
+ if opts[:coordinates]
13
+ @coordinates = opts[:coordinates]
14
+ end
15
+ end
16
+
17
+ def to_hash
18
+ hash = {}
19
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
20
+ hash
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ require_relative 'geospatial'
2
+
3
+ module Dina
4
+ class GeospatialCaster
5
+ def self.cast(value, default)
6
+ begin
7
+ Geospatial.new(value).to_hash
8
+ rescue ArgumentError
9
+ { type: "", coordinates: [] }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -46,6 +46,8 @@ module Dina
46
46
 
47
47
  has_one :protocol, class_name: "Protocol"
48
48
  has_one :collectionMethod, class_name: "CollectionMethod"
49
+ has_one :expedition, class_name: "Expedition"
50
+ has_one :site, class_name: "Site"
49
51
  has_many :collectors, class_name: "Person"
50
52
  has_many :attachment, class_name: "Attachment"
51
53
 
@@ -0,0 +1,28 @@
1
+ require_rel '../base_model'
2
+
3
+ module Dina
4
+ class Expedition < BaseModel
5
+ property :id, type: :string, default: SecureRandom.uuid_v7
6
+ property :group, type: :string
7
+ property :name, type: :string
8
+ property :multilingualDescription, type: :multilingual_description
9
+ property :startDate, type: :date
10
+ property :endDate, type: :date
11
+ property :geographicContext, type: :string
12
+ property :createdBy, type: :string
13
+ property :createdOn, type: :time
14
+
15
+ has_many :participants, class_name: "Person"
16
+
17
+ validates_presence_of :group, message: "group is required"
18
+
19
+ def self.endpoint_path
20
+ "collection-api/"
21
+ end
22
+
23
+ def self.table_name
24
+ "expedition"
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+
2
+ module Dina
3
+ class Site < BaseModel
4
+ property :id, type: :string, default: SecureRandom.uuid_v7
5
+ property :group, type: :string
6
+ property :code, type: :string
7
+ property :multilingualDescription, type: :multilingual_description
8
+ property :siteGeom, type: :geospatial
9
+ property :createdBy, type: :string
10
+ property :createdOn, type: :time
11
+
12
+ has_many :attachment, class_name: "Attachment"
13
+
14
+ validates_presence_of :group, message: "group is required"
15
+
16
+ def self.endpoint_path
17
+ "collection-api/"
18
+ end
19
+
20
+ def self.table_name
21
+ "site"
22
+ end
23
+
24
+ end
25
+ end
data/lib/dina/version.rb CHANGED
@@ -2,8 +2,8 @@ module Dina
2
2
  class Version
3
3
 
4
4
  MAJOR = 3
5
- MINOR = 2
6
- PATCH = 4
5
+ MINOR = 3
6
+ PATCH = 0
7
7
  BUILD = 0
8
8
 
9
9
  def self.version
data/lib/dina.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "keycloak"
2
+ require "ostruct"
2
3
  require "json_api_client"
3
4
  require "time"
4
5
  require "date"
@@ -14,6 +15,7 @@ module Dina
14
15
  JsonApiClient::Schema.register array: ArrayCaster,
15
16
  hash: HashCaster,
16
17
  date: DateCaster,
18
+ geospatial: Geospatial,
17
19
  multilingual_title: MultilingualTitleCaster,
18
20
  multilingual_description: MultilingualDescriptionCaster
19
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dina
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.4.0
4
+ version: 3.3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David P. Shorthouse
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-04-28 00:00:00.000000000 Z
12
+ date: 2026-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json_api_client
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 3.2.1
34
+ version: '3.3'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 3.2.1
41
+ version: '3.3'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: securerandom
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -147,6 +147,8 @@ files:
147
147
  - lib/dina/authentication/authentication.rb
148
148
  - lib/dina/casters/array_caster.rb
149
149
  - lib/dina/casters/date_caster.rb
150
+ - lib/dina/casters/geospatial.rb
151
+ - lib/dina/casters/geospatial_caster.rb
150
152
  - lib/dina/casters/hash_caster.rb
151
153
  - lib/dina/casters/multilingual_description.rb
152
154
  - lib/dina/casters/multilingual_description_caster.rb
@@ -179,12 +181,14 @@ files:
179
181
  - lib/dina/models/material_sample/collection.rb
180
182
  - lib/dina/models/material_sample/collection_method.rb
181
183
  - lib/dina/models/material_sample/collection_sequence_generator.rb
184
+ - lib/dina/models/material_sample/expedition.rb
182
185
  - lib/dina/models/material_sample/material_sample.rb
183
186
  - lib/dina/models/material_sample/organism.rb
184
187
  - lib/dina/models/material_sample/preparation_method.rb
185
188
  - lib/dina/models/material_sample/preparation_type.rb
186
189
  - lib/dina/models/material_sample/project.rb
187
190
  - lib/dina/models/material_sample/protocol.rb
191
+ - lib/dina/models/material_sample/site.rb
188
192
  - lib/dina/models/object_store/derivative.rb
189
193
  - lib/dina/models/object_store/file.rb
190
194
  - lib/dina/models/object_store/file_connection.rb