contentful 2.1.2 → 2.1.3

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: a7cecffd2cc6dc1c3b8becbfe965693955299401
4
- data.tar.gz: 39bcfd617abf8f802cd18adb9c976965f5cec43f
3
+ metadata.gz: 4e2176ee00180112643777684ad2c37c042eaaa1
4
+ data.tar.gz: 2300140d6854232f71b6f4ad2b12e4c2f0e4109e
5
5
  SHA512:
6
- metadata.gz: 0a422e32a95b9d17d349d0b33a55e6b8dd02a3e0e635e5c1de4843e545895d9e0fce0c473372b8982fd4b22b7d2e804db3844195cc18f5e7212d2485a2f760aa
7
- data.tar.gz: 748426ae43bac7533819f3ea42704894b715ab71a3b8f2ca4c6cc1d0bc47e4ff281b23c431c1f13028b2eb80095874c5650b896503717913136882ea0233fe7c
6
+ metadata.gz: 1c998415b761bc46bfb1b0ffeee859684b3411b324530fa61fbf75ea32cb8041edc32e4ba83c50049dde1f8f6be5ff425bcabfaad0de492b4894484d43858945
7
+ data.tar.gz: 4041cd8e082eb9d3774f957d4fc16fdcbd39735dddfac7d730d0ec1844cb33aef32c549f94a112b1509c680aabcdf4bab6a4eb52417410354bc83c7a21bcc585
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.1.3
6
+ ### Fixed
7
+ * Fixed Marshalling for custom resources in Arrays. [#138](https://github.com/contentful/contentful.rb/issues/138)
8
+
5
9
  ## 2.1.2
6
10
  ### Fixed
7
11
  * Fixed Marshalling for Arrays with deeply nested resources. [#138](https://github.com/contentful/contentful.rb/issues/138)
@@ -14,9 +14,11 @@ module Contentful
14
14
  attr_reader :total, :limit, :skip, :items, :endpoint
15
15
 
16
16
  def initialize(item = nil,
17
- default_locale = Contentful::Client::DEFAULT_CONFIGURATION[:default_locale],
17
+ configuration = {
18
+ default_locale: Contentful::Client::DEFAULT_CONFIGURATION[:default_locale]
19
+ },
18
20
  endpoint = '', *)
19
- super(item, { default_locale: default_locale })
21
+ super(item, configuration)
20
22
 
21
23
  @endpoint = endpoint
22
24
  @total = item.fetch('total', nil)
@@ -60,7 +60,7 @@ module Contentful
60
60
  build_item(item, includes)
61
61
  end
62
62
  array_class = fetch_array_class
63
- array_class.new(json.dup.merge('items' => result), default_locale, endpoint)
63
+ array_class.new(json.dup.merge('items' => result), @configuration, endpoint)
64
64
  end
65
65
 
66
66
  def build_single
@@ -8,8 +8,11 @@ module Contentful
8
8
 
9
9
  attr_reader :sync, :items, :next_sync_url, :next_page_url
10
10
 
11
- def initialize(item, default_locale, *)
12
- super(item, { default_locale: default_locale }, true)
11
+ def initialize(item,
12
+ configuration = {
13
+ default_locale: Contentful::Client::DEFAULT_CONFIGURATION[:default_locale]
14
+ }, *)
15
+ super(item, configuration, true)
13
16
 
14
17
  @items = item.fetch('items', [])
15
18
  @next_sync_url = item.fetch('nextSyncUrl', nil)
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.1.2'
4
+ VERSION = '2.1.3'
5
5
  end
@@ -1,5 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
+ class CustomClass < Contentful::Entry; end
4
+
3
5
  describe Contentful::Array do
4
6
  let(:client) { create_client }
5
7
  let(:array) { vcr('array') { client.content_types } }
@@ -94,5 +96,27 @@ describe Contentful::Array do
94
96
  expect(entries.last.image2.url).to eq rehydrated.last.image2.url
95
97
  }
96
98
  end
99
+
100
+ it 'marshals custom resources properly - #138' do
101
+ vcr('array/marshal_custom_classes') {
102
+ client = create_client(
103
+ space: 'j8tb59fszch7',
104
+ access_token: '5f711401f965951eb724ac72ac905e13d892294ba209268f13a9b32e896c8694',
105
+ dynamic_entries: :auto,
106
+ max_include_resolution_depth: 5,
107
+ entry_mapping: {
108
+ 'parent' => CustomClass
109
+ }
110
+ )
111
+
112
+ entries = client.entries(content_type: 'parent')
113
+
114
+ expect(entries.first.inspect).to eq "<CustomClass[parent] id='5aV3O0l5jU0cwQ2OkyYsyU'>"
115
+
116
+ dehydrated = Marshal.load(Marshal.dump(entries))
117
+
118
+ expect(dehydrated.first.inspect).to eq "<CustomClass[parent] id='5aV3O0l5jU0cwQ2OkyYsyU'>"
119
+ }
120
+ end
97
121
  end
98
122
  end
@@ -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.2; 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,X-Contentful-Enable-Experimental-Feature
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
+ - 2a18bccb70cba71bd8464663780f6fba
53
+ Content-Length:
54
+ - '458'
55
+ Accept-Ranges:
56
+ - bytes
57
+ Date:
58
+ - Thu, 17 Aug 2017 12:23:27 GMT
59
+ Via:
60
+ - 1.1 varnish
61
+ Age:
62
+ - '0'
63
+ Connection:
64
+ - close
65
+ X-Served-By:
66
+ - cache-gru7120-GRU
67
+ X-Cache:
68
+ - MISS
69
+ X-Cache-Hits:
70
+ - '0'
71
+ X-Timer:
72
+ - S1502972607.174656,VS0,VE300
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: Thu, 17 Aug 2017 12:23:27 GMT
81
+ - request:
82
+ method: get
83
+ uri: https://cdn.contentful.com/spaces/j8tb59fszch7/entries?content_type=parent
84
+ body:
85
+ encoding: US-ASCII
86
+ string: ''
87
+ headers:
88
+ X-Contentful-User-Agent:
89
+ - sdk contentful.rb/2.1.2; 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,X-Contentful-Enable-Experimental-Feature
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
+ - 54e27668a0265d1a9bc522aecba71a1a
131
+ Content-Length:
132
+ - '1171'
133
+ Accept-Ranges:
134
+ - bytes
135
+ Date:
136
+ - Thu, 17 Aug 2017 12:23:29 GMT
137
+ Via:
138
+ - 1.1 varnish
139
+ Age:
140
+ - '0'
141
+ Connection:
142
+ - close
143
+ X-Served-By:
144
+ - cache-gru7123-GRU
145
+ X-Cache:
146
+ - MISS
147
+ X-Cache-Hits:
148
+ - '0'
149
+ X-Timer:
150
+ - S1502972609.832470,VS0,VE217
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: Thu, 17 Aug 2017 12:23:29 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.2
4
+ version: 2.1.3
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-08-03 00:00:00.000000000 Z
13
+ date: 2017-08-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -269,6 +269,96 @@ files:
269
269
  - RELEASE.md
270
270
  - Rakefile
271
271
  - contentful.gemspec
272
+ - coverage/.last_run.json
273
+ - coverage/.resultset.json
274
+ - coverage/.resultset.json.lock
275
+ - coverage/assets/0.10.1/application.css
276
+ - coverage/assets/0.10.1/application.js
277
+ - coverage/assets/0.10.1/colorbox/border.png
278
+ - coverage/assets/0.10.1/colorbox/controls.png
279
+ - coverage/assets/0.10.1/colorbox/loading.gif
280
+ - coverage/assets/0.10.1/colorbox/loading_background.png
281
+ - coverage/assets/0.10.1/favicon_green.png
282
+ - coverage/assets/0.10.1/favicon_red.png
283
+ - coverage/assets/0.10.1/favicon_yellow.png
284
+ - coverage/assets/0.10.1/loading.gif
285
+ - coverage/assets/0.10.1/magnify.png
286
+ - coverage/assets/0.10.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
287
+ - coverage/assets/0.10.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
288
+ - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
289
+ - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
290
+ - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png
291
+ - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
292
+ - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
293
+ - coverage/assets/0.10.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
294
+ - coverage/assets/0.10.1/smoothness/images/ui-icons_222222_256x240.png
295
+ - coverage/assets/0.10.1/smoothness/images/ui-icons_2e83ff_256x240.png
296
+ - coverage/assets/0.10.1/smoothness/images/ui-icons_454545_256x240.png
297
+ - coverage/assets/0.10.1/smoothness/images/ui-icons_888888_256x240.png
298
+ - coverage/assets/0.10.1/smoothness/images/ui-icons_cd0a0a_256x240.png
299
+ - coverage/index.html
300
+ - doc/Contentful.html
301
+ - doc/Contentful/AccessDenied.html
302
+ - doc/Contentful/Array.html
303
+ - doc/Contentful/ArrayCoercion.html
304
+ - doc/Contentful/ArrayLike.html
305
+ - doc/Contentful/Asset.html
306
+ - doc/Contentful/BadRequest.html
307
+ - doc/Contentful/BaseCoercion.html
308
+ - doc/Contentful/BaseResource.html
309
+ - doc/Contentful/BooleanCoercion.html
310
+ - doc/Contentful/Client.html
311
+ - doc/Contentful/ContentType.html
312
+ - doc/Contentful/ContentTypeCache.html
313
+ - doc/Contentful/DateCoercion.html
314
+ - doc/Contentful/DeletedAsset.html
315
+ - doc/Contentful/DeletedEntry.html
316
+ - doc/Contentful/Entry.html
317
+ - doc/Contentful/Error.html
318
+ - doc/Contentful/Field.html
319
+ - doc/Contentful/FieldsResource.html
320
+ - doc/Contentful/File.html
321
+ - doc/Contentful/FloatCoercion.html
322
+ - doc/Contentful/IntegerCoercion.html
323
+ - doc/Contentful/Link.html
324
+ - doc/Contentful/LinkCoercion.html
325
+ - doc/Contentful/Locale.html
326
+ - doc/Contentful/Location.html
327
+ - doc/Contentful/LocationCoercion.html
328
+ - doc/Contentful/NotFound.html
329
+ - doc/Contentful/ObjectCoercion.html
330
+ - doc/Contentful/RateLimitExceeded.html
331
+ - doc/Contentful/Request.html
332
+ - doc/Contentful/ResourceBuilder.html
333
+ - doc/Contentful/Response.html
334
+ - doc/Contentful/ServerError.html
335
+ - doc/Contentful/ServiceUnavailable.html
336
+ - doc/Contentful/Space.html
337
+ - doc/Contentful/StringCoercion.html
338
+ - doc/Contentful/Support.html
339
+ - doc/Contentful/SymbolCoercion.html
340
+ - doc/Contentful/Sync.html
341
+ - doc/Contentful/SyncPage.html
342
+ - doc/Contentful/TextCoercion.html
343
+ - doc/Contentful/Unauthorized.html
344
+ - doc/Contentful/UnparsableJson.html
345
+ - doc/Contentful/UnparsableResource.html
346
+ - doc/_index.html
347
+ - doc/class_list.html
348
+ - doc/css/common.css
349
+ - doc/css/full_list.css
350
+ - doc/css/style.css
351
+ - doc/file.CHANGELOG.html
352
+ - doc/file.LICENSE.html
353
+ - doc/file.README.html
354
+ - doc/file_list.html
355
+ - doc/frames.html
356
+ - doc/index.html
357
+ - doc/js/app.js
358
+ - doc/js/full_list.js
359
+ - doc/js/jquery.js
360
+ - doc/method_list.html
361
+ - doc/top-level-namespace.html
272
362
  - examples/custom_classes.rb
273
363
  - examples/example_queries.rb
274
364
  - examples/raise_errors.rb
@@ -321,6 +411,7 @@ files:
321
411
  - spec/fixtures/json_responses/self_link.json
322
412
  - spec/fixtures/json_responses/unparsable.json
323
413
  - spec/fixtures/vcr_cassettes/array.yml
414
+ - spec/fixtures/vcr_cassettes/array/marshal_custom_classes.yml
324
415
  - spec/fixtures/vcr_cassettes/array/nested_resources.yml
325
416
  - spec/fixtures/vcr_cassettes/arrayField.yml
326
417
  - spec/fixtures/vcr_cassettes/array_page_1.yml
@@ -432,6 +523,7 @@ test_files:
432
523
  - spec/fixtures/json_responses/self_link.json
433
524
  - spec/fixtures/json_responses/unparsable.json
434
525
  - spec/fixtures/vcr_cassettes/array.yml
526
+ - spec/fixtures/vcr_cassettes/array/marshal_custom_classes.yml
435
527
  - spec/fixtures/vcr_cassettes/array/nested_resources.yml
436
528
  - spec/fixtures/vcr_cassettes/arrayField.yml
437
529
  - spec/fixtures/vcr_cassettes/array_page_1.yml