contentful 2.1.0 → 2.1.1

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
  SHA1:
3
- metadata.gz: 64ddb906124dfd977570b56271e874dd105bad5d
4
- data.tar.gz: dc3c20c1dadf513ef9429ade5c0e7f796c4a5d1e
3
+ metadata.gz: 523acf1290d29cdeb2972c104b7897a1e41909b2
4
+ data.tar.gz: 4ed687d95992bac7c04427d244c98e9bc01ce5d4
5
5
  SHA512:
6
- metadata.gz: ba13149d7dc6794482c5950f2bb563511041731899f0b757d3efc8aeb7557e0e1670b273755b5c0b422efa7c3d7ed03f2343e014c6608541f6311a9d14e09900
7
- data.tar.gz: 899dbabd938a143fba8190e3f1bacdf7c6d46482059a9b1370b393f86688a18535e81d33508b13da7e90d7e4c18c34f2f4daeb403832d2f8d7b0b592750e201f
6
+ metadata.gz: 1cacccbb9ea40372b8bb393d5ccc6e3b8b6fdeaeff9598cecd165e7a353b6b60e4aa6dc64b44756c934abb6de9016ad113df57802ace3d6102ac3dda46c2dbe4
7
+ data.tar.gz: 692965f112c62b3b9e4d3dfbaf3ca37add478d78526ce53993e3cab8b394e2c0e6debc78ac58120a7ade93772d25ab622c92bd819ccc2afcdd249564ea623151
data/.travis.yml CHANGED
@@ -3,10 +3,6 @@ rvm:
3
3
  - 2.4.0
4
4
  - 2.3.1
5
5
  - 2.2.1
6
- - 2.1.2
7
- - 2.1.1
8
- - 2.1
9
- - 2.0.0
10
6
  notifications:
11
7
  slack:
12
8
  secure: Zr3mKCiTb0vaTD4MPtTG8BbyYyErFuoxioM25QyrqePKVkDFeZC1MtGmg5klQQrJiWTKZPa/zB8NAHYkoUxg9I+z15JK0hYfz9KRubEpCrXCaqTC9Vzq88kJ3LN8YsTyBF66izaBH2KLsOfaJRxwplFzZqgpg4GG2DUBPtrGtes=
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Change Log
2
2
 
