contentful 2.15.0 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/contentful/asset.rb +6 -4
- data/lib/contentful/base_resource.rb +14 -1
- data/lib/contentful/fields_resource.rb +1 -5
- data/lib/contentful/version.rb +1 -1
- data/spec/entry_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8c85b0c13bf08766561d80cf44766dc7c3d52d6cd230bbd33df53bee3347293
|
4
|
+
data.tar.gz: 3a652af950c5af6dc28c2c7d1962d64e067bc46b927aec8817ed9feb0561d187
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2680b3032848974c5e186f11a413ccd67c3bf84cad1d6905ab23128f2d1df3f21baa0fcf8b9600b37412a92f7b0f20b67e797f6a0bc5135dd31761e292afef8e
|
7
|
+
data.tar.gz: 03304dfea1de0c7467e465cf71b87fd091bd2556ad3d0b11cd1766f04925726e19fbc33288a26e9c8bbbc2dca083e11ba958a3222bfd29f9b57ae9748f969271
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
data/lib/contentful/asset.rb
CHANGED
@@ -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]
|
data/lib/contentful/version.rb
CHANGED
data/spec/entry_spec.rb
CHANGED
@@ -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.
|
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-
|
13
|
+
date: 2019-11-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|