dina 0.8.1.0 → 0.8.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c6ae5abbf48a7b17f398ef9b7847f4e2a971f1819669c0202147a085cd20268
4
- data.tar.gz: e59a3c1ab3548dba76c6294dcc7536b9c8644be776123b367c1484b7a5981122
3
+ metadata.gz: 194f73d318f76f43a6e65426a47fb0ad5192de5c007660633bdd9f8fb9f86ecd
4
+ data.tar.gz: 2aba2864327b88821e62865d469844bbbff6b9e9f5b440c77b0698e67605c82f
5
5
  SHA512:
6
- metadata.gz: c4693d5abe72117aa16129a3f436ea7548537371446e6bc2ed335ddf03f4e2890816ffcf7093c02a481ec436b50c1d13203a1794d7ea119d59014488b33871c2
7
- data.tar.gz: bfea8c578a6afdf3f30ea7857f1ebaafff6168a0952a47c0d6a8ab8c4c316eb1e05ce821a1cc66d6728016e85c99811b91c420817a34ec43996e9214506ff290
6
+ metadata.gz: 2a906a03f0288fba3f9194ad1274eacd9abedf1abd0bd4fc1f1c39b46268f52cff94fbd2f2ca1a0d936f677088d3b9f3e78466a725ad2e1976035334fcc605a8
7
+ data.tar.gz: 4d869369dd2ec0a2a3607d1a1159b94b54ea802fc8336bfc9689ead30f705bf54ab54ce1a5b2c476985ca9f363c5791383769e251a03afacfb817839744f8ee0
@@ -3,6 +3,7 @@ module Dina
3
3
  include JsonApiClient::Helpers::Callbacks
4
4
 
5
5
  self.raise_on_blank_find_param = true
6
+ self.add_defaults_to_changes = true
6
7
  self.json_key_format = :camelized_key
7
8
  self.paginator = JsonApiClient::Paginating::NestedParamPaginator
8
9
 
@@ -54,11 +55,15 @@ module Dina
54
55
  end
55
56
 
56
57
  def on_before_create
57
- self.attributes.delete_if { |k, v| v.nil? || v == "" }
58
+ self.attributes.delete_if { |k, v| v.nil? || v == "" || ((v.is_a?(Array) || v.is_a?(Hash)) && v.empty?) }
58
59
  self.attributes = self.attributes.deep_symbolize_keys
59
60
  end
60
61
 
61
62
  def on_before_save
63
+ unknown_attributes = self.attributes.symbolize_keys.keys - self.class.properties.keys - [:type]
64
+ if unknown_attributes.size > 0
65
+ raise ObjectInvalid, "#{self.class} is invalid. #{unknown_attributes.join(", ")} are not accepted properties."
66
+ end
62
67
  if !self.valid?
63
68
  raise ObjectInvalid, "#{self.class} is invalid. #{self.errors.map(&:message).join("; ")}"
64
69
  end
@@ -36,7 +36,7 @@ module Dina
36
36
  property :tags, type: :array, default: []
37
37
  property :geographicPlaceNameSource, type: :string
38
38
  property :geographicPlaceNameSourceDetail, type: :object, default: {}
39
- property :managedAttributes, type: :array, default: []
39
+ property :managedAttributes, type: :object
40
40
  property :geoReferenceAssertions, type: :array, default: []
41
41
  property :eventGeom, type: :string
42
42
  property :extensionValues, type: :array, default: []
@@ -68,9 +68,6 @@ module Dina
68
68
  if self.geographicPlaceNameSource.nil?
69
69
  self.geographicPlaceNameSourceDetail = nil
70
70
  end
71
- if !self.geoReferenceAssertions.empty? && self.geoReferenceAssertions[0][:dwcDecimalLatitude].nil?
72
- self.geoReferenceAssertions = nil
73
- end
74
71
  super
75
72
  end
76
73
 
data/lib/dina/version.rb CHANGED
@@ -3,7 +3,7 @@ module Dina
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 8
6
- PATCH = 1
6
+ PATCH = 3
7
7
  BUILD = 0
8
8
 
9
9
  def self.version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dina
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1.0
4
+ version: 0.8.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David P. Shorthouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-16 00:00:00.000000000 Z
11
+ date: 2023-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_api_client