paquito 0.6.1 → 0.6.2

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: d4a21000dd182ebc6975d8b6cbedf9702bb8e8b1590e5be3c6a048e2f827c54c
4
- data.tar.gz: 6023594f29fbabdec9842ca1ea0d3a75c2f22a9bd519cbdab153dff75781a8cf
3
+ metadata.gz: 4cafb8418a35a2c05c91af1a49f3deb2a025b0f1d68ae7ca3ac21c6e0b81b79a
4
+ data.tar.gz: 59f193750cd85c9f6664547f01665866af0f17ee43b371e89cee21d999aadf20
5
5
  SHA512:
6
- metadata.gz: 75ca51f0d7da3dc94b3b26454eeb7960af10102963f9d8d9dca8f2d1b260821e57f831ab7c95cb290fbf842f4473e8aa5d0d2fb2a150dc09d6e847ef4b45d1ba
7
- data.tar.gz: 1d4b953529569f25bd8d345a0a968ed931ad23ea397f96b6e0e5ba10376c3a5e6cb2078230355fee37c65c50f829d4b32136ba2a8a9ccc4d616076c84e6a3c97
6
+ metadata.gz: 2b04f0da342fc419646fdc20f147f1aa05bd357c1a42cec8802739fc6bd7858b5deabfeef9a1e1542e1edc68bf4a0807acbe7a306da55786b2a861c31046a198
7
+ data.tar.gz: 8f2eb1d10755847d5a2a6d15fd5a67304d671f35805ed1b97123c0a981cf77eabebe2f0a8daeee438d09fd25e0bd7a59ecf34c132892823aff84274a64fac70a
@@ -9,7 +9,7 @@ jobs:
9
9
  fail-fast: false
10
10
  steps:
11
11
  - name: Checkout
12
- uses: actions/checkout@v2
12
+ uses: actions/checkout@v3
13
13
  - name: Set up Ruby
14
14
  uses: ruby/setup-ruby@v1
15
15
  with:
@@ -26,7 +26,7 @@ jobs:
26
26
  ruby: [ ruby-head, '3.0', '2.7', '2.6' ]
27
27
  steps:
28
28
  - name: Checkout
29
- uses: actions/checkout@v2
29
+ uses: actions/checkout@v3
30
30
  - name: Set up Ruby
31
31
  uses: ruby/setup-ruby@v1
32
32
  with:
data/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
1
+ # Unreleased
2
+
3
+ # 0.6.2
4
+
5
+ * Make ActiveRecordCoder handle to read payloads that will be generated by Paquito 0.7.0 (#12).
6
+ DO NOT upgrade to Paquito 0.7.0+ without first fully rolling out Paquito 0.6.2.
7
+
8
+ # 0.6.1
9
+
10
+ * No data
11
+
12
+ # 0.6.0
13
+
14
+ * No data
15
+
16
+ # 0.5.0
17
+
18
+ * No data
19
+
20
+ # 0.4.0
21
+
22
+ * No data
23
+
24
+ # 0.3.1
25
+
26
+ * No data
27
+
28
+ # 0.3.0
29
+
30
+ * No data
31
+
32
+ # 0.2.1
33
+
34
+ * No data
35
+
36
+ # 0.2.0
37
+
38
+ * No data
39
+
40
+ # 0.1.0
41
+
42
+ * No data
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paquito (0.6.1)
4
+ paquito (0.6.2)
5
5
  msgpack (>= 1.5.2)
6
6
 
7
7
  GEM
@@ -25,7 +25,7 @@ GEM
25
25
  i18n (1.10.0)
26
26
  concurrent-ruby (~> 1.0)
27
27
  minitest (5.15.0)
28
- msgpack (1.5.2)
28
+ msgpack (1.5.4)
29
29
  parallel (1.21.0)
30
30
  parser (3.1.1.0)
31
31
  ast (~> 2.4.1)
@@ -4,6 +4,8 @@ require "paquito/errors"
4
4
 
5
5
  module Paquito
6
6
  class ActiveRecordCoder
7
+ EMPTY_HASH = {}.freeze
8
+
7
9
  class << self
8
10
  def dump(record)
9
11
  instances = InstanceTracker.new
@@ -94,13 +96,17 @@ module Paquito
94
96
  attributes
95
97
  end
96
98
 
97
- def deserialize_record(class_name, attributes_from_database)
99
+ def deserialize_record(class_name, attributes_from_database, new_record = false)
98
100
  begin
99
101
  klass = Object.const_get(class_name)
100
102
  rescue NameError
101
103
  raise ClassMissingError, "undefined class: #{class_name}"
102
104
  end
103
- klass.instantiate(attributes_from_database)
105
+
106
+ # Ideally we'd like to call `klass.instantiate`, however it doesn't allow to pass
107
+ # wether the record was persisted or not.
108
+ attributes = klass.attributes_builder.build_from_database(attributes_from_database, EMPTY_HASH)
109
+ klass.allocate.init_with_attributes(attributes, new_record)
104
110
  end
105
111
  end
106
112
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paquito
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paquito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-31 00:00:00.000000000 Z
11
+ date: 2022-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -34,6 +34,7 @@ files:
34
34
  - ".github/workflows/ci.yml"
35
35
  - ".gitignore"
36
36
  - ".rubocop.yml"
37
+ - CHANGELOG.md
37
38
  - Gemfile
38
39
  - Gemfile.lock
39
40
  - LICENSE.txt
@@ -85,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  - !ruby/object:Gem::Version
86
87
  version: '0'
87
88
  requirements: []
88
- rubygems_version: 3.2.20
89
+ rubygems_version: 3.3.3
89
90
  signing_key:
90
91
  specification_version: 4
91
92
  summary: Framework for defining efficient and extendable serializers