foobara 0.0.31 → 0.0.32

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: 8d39eaab1139573fba75d906c51de6091e81d77a1af812f60262bca2ff2064ab
4
- data.tar.gz: da9a2b06e850ac495edc2f06a79969b75896b2c28134c91e724bca4c13397182
3
+ metadata.gz: c792e842511e06c18b7104b2d417b4ba93275266f94257207176f9c6eed4265f
4
+ data.tar.gz: 4ce865c5dd74d839710bdb4a766e47e645ab07e4a484cf32ede9ed839e3d75a9
5
5
  SHA512:
6
- metadata.gz: ce7d43c817996c3301bdbc332875d7bd73dad8f29c64f12c7c070d89cc95a88974cd05bb84aa9f94bb7af2d9181f16e3a4cace92f04d8233486c12b8a25876ca
7
- data.tar.gz: 6b6f82a0620e369c2a071f0e3ff33b648243abba31b3e0dc8c59c824a4f10d771add1f7bfbd6f802b4d7ce6a7536fc1f87f77ec9bba052f920229593e10418e2
6
+ metadata.gz: 5d0d59e0a8bd59703873c845a06a9afb756c8326700f8858eeeff476cde1ad3b20386037008211db6878727eb6585d9d7cd4b8e4892e784d65028c9d19060db1
7
+ data.tar.gz: a45f976f9a90d78a1f6e4ae2077da4846565a89c2092a0cf7da92ab068dda6ef25b2ec1f8700824ff29c3dc58b53f4ebc0bdf35984b865c6cb91c63136327204
data/CHANGELOG.md CHANGED
@@ -1,6 +1,7 @@
1
- ## [0.0.31] - 2024-12-09
1
+ ## [0.0.32] - 2024-12-09
2
2
 
3
3
  - Introduce a DetachedEntity concept that sits between Model and Entity
4
+ - Add a detached_to_primary_key flag to EntitiesToPrimaryKeysSerializer
4
5
 
5
6
  ## [0.0.30] - 2024-12-07
6
7
 
@@ -6,17 +6,21 @@ module Foobara
6
6
  class EntitiesToPrimaryKeysSerializer < SuccessSerializer
7
7
  def serialize(object)
8
8
  case object
9
- # What of DetachedEntity? I guess we should treat it as a model since we can't cast from primary key value to
10
- # a record?
11
9
  when Entity
12
10
  # TODO: handle polymorphism? Would require iterating over the result type not the object!
13
11
  # Is there maybe prior art for this in the associations stuff?
14
12
  object.primary_key
13
+ when DetachedEntity
14
+ if declaration_data[:detached_to_primary_key]
15
+ object.primary_key
16
+ else
17
+ object.attributes
18
+ end
15
19
  when Model
16
20
  object.attributes
17
- when Array
21
+ when ::Array
18
22
  object.map { |element| serialize(element) }
19
- when Hash
23
+ when ::Hash
20
24
  object.to_h do |key, value|
21
25
  [serialize(key), serialize(value)]
22
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.31
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-09 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foobara-util