dina 1.0.6.0 → 1.0.7.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: 4064ad0573e136cd9689cdaad722614941511d0b1500ce2dfc19d74ff3da3ee2
4
- data.tar.gz: 6c4b607e887e95c373be9641d54d0c4af81283189c1571d6bb9f43665c149347
3
+ metadata.gz: 761a480e5d017a1d0d4600cad5adbcb6a0461ca78750a588edb0082676ba6621
4
+ data.tar.gz: f049320abf3e40cf1fdc0a8fa3b600687cd57980c7fade955672d66767d0189f
5
5
  SHA512:
6
- metadata.gz: 311f7c9495cd53b3f1ceae8fa574716b4176bbb98a7d58c3d972ccb117f7f5f568995855f4ee05d4211391ddc4a8ca1f7ee8520dd0d4812a62d47545336a78ad
7
- data.tar.gz: cfc8f399764083a03997839dba46858ba36f9ae86f3ea12684424a6064be58ac9fbe42bd796f1d5032e62f56531a00d9b20756b741837c544d85e0071a832601
6
+ metadata.gz: 245a9196b2a2b2e243d505007ad8e57dacf1db31695d8c1cfdb40b7e0c7565409147eab25ef87bff0004bf1b4b7f93b6234061e2b3348e83695a3f8f50fb7024
7
+ data.tar.gz: d3d5e3aabe72117b5b3235ca6a28ed6829991945ff161e5ae78c60a8b7f56a81e2444903445f084afb35bfc37c159ed19d3fcdc813e648601ee65f3f6cb03919
@@ -21,7 +21,7 @@ module Dina
21
21
  Dina.config.endpoint_url + "/" + endpoint_path
22
22
  end
23
23
 
24
- # injects keybloak bearer token with all json_api_client calls
24
+ # injects keycloak bearer token with all json_api_client calls
25
25
  def self.custom_headers
26
26
  { content_type: "application/vnd.api+json", authorization: Dina.header }
27
27
  end
@@ -70,6 +70,18 @@ module Dina
70
70
  if self.geographicPlaceNameSource.nil?
71
71
  self.geographicPlaceNameSourceDetail = nil
72
72
  end
73
+ if self.dwcMinimumDepthInMeters && !Validator.valid_depth_elevation(value: self.dwcMinimumDepthInMeters)
74
+ raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for dwcMinimumDepthInMeters must have no more than two decimal points and be less than or equal to 15000."
75
+ end
76
+ if self.dwcMaximumDepthInMeters && !Validator.valid_depth_elevation(value: self.dwcMaximumDepthInMeters)
77
+ raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for dwcMaximumDepthInMeters must have no more than two decimal points and be less than or equal to 15000."
78
+ end
79
+ if self.dwcMinimumElevationInMeters && !Validator.valid_depth_elevation(value: self.dwcMinimumElevationInMeters)
80
+ raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for dwcMinimumElevationInMeters must have no more than two decimal points and be less than or equal to 15000."
81
+ end
82
+ if self.dwcMaximumElevationInMeters && !Validator.valid_depth_elevation(value: self.dwcMaximumElevationInMeters)
83
+ raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for dwcMaximumElevationInMeters must have no more than two decimal points and be less than or equal to 15000."
84
+ end
73
85
  super
74
86
  end
75
87
 
@@ -0,0 +1,9 @@
1
+ module Dina
2
+ class Validator
3
+
4
+ def self.valid_depth_elevation(value:)
5
+ value >= 0 && value <= 15000 && value.to_s.split('.').last.size <= 2
6
+ end
7
+
8
+ end
9
+ end
data/lib/dina/version.rb CHANGED
@@ -3,7 +3,7 @@ module Dina
3
3
 
4
4
  MAJOR = 1
5
5
  MINOR = 0
6
- PATCH = 6
6
+ PATCH = 7
7
7
  BUILD = 0
8
8
 
9
9
  def self.version
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dina
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6.0
4
+ version: 1.0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David P. Shorthouse
8
+ - Julia Douglas Freitas
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2023-06-21 00:00:00.000000000 Z
12
+ date: 2023-08-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: json_api_client
@@ -207,6 +208,7 @@ files:
207
208
  - lib/dina/utils/identifier_type.rb
208
209
  - lib/dina/utils/multi_lingual_description.rb
209
210
  - lib/dina/utils/multi_lingual_title.rb
211
+ - lib/dina/utils/validator.rb
210
212
  - lib/dina/version.rb
211
213
  homepage: https://github.com/dshorthouse/dina
212
214
  licenses: