dina 0.8.2.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: 1de8a2d9179ef015fbf0d67a7fd7d2defb3787bb124718d9b7b4acabe923dd44
4
- data.tar.gz: 44e313d85c722242bf4783ef51eeb9816be8a8ed0dc2a4a29cb1aba88b870d74
3
+ metadata.gz: 194f73d318f76f43a6e65426a47fb0ad5192de5c007660633bdd9f8fb9f86ecd
4
+ data.tar.gz: 2aba2864327b88821e62865d469844bbbff6b9e9f5b440c77b0698e67605c82f
5
5
  SHA512:
6
- metadata.gz: 9b8946d1767c07785a7eb65cf09f961ef144b701b7c7319a96306daace38707ab314dfd29cb72eee43baacf8097b95c75d609e46bf50a06b896ae271fb8192ce
7
- data.tar.gz: 65d40006b3bc2035050d9b0cea13b4114794d3279ceeffe2b6b29f8e15499e2e112b4e5e9080b2d56b86b509c365eba8423e0dfd28accd98cbe174a55cf4b711
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
data/lib/dina/version.rb CHANGED
@@ -3,7 +3,7 @@ module Dina
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 8
6
- PATCH = 2
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.2.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-17 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