3
- ## Unreleased
3
+ ## 2.1.1
4
+
5
+ ### Fixed
6
+ * Fixed Marshalling for resources that have deeply nested resources. [#138](https://github.com/contentful/contentful.rb/issues/138)
4
7
 
5
8
  ## 2.1.0
6
9
  ### Added
data/README.md CHANGED
@@ -382,6 +382,6 @@ For more information on the internal changes present in the 2.x release, please
382
382
  ## License
383
383
 
384
384
  Copyright (c) 2014 Contentful GmbH - Jan Lelis.
385
- Copyright (c) 2016 Contentfuk GmbH - David Litvak.
385
+ Copyright (c) 2016 Contentful GmbH - David Litvak.
386
386
 
387
387
  See LICENSE.txt for further details.
@@ -53,7 +53,10 @@ module Contentful
53
53
 
54
54
  ResourceBuilder.new(
55
55
  resource,
56
- @configuration.merge(includes_for_single: includes),
56
+ @configuration.merge(
57
+ includes_for_single:
58
+ @configuration.fetch(:includes_for_single, []) + includes
59
+ ),
57
60
  localized,
58
61
  @depth + 1,
59
62
  includes
@@ -44,15 +44,16 @@ module Contentful
44
44
  def marshal_dump
45
45
  {
46
46
  configuration: @configuration,
47
- raw: raw_with_links
47
+ raw: raw_with_links,
48
+ localized: locales.size > 1
48
49
  }
49
50
  end
50
51
 
51
52
  # @private
52
53
  def marshal_load(raw_object)
53
54
  super(raw_object)
54
- localized = raw_object[:raw].fetch('fields', {}).all? { |_, v| v.is_a?(Hash) }
55
- @fields = hydrate_fields(localized, [])
55
+ localized = raw_object[:localized]
56
+ @fields = hydrate_fields(localized, raw_object[:configuration].fetch(:includes_for_single, []))
56
57
  define_fields_methods!
57
58
  end
58
59
 
@@ -88,7 +88,7 @@ module Contentful
88
88
  end
89
89
 
90
90
  def resource_class(item)
91
- return fetch_custom_resource_class(item) if %w(Entry Asset).include?(item['sys']['type'])
91
+ return fetch_custom_resource_class(item) if %w(Entry DeletedEntry Asset DeletedAsset).include?(item['sys']['type'])
92
92
  resource_mapping[item['sys']['type']]
93
93
  end
94
94
 
@@ -101,6 +101,10 @@ module Contentful
101
101
  return fetch_custom_resource_mapping(item, 'Entry', Entry)
102
102
  when 'Asset'
103
103
  return fetch_custom_resource_mapping(item, 'Asset', Asset)
104
+ when 'DeletedEntry'
105
+ return fetch_custom_resource_mapping(item, 'DeletedEntry', DeletedEntry)
106
+ when 'DeletedAsset'
107
+ return fetch_custom_resource_mapping(item, 'DeletedAsset', DeletedAsset)
104
108
  end
105
109
  end
106
110
 
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.1.0'
4
+ VERSION = '2.1.1'
5
5
  end
data/spec/entry_spec.rb CHANGED
@@ -174,6 +174,24 @@ describe Contentful::Entry do
174
174
  test_dump(Marshal.load(Marshal.dump(nyancat)))
175
175
  }
176
176
  end
177
+
178
+ it 'can properly marshal multiple level nested resources - #138' do
179
+ vcr('entry/marshal_138') {
180
+ parent = create_client(
181
+ space: 'j8tb59fszch7',
182
+ access_token: '5f711401f965951eb724ac72ac905e13d892294ba209268f13a9b32e896c8694',
183
+ dynamic_entries: :auto,
184
+ max_include_resolution_depth: 5
185
+ ).entry('5aV3O0l5jU0cwQ2OkyYsyU')
186
+
187
+ rehydrated = Marshal.load(Marshal.dump(parent))
188
+
189
+ expect(rehydrated.childs.first.image1.url).to eq '//images.contentful.com/j8tb59fszch7/7FjliblAmAoGMwU62MeQ6k/62509df90ef4bed38c0701bb9aa8c74c/Funny-Cat-Pictures-with-Captions-25.jpg'
190
+ expect(rehydrated.childs.first.image2.url).to eq '//images.contentful.com/j8tb59fszch7/1pbGuWZ27O6GMO0OGemgcA/a4185036a3640ad4491f38d8926003ab/Funny-Cat-Pictures-with-Captions-1.jpg'
191
+ expect(rehydrated.childs.last.image1.url).to eq '//images.contentful.com/j8tb59fszch7/4SXVTr0KEUyWiMMCOaUeUU/c9fa2246d5529a9c8e1ec6f5387dc4f6/e0194eca1c8135636ce0e014341548c3.jpg'
192
+ expect(rehydrated.childs.last.image2.url).to eq '//images.contentful.com/j8tb59fszch7/1NU1YcNQJGIA22gAKmKqWo/56fa672bb17a7b7ae2773d08e101d059/57ee64921c25faa649fc79288197c313.jpg'
193
+ }
194
+ end
177
195
  end
178
196
 
179
197
  describe 'select operator' do
@@ -0,0 +1,159 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cdn.contentful.com/spaces/j8tb59fszch7/content_types?limit=1000
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful.rb/2.1.0; platform ruby/2.4.1; os macOS/16;
12
+ Authorization:
13
+ - Bearer 5f711401f965951eb724ac72ac905e13d892294ba209268f13a9b32e896c8694
14
+ Content-Type:
15
+ - application/vnd.contentful.delivery.v1+json
16
+ Accept-Encoding:
17
+ - gzip
18
+ Connection:
19
+ - close
20
+ Host:
21
+ - cdn.contentful.com
22
+ User-Agent:
23
+ - http.rb/2.2.2
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Access-Control-Allow-Headers:
30
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent
31
+ Access-Control-Allow-Methods:
32
+ - GET,HEAD,OPTIONS
33
+ Access-Control-Allow-Origin:
34
+ - "*"
35
+ Access-Control-Expose-Headers:
36
+ - Etag
37
+ Access-Control-Max-Age:
38
+ - '86400'
39
+ Cache-Control:
40
+ - max-age=0
41
+ Content-Encoding:
42
+ - gzip
43
+ Content-Type:
44
+ - application/vnd.contentful.delivery.v1+json
45
+ Etag:
46
+ - W/"dbd86bc89681ff36b482b61f9acf6336"
47
+ Server:
48
+ - Contentful
49
+ X-Content-Type-Options:
50
+ - nosniff
51
+ X-Contentful-Request-Id:
52
+ - a05a8b0194705bccd7b5e81126f113f8
53
+ Content-Length:
54
+ - '458'
55
+ Accept-Ranges:
56
+ - bytes
57
+ Date:
58
+ - Tue, 25 Jul 2017 20:12:57 GMT
59
+ Via:
60
+ - 1.1 varnish
61
+ Age:
62
+ - '2178'
63
+ Connection:
64
+ - close
65
+ X-Served-By:
66
+ - cache-atl6250-ATL
67
+ X-Cache:
68
+ - HIT
69
+ X-Cache-Hits:
70
+ - '2'
71
+ X-Timer:
72
+ - S1501013577.487146,VS0,VE0
73
+ Vary:
74
+ - Accept-Encoding
75
+ body:
76
+ encoding: ASCII-8BIT
77
+ string: !binary |-
78
+ H4sIAAAAAAAAA9VVO2/CMBDe+RWR54KSkJCSDVXt1K1MrRhMYoqL86htkALiv/fsPHCiQJ9ShZfkzr73fXeHgWUhUQgUWgf4BUIWOQEKzTjHBQLe8Ua9kZnEDPiupsSG5kDYmmA0oRIox7ZLBpUkURpftMZSb8eMNiVyHClb9YuSaTijGJpZO/VI0w1SRk8HzKebeeX0k9bYeUBjFc/brVz605XYR+tAhVWfY/OvAy0PKmWiNWWxoa7x4y5LJUmlNmtIRZxgSeKZygZybScY2sHQ9efONHQnoe+OJlPv2RTY5vH3BDjZUUGzVKW78rZxG8VU5AwXD5SA16GVbhmrnUMpTnRZ2yGhmIiI01yWKlHjG1opJaciqrS0ylQmiCb4lTithDeW+u7O1hGxLMKM7olyfIWZIGYRESfvW8rPXELYeMnOXGbQm1CSXq1m58yEIPLUF0YvnAvbvRB25+56wq56aqG/VRKuGMA55gDTP0KwH3r2yHNvv4rg8Tj0g5FnOy0BA8HjHyG4E9NvIawHgujv5b679n5oofQ/MFzvGhOlnyyMHQwaGLsw8vR8W1zYJ/ep5HoJ1sfYFm2oALUYHAcfDww1W1AHAAA=
79
+ http_version:
80
+ recorded_at: Tue, 25 Jul 2017 20:12:57 GMT
81
+ - request:
82
+ method: get
83
+ uri: https://cdn.contentful.com/spaces/j8tb59fszch7/entries?sys.id=5aV3O0l5jU0cwQ2OkyYsyU
84
+ body:
85
+ encoding: US-ASCII
86
+ string: ''
87
+ headers:
88
+ X-Contentful-User-Agent:
89
+ - sdk contentful.rb/2.1.0; platform ruby/2.4.1; os macOS/16;
90
+ Authorization:
91
+ - Bearer 5f711401f965951eb724ac72ac905e13d892294ba209268f13a9b32e896c8694
92
+ Content-Type:
93
+ - application/vnd.contentful.delivery.v1+json
94
+ Accept-Encoding:
95
+ - gzip
96
+ Connection:
97
+ - close
98
+ Host:
99
+ - cdn.contentful.com
100
+ User-Agent:
101
+ - http.rb/2.2.2
102
+ response:
103
+ status:
104
+ code: 200
105
+ message: OK
106
+ headers:
107
+ Access-Control-Allow-Headers:
108
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent
109
+ Access-Control-Allow-Methods:
110
+ - GET,HEAD,OPTIONS
111
+ Access-Control-Allow-Origin:
112
+ - "*"
113
+ Access-Control-Expose-Headers:
114
+ - Etag
115
+ Access-Control-Max-Age:
116
+ - '86400'
117
+ Cache-Control:
118
+ - max-age=0
119
+ Content-Encoding:
120
+ - gzip
121
+ Content-Type:
122
+ - application/vnd.contentful.delivery.v1+json
123
+ Etag:
124
+ - W/"50b10e6946ba58441081ab4010bcc603"
125
+ Server:
126
+ - Contentful
127
+ X-Content-Type-Options:
128
+ - nosniff
129
+ X-Contentful-Request-Id:
130
+ - '041880d53c1bd822f162ee64f21a38f6'
131
+ Content-Length:
132
+ - '1171'
133
+ Accept-Ranges:
134
+ - bytes
135
+ Date:
136
+ - Tue, 25 Jul 2017 20:12:57 GMT
137
+ Via:
138
+ - 1.1 varnish
139
+ Age:
140
+ - '2173'
141
+ Connection:
142
+ - close
143
+ X-Served-By:
144
+ - cache-atl6228-ATL
145
+ X-Cache:
146
+ - HIT
147
+ X-Cache-Hits:
148
+ - '1'
149
+ X-Timer:
150
+ - S1501013578.962881,VS0,VE1
151
+ Vary:
152
+ - Accept-Encoding
153
+ body:
154
+ encoding: ASCII-8BIT
155
+ string: !binary |-
156
+ H4sIAAAAAAAAA+2Y3W/iOBDA3/evqHg+iO34I+ENVS3a7bVcj7K99rQPxnHAbQgcCYfoqv/7OQ4fgSahzaW70qp5QImTsWfG85vx8P3TyUkjWkWN9sl3fasf4tVM6qdGZz7nq4Yee/4t+SaexjzQ49A8RY9qph+AeQjURMXJK5A+q1hOkgn/NhOm0x6sYlaKZlwkS22+SAczuiQDZnCj0+8qfGwka+4uvXr4eLPWuW9mPPhAeYk5D048JK4fPYkxS6zaXM/be2NnejVSGcK/2j0QkIcBEMtr1Htc3UWrQWb+rWJnYTxfZV+IueSx9DqJXxoIQNYErInIDXTbNmwj2iIM3GcFFjPvbQJz+a+K1DTc7MlaczENYxnGa4/U59rTzLy5Dp7xuV73uGuDqeCBiTAZNgf9jcDW+w1fycDbBWRiV0OMVTqWxlRqa9a4nPhaO6Qkdkzs7qLncBP3YuHuHN3f/BnMuqd9uhx1VpNl/+I0a60GJRtWWR/9UEWJq+iXED+Nou6gv6Tq89md7N6WaLrV+tv6LrUj+f1m+FahCBaezOSI1FMbwneM5+5CLue5X5qtfv1+5dGeqFvKe8k2bajPd2B2Qwu5T0K1lHyAW4yhLPlapJz9XJF8+pPlC/mvw+XFWWDreINqSbjt+bEgGayLzhrAnISQrDbhIwkPykcdNnaiSMYHRWRrHe7/9fVmDi7OBqtbdXl52uMDORi81lyjM/rROsOrAbwTV9dfup87CI06F5OLf26nJTrvSuImI2w2bZfJ9g4N643KK+h17Mg7gZ6f0mvgHLltjFoUvIHzIpEPzn8O5+z8IVDDoDPpTLuXywFFl/KaPpYwsxc2P4nz2bC7uL1HrEe7lz3Q68rJSHRKdH7JuRkxVV9zmybCX7TKFyTFXPpfVoTSKg/amLWgi99Q5QtECun/H3UzVnF6/CZMSopdBAUiPuf61hfMRY4DXSZsaO+VQH0qN1IHR9nFPOkJG5ZlIj5qrU8f/iLQtxMr23RZ+R63CPU5ZWg4hIyzIeMSMWZ7wJEQQA8Q1zqmZ+thNjrs+TwZcxXsNxGbIqWeEkOIjTHN7rYJeWPGCzPNq6Xy4rERNF3u/tUYSzUaJ80eJfDgbbYt2DvYmGkTv17xiWmIqli6f95LDbAeZnKU5T7T5P7SFR3mZ8AaoNb1GZEWdeDroS4SeVeozxdhuGqe8rj5hxLxYi6j5lLFYz0yi/WfBVET1o51rs8tjqFDgE25TTHgHsYu9G3Hc1xEAbD50DquaTWwKWCwEtgUlYLtIFwZ7Gq2fqBtMmTazxc0XjWgbYM2ZPr/uDec1otE3hVtCfSZQgoOhQNtQm0qJNBj2MaQYEfUXq/zPW4J1+cIYeoRglzuCl2opaA+sR3mCexT65ie1bDGLnMrYU0oLq3XlFTGuoqlH1BnoC7osmqAGjltov9kR2+p1wUi7wr10cqASN0FO9/pFkUEuJ7vAunjofRsRwAG4HDocu4IhsXxgq0PSJWO4rbOZ+4ho685ih+p2Bixymi/Yl/yjK1Kd9p369/nT8+f/gNYpN8blBsAAA==
157
+ http_version:
158
+ recorded_at: Tue, 25 Jul 2017 20:12:58 GMT
159
+ recorded_with: VCR 3.0.3
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.1.0
4
+ version: 2.1.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: 2017-05-29 00:00:00.000000000 Z
13
+ date: 2017-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -444,6 +444,7 @@ files:
444
444
  - spec/fixtures/vcr_cassettes/entry/include_resolution.yml
445
445
  - spec/fixtures/vcr_cassettes/entry/json_objects.yml
446
446
  - spec/fixtures/vcr_cassettes/entry/json_objects_client.yml
447
+ - spec/fixtures/vcr_cassettes/entry/marshal_138.yml
447
448
  - spec/fixtures/vcr_cassettes/entry/marshall.yml
448
449
  - spec/fixtures/vcr_cassettes/entry/raw.yml
449
450
  - spec/fixtures/vcr_cassettes/entry/select_empty_array.yml
@@ -507,7 +508,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
507
508
  version: '0'
508
509
  requirements: []
509
510
  rubyforge_project:
510
- rubygems_version: 2.5.1
511
+ rubygems_version: 2.6.12
511
512
  signing_key:
512
513
  specification_version: 4
513
514
  summary: contentful
@@ -553,6 +554,7 @@ test_files:
553
554
  - spec/fixtures/vcr_cassettes/entry/include_resolution.yml
554
555
  - spec/fixtures/vcr_cassettes/entry/json_objects.yml
555
556
  - spec/fixtures/vcr_cassettes/entry/json_objects_client.yml
557
+ - spec/fixtures/vcr_cassettes/entry/marshal_138.yml
556
558
  - spec/fixtures/vcr_cassettes/entry/marshall.yml
557
559
  - spec/fixtures/vcr_cassettes/entry/raw.yml
558
560
  - spec/fixtures/vcr_cassettes/entry/select_empty_array.yml