contentful 2.15.0 → 2.15.1

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: '09f8c373dc24453c4566564a0ac34244df2af9bb9eaf123daa91b514f6a0bf14'
4
- data.tar.gz: a99d41fd2698f8dec1536822198fc661a248bc6eacd04c2f7dde555a22dd647d
3
+ metadata.gz: c8c85b0c13bf08766561d80cf44766dc7c3d52d6cd230bbd33df53bee3347293
4
+ data.tar.gz: 3a652af950c5af6dc28c2c7d1962d64e067bc46b927aec8817ed9feb0561d187
5
5
  SHA512:
6
- metadata.gz: bfe5899e858df982b9d1eeb475729503513d1b18e7315c3f93d35167c19512c301047f3bba4d0cabc37223bc1b06c64c34c70e7720a64ad4283e19616759cfcf
7
- data.tar.gz: f06391fb774add42ea406736f5115d1e0ebf1a08b3ed1c4454640f5b4b240c9a919132170448d0449058b3d11f3d8ab161338d3801385b7e408c30d3e702e1ba
6
+ metadata.gz: 2680b3032848974c5e186f11a413ccd67c3bf84cad1d6905ab23128f2d1df3f21baa0fcf8b9600b37412a92f7b0f20b67e797f6a0bc5135dd31761e292afef8e
7
+ data.tar.gz: 03304dfea1de0c7467e465cf71b87fd091bd2556ad3d0b11cd1766f04925726e19fbc33288a26e9c8bbbc2dca083e11ba958a3222bfd29f9b57ae9748f969271
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.15.1
6
+ ### Fixed
7
+ * Fixed how `entry_mapping` is cached in order to avoid errors when deserializing resources that have been serialized with previously deleted mapping classes. [#212](https://github.com/contentful/contentful.rb/issues/212)
8
+
5
9
  ## 2.15.0
6
10
  ### Added
7
11
  * Added the capability for `Array#next_page` to support carry-over of query parameters.
@@ -10,10 +10,7 @@ module Contentful
10
10
 
11
11
  # @private
12
12
  def marshal_dump
13
- {
14
- configuration: @configuration,
15
- raw: raw
16
- }
13
+ super.merge(raw: raw)
17
14
  end
18
15
 
19
16
  # @private
@@ -23,6 +20,11 @@ module Contentful
23
20
  define_asset_methods!
24
21
  end
25
22
 
23
+ # @private
24
+ def known_link?(*)
25
+ false
26
+ end
27
+
26
28
  # @private
27
29
  def inspect
28
30
  "<#{repr_name} id='#{sys[:id]}' url='#{url}'>"
@@ -31,14 +31,27 @@ module Contentful
31
31
 
32
32
  # @private
33
33
  def marshal_dump
34
+ entry_mapping = @configuration[:entry_mapping].each_with_object({}) do |(k, v), res|
35
+ res[k] = v.to_s
36
+ end
37
+
34
38
  {
35
- configuration: @configuration,
39
+ configuration: @configuration.merge(entry_mapping: entry_mapping),
36
40
  raw: raw
37
41
  }
38
42
  end
39
43
 
40
44
  # @private
41
45
  def marshal_load(raw_object)
46
+ raw_object[:configuration][:entry_mapping] = raw_object[:configuration].fetch(:entry_mapping, {}).each_with_object({}) do |(k, v), res|
47
+ begin
48
+ v = v.to_s unless v.is_a?(::String)
49
+ res[k] = v.split('::').inject(Object) { |o, c| o.const_get c }
50
+ rescue
51
+ next
52
+ end
53
+ end
54
+
42
55
  @raw = raw_object[:raw]
43
56
  @configuration = raw_object[:configuration]
44
57
  @default_locale = @configuration[:default_locale]
@@ -48,11 +48,7 @@ module Contentful
48
48
 
49
49
  # @private
50
50
  def marshal_dump
51
- {
52
- configuration: @configuration,
53
- raw: raw_with_links,
54
- localized: localized
55
- }
51
+ super.merge(raw: raw_with_links, localized: localized)
56
52
  end
57
53
 
58
54
  # @private
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.15.0'
4
+ VERSION = '2.15.1'
5
5
  end
@@ -160,6 +160,7 @@ describe Contentful::Entry do
160
160
  describe 'can be marshalled' do
161
161
  def test_dump(nyancat)
162
162
  dump = Marshal.dump(nyancat)
163
+ yield if block_given?
163
164
  new_cat = Marshal.load(dump)
164
165
 
165
166
  # Attributes
@@ -184,6 +185,14 @@ describe Contentful::Entry do
184
185
  expect(new_cat.image.file.url).to eq "//images.contentful.com/cfexampleapi/4gp6taAwW4CmSgumq2ekUm/9da0cd1936871b8d72343e895a00d611/Nyan_cat_250px_frame.png"
185
186
  end
186
187
 
188
+ it 'marshals properly when entry_mapping changed' do
189
+ vcr('entry/marshall') {
190
+ class TestEntryMapping; end
191
+ nyancat = create_client(gzip_encoded: false, max_include_resolution_depth: 2, entry_mapping: { 'irrelevant_model' => TestEntryMapping }).entries(include: 2, 'sys.id' => 'nyancat').first
192
+ test_dump(nyancat) { Object.send(:remove_const, :TestEntryMapping) }
193
+ }
194
+ end
195
+
187
196
  it 'marshals properly' do
188
197
  vcr('entry/marshall') {
189
198
  nyancat = create_client(gzip_encoded: false, max_include_resolution_depth: 2).entries(include: 2, 'sys.id' => 'nyancat').first
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.0
4
+ version: 2.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (Jan Lelis)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-11-15 00:00:00.000000000 Z
13
+ date: 2019-11-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http