contentful-management 1.3.0 → 1.4.0
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/management/entry.rb +5 -2
- data/lib/contentful/management/resource/field_aware.rb +1 -1
- data/lib/contentful/management/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/entry/fallback_undefined.yml +527 -0
- data/spec/lib/contentful/management/entry_spec.rb +20 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3249dad1b37ff8e203c02f2bb3721b96e111728
|
4
|
+
data.tar.gz: a9b3a74a14feeac1d843f368cff6cdae238c6f70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 109d6ed87ff6e487f96bc2614a790154036af420a88c712a5197c7ba76a0692afa12023f1e2674c895a598e98ee61b25d832c6dfac76bd4039a2711ec659b555
|
7
|
+
data.tar.gz: 54abb173ac94d6f501ea27d5d654fd00063072d29b16a413599e8414e6374ef445613cabdb39ccdbffac9c273f7187c3fa29842f48bc7f8946096e1dd3b65500
|
data/CHANGELOG.md
CHANGED
@@ -107,13 +107,16 @@ module Contentful
|
|
107
107
|
# Parser for entry attributes from query.
|
108
108
|
# Returns a hash of existing fields.
|
109
109
|
#
|
110
|
+
# @param [Boolean] remove_undefined Returns only defined (non-nil) fields if true. This replicates
|
111
|
+
# the WebApp logic for empty fields, so that we stay consistent across all our software
|
110
112
|
# @private
|
111
|
-
def fields_for_query
|
113
|
+
def fields_for_query(remove_undefined = true)
|
112
114
|
raw_fields = instance_variable_get(:@fields)
|
113
115
|
fields_names = flatten_field_names(raw_fields)
|
114
116
|
fields_names.each_with_object({}) do |field_name, results|
|
115
117
|
results[field_name] = raw_fields.each_with_object({}) do |(locale, fields), field_results|
|
116
|
-
|
118
|
+
attribute_value = parse_update_attribute(fields[field_name])
|
119
|
+
field_results[locale] = attribute_value unless attribute_value.nil? && remove_undefined
|
117
120
|
end
|
118
121
|
end
|
119
122
|
end
|
@@ -0,0 +1,527 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.contentful.com/spaces/wqjq16zu9s8b
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- RubyContentfulManagementGem/1.3.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer <ACCESS_TOKEN>
|
14
|
+
Content-Type:
|
15
|
+
- application/vnd.contentful.management.v1+json
|
16
|
+
Content-Length:
|
17
|
+
- '0'
|
18
|
+
Connection:
|
19
|
+
- close
|
20
|
+
Host:
|
21
|
+
- api.contentful.com
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Accept-Ranges:
|
28
|
+
- bytes
|
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
|
+
- DELETE,GET,HEAD,POST,PUT,OPTIONS
|
33
|
+
Access-Control-Allow-Origin:
|
34
|
+
- "*"
|
35
|
+
Access-Control-Expose-Headers:
|
36
|
+
- Etag
|
37
|
+
Access-Control-Max-Age:
|
38
|
+
- '1728000'
|
39
|
+
Cache-Control:
|
40
|
+
- max-age=0
|
41
|
+
Content-Type:
|
42
|
+
- application/vnd.contentful.management.v1+json
|
43
|
+
Date:
|
44
|
+
- Fri, 14 Oct 2016 12:12:25 GMT
|
45
|
+
Etag:
|
46
|
+
- '"77ff51f219c1505c57c86134ef8fdd46"'
|
47
|
+
Server:
|
48
|
+
- Contentful
|
49
|
+
Status:
|
50
|
+
- 200 OK
|
51
|
+
Strict-Transport-Security:
|
52
|
+
- max-age=15768000
|
53
|
+
X-Content-Type-Options:
|
54
|
+
- nosniff
|
55
|
+
X-Contentful-Ratelimit-Hour-Limit:
|
56
|
+
- '18000'
|
57
|
+
X-Contentful-Ratelimit-Hour-Remaining:
|
58
|
+
- '17899'
|
59
|
+
X-Contentful-Ratelimit-Reset:
|
60
|
+
- '0'
|
61
|
+
X-Contentful-Ratelimit-Second-Limit:
|
62
|
+
- '10'
|
63
|
+
X-Contentful-Ratelimit-Second-Remaining:
|
64
|
+
- '9'
|
65
|
+
X-Contentful-Request-Id:
|
66
|
+
- 6ed5087fe077424d4d47a8b3a1d5bf9e
|
67
|
+
Content-Length:
|
68
|
+
- '467'
|
69
|
+
Connection:
|
70
|
+
- Close
|
71
|
+
Set-Cookie:
|
72
|
+
- incap_ses_297_673446=1Tx6E/k/ykw7MuROSigfBKnLAFgAAAAAv8+wvRYPvAnuD2zy7CmKpQ==;
|
73
|
+
path=/; Domain=.contentful.com
|
74
|
+
- nlbi_673446=6CAsP+zo9UaAZ1H96lKYhQAAAAAq0oYT2JZAX5T6HKDR2yoU; path=/; Domain=.contentful.com
|
75
|
+
- visid_incap_673446=UbjVt7QrT8+1DwOHACM4n6nLAFgAAAAAQUIPAAAAAAAM4Yvq2Zn2k5iDwumuicu7;
|
76
|
+
expires=Sat, 14 Oct 2017 08:29:05 GMT; path=/; Domain=.contentful.com
|
77
|
+
X-Iinfo:
|
78
|
+
- 5-11491643-11491660 NNNN CT(126 260 0) RT(1476447144429 154) q(0 0 4 -1) r(6
|
79
|
+
6) U5
|
80
|
+
X-Cdn:
|
81
|
+
- Incapsula
|
82
|
+
body:
|
83
|
+
encoding: ASCII-8BIT
|
84
|
+
string: |+
|
85
|
+
{
|
86
|
+
"name":"management.rb - Fallback",
|
87
|
+
"sys":{
|
88
|
+
"type":"Space",
|
89
|
+
"id":"wqjq16zu9s8b",
|
90
|
+
"version":1,
|
91
|
+
"createdBy":{
|
92
|
+
"sys":{
|
93
|
+
"type":"Link",
|
94
|
+
"linkType":"User",
|
95
|
+
"id":"4SejVrWT96dvL9IV4Nb7sQ"
|
96
|
+
}
|
97
|
+
},
|
98
|
+
"createdAt":"2016-10-14T12:00:26Z",
|
99
|
+
"updatedBy":{
|
100
|
+
"sys":{
|
101
|
+
"type":"Link",
|
102
|
+
"linkType":"User",
|
103
|
+
"id":"4SejVrWT96dvL9IV4Nb7sQ"
|
104
|
+
}
|
105
|
+
},
|
106
|
+
"updatedAt":"2016-10-14T12:00:26Z"
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
http_version:
|
111
|
+
recorded_at: Fri, 14 Oct 2016 12:12:24 GMT
|
112
|
+
- request:
|
113
|
+
method: get
|
114
|
+
uri: https://api.contentful.com/spaces/wqjq16zu9s8b/content_types
|
115
|
+
body:
|
116
|
+
encoding: US-ASCII
|
117
|
+
string: ''
|
118
|
+
headers:
|
119
|
+
User-Agent:
|
120
|
+
- RubyContentfulManagementGem/1.3.0
|
121
|
+
Authorization:
|
122
|
+
- Bearer <ACCESS_TOKEN>
|
123
|
+
Content-Type:
|
124
|
+
- application/vnd.contentful.management.v1+json
|
125
|
+
Content-Length:
|
126
|
+
- '0'
|
127
|
+
Connection:
|
128
|
+
- close
|
129
|
+
Host:
|
130
|
+
- api.contentful.com
|
131
|
+
response:
|
132
|
+
status:
|
133
|
+
code: 200
|
134
|
+
message: OK
|
135
|
+
headers:
|
136
|
+
Access-Control-Allow-Headers:
|
137
|
+
- 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
|
138
|
+
Access-Control-Allow-Methods:
|
139
|
+
- DELETE,GET,HEAD,POST,PUT,OPTIONS
|
140
|
+
Access-Control-Allow-Origin:
|
141
|
+
- "*"
|
142
|
+
Access-Control-Expose-Headers:
|
143
|
+
- Etag
|
144
|
+
Access-Control-Max-Age:
|
145
|
+
- '1728000'
|
146
|
+
Cf-Space-Id:
|
147
|
+
- wqjq16zu9s8b
|
148
|
+
Content-Type:
|
149
|
+
- application/vnd.contentful.management.v1+json
|
150
|
+
Date:
|
151
|
+
- Fri, 14 Oct 2016 12:12:28 GMT
|
152
|
+
Etag:
|
153
|
+
- '"6508fef90dc0cea0e8f0fe1def4225af"'
|
154
|
+
Server:
|
155
|
+
- Contentful
|
156
|
+
Strict-Transport-Security:
|
157
|
+
- max-age=15768000
|
158
|
+
X-Content-Type-Options:
|
159
|
+
- nosniff
|
160
|
+
X-Contentful-Ratelimit-Hour-Limit:
|
161
|
+
- '18000'
|
162
|
+
X-Contentful-Ratelimit-Hour-Remaining:
|
163
|
+
- '17898'
|
164
|
+
X-Contentful-Ratelimit-Reset:
|
165
|
+
- '0'
|
166
|
+
X-Contentful-Ratelimit-Second-Limit:
|
167
|
+
- '10'
|
168
|
+
X-Contentful-Ratelimit-Second-Remaining:
|
169
|
+
- '9'
|
170
|
+
X-Contentful-Request-Id:
|
171
|
+
- 23c5cbfd5606024757809c4885f63c0b
|
172
|
+
Content-Length:
|
173
|
+
- '1482'
|
174
|
+
Connection:
|
175
|
+
- Close
|
176
|
+
Set-Cookie:
|
177
|
+
- incap_ses_297_673446=Ve49bWMd/F2QOOROSigfBKzLAFgAAAAAS40WyCPngPWW6mYIPvbIYA==;
|
178
|
+
path=/; Domain=.contentful.com
|
179
|
+
- nlbi_673446=9/NOQ9cZxElBaIkx6lKYhQAAAAB5ONp5hff84ZAYjGudzTH8; path=/; Domain=.contentful.com
|
180
|
+
- visid_incap_673446=wCUdeZGmTGy/m+lja4WEI6zLAFgAAAAAQUIPAAAAAABSi8iojCc1SXUW7V9GEz/L;
|
181
|
+
expires=Sat, 14 Oct 2017 08:29:05 GMT; path=/; Domain=.contentful.com
|
182
|
+
X-Iinfo:
|
183
|
+
- 9-17143620-17143655 NNNN CT(129 128 0) RT(1476447145348 137) q(0 0 3 -1) r(28
|
184
|
+
28) U5
|
185
|
+
X-Cdn:
|
186
|
+
- Incapsula
|
187
|
+
body:
|
188
|
+
encoding: ASCII-8BIT
|
189
|
+
string: |
|
190
|
+
{
|
191
|
+
"sys": {
|
192
|
+
"type": "Array"
|
193
|
+
},
|
194
|
+
"total": 1,
|
195
|
+
"skip": 0,
|
196
|
+
"limit": 100,
|
197
|
+
"items": [
|
198
|
+
{
|
199
|
+
"sys": {
|
200
|
+
"space": {
|
201
|
+
"sys": {
|
202
|
+
"type": "Link",
|
203
|
+
"linkType": "Space",
|
204
|
+
"id": "wqjq16zu9s8b"
|
205
|
+
}
|
206
|
+
},
|
207
|
+
"id": "test",
|
208
|
+
"type": "ContentType",
|
209
|
+
"createdAt": "2016-10-14T12:02:29.819Z",
|
210
|
+
"updatedAt": "2016-10-14T12:02:32.455Z",
|
211
|
+
"createdBy": {
|
212
|
+
"sys": {
|
213
|
+
"type": "Link",
|
214
|
+
"linkType": "User",
|
215
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
216
|
+
}
|
217
|
+
},
|
218
|
+
"updatedBy": {
|
219
|
+
"sys": {
|
220
|
+
"type": "Link",
|
221
|
+
"linkType": "User",
|
222
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
223
|
+
}
|
224
|
+
},
|
225
|
+
"publishedCounter": 1,
|
226
|
+
"version": 2,
|
227
|
+
"publishedBy": {
|
228
|
+
"sys": {
|
229
|
+
"type": "Link",
|
230
|
+
"linkType": "User",
|
231
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
232
|
+
}
|
233
|
+
},
|
234
|
+
"publishedVersion": 1,
|
235
|
+
"firstPublishedAt": "2016-10-14T12:02:32.442Z",
|
236
|
+
"publishedAt": "2016-10-14T12:02:32.442Z"
|
237
|
+
},
|
238
|
+
"displayField": "name",
|
239
|
+
"name": "Test",
|
240
|
+
"description": "",
|
241
|
+
"fields": [
|
242
|
+
{
|
243
|
+
"id": "name",
|
244
|
+
"name": "Name",
|
245
|
+
"type": "Symbol",
|
246
|
+
"localized": true,
|
247
|
+
"required": false,
|
248
|
+
"validations": [],
|
249
|
+
"disabled": false,
|
250
|
+
"omitted": false
|
251
|
+
}
|
252
|
+
]
|
253
|
+
}
|
254
|
+
]
|
255
|
+
}
|
256
|
+
http_version:
|
257
|
+
recorded_at: Fri, 14 Oct 2016 12:12:27 GMT
|
258
|
+
- request:
|
259
|
+
method: get
|
260
|
+
uri: https://api.contentful.com/spaces/wqjq16zu9s8b/entries/6HSlhD1o3eqkyEWWuMQYyU
|
261
|
+
body:
|
262
|
+
encoding: US-ASCII
|
263
|
+
string: ''
|
264
|
+
headers:
|
265
|
+
User-Agent:
|
266
|
+
- RubyContentfulManagementGem/1.3.0
|
267
|
+
Authorization:
|
268
|
+
- Bearer <ACCESS_TOKEN>
|
269
|
+
Content-Type:
|
270
|
+
- application/vnd.contentful.management.v1+json
|
271
|
+
Content-Length:
|
272
|
+
- '0'
|
273
|
+
Connection:
|
274
|
+
- close
|
275
|
+
Host:
|
276
|
+
- api.contentful.com
|
277
|
+
response:
|
278
|
+
status:
|
279
|
+
code: 200
|
280
|
+
message: OK
|
281
|
+
headers:
|
282
|
+
Access-Control-Allow-Headers:
|
283
|
+
- 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
|
284
|
+
Access-Control-Allow-Methods:
|
285
|
+
- DELETE,GET,HEAD,POST,PUT,OPTIONS
|
286
|
+
Access-Control-Allow-Origin:
|
287
|
+
- "*"
|
288
|
+
Access-Control-Expose-Headers:
|
289
|
+
- Etag
|
290
|
+
Access-Control-Max-Age:
|
291
|
+
- '1728000'
|
292
|
+
Cf-Space-Id:
|
293
|
+
- wqjq16zu9s8b
|
294
|
+
Content-Type:
|
295
|
+
- application/vnd.contentful.management.v1+json
|
296
|
+
Date:
|
297
|
+
- Fri, 14 Oct 2016 12:12:29 GMT
|
298
|
+
Etag:
|
299
|
+
- '"91cd337b06de0a1ae831679c8f1d7627"'
|
300
|
+
Server:
|
301
|
+
- Contentful
|
302
|
+
Strict-Transport-Security:
|
303
|
+
- max-age=15768000
|
304
|
+
X-Content-Type-Options:
|
305
|
+
- nosniff
|
306
|
+
X-Contentful-Ratelimit-Hour-Limit:
|
307
|
+
- '18000'
|
308
|
+
X-Contentful-Ratelimit-Hour-Remaining:
|
309
|
+
- '17897'
|
310
|
+
X-Contentful-Ratelimit-Reset:
|
311
|
+
- '0'
|
312
|
+
X-Contentful-Ratelimit-Second-Limit:
|
313
|
+
- '10'
|
314
|
+
X-Contentful-Ratelimit-Second-Remaining:
|
315
|
+
- '9'
|
316
|
+
X-Contentful-Request-Id:
|
317
|
+
- e0149fe76d8f9b38b92b73e2ec48d376
|
318
|
+
Content-Length:
|
319
|
+
- '1114'
|
320
|
+
Connection:
|
321
|
+
- Close
|
322
|
+
Set-Cookie:
|
323
|
+
- incap_ses_297_673446=YWWCAChK+S0oOuROSigfBK3LAFgAAAAAyPxNjzAgs/riLInd9ZvCEQ==;
|
324
|
+
path=/; Domain=.contentful.com
|
325
|
+
- nlbi_673446=ptHqBNH3JhzCvUbW6lKYhQAAAAC2jJNrcwJTIwrvfGqhG31M; path=/; Domain=.contentful.com
|
326
|
+
- visid_incap_673446=F6H1tyVJT+G69H7GUW8ClK3LAFgAAAAAQUIPAAAAAABV4TOljk2AH/iY6SgWO/Yi;
|
327
|
+
expires=Sat, 14 Oct 2017 08:28:42 GMT; path=/; Domain=.contentful.com
|
328
|
+
X-Iinfo:
|
329
|
+
- 2-5535446-5535458 NNNN CT(127 125 0) RT(1476447148451 148) q(0 0 3 -1) r(5
|
330
|
+
5) U5
|
331
|
+
X-Cdn:
|
332
|
+
- Incapsula
|
333
|
+
body:
|
334
|
+
encoding: ASCII-8BIT
|
335
|
+
string: |
|
336
|
+
{
|
337
|
+
"sys": {
|
338
|
+
"id": "6HSlhD1o3eqkyEWWuMQYyU",
|
339
|
+
"type": "Entry",
|
340
|
+
"createdAt": "2016-10-14T12:02:37.658Z",
|
341
|
+
"createdBy": {
|
342
|
+
"sys": {
|
343
|
+
"type": "Link",
|
344
|
+
"linkType": "User",
|
345
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
346
|
+
}
|
347
|
+
},
|
348
|
+
"space": {
|
349
|
+
"sys": {
|
350
|
+
"type": "Link",
|
351
|
+
"linkType": "Space",
|
352
|
+
"id": "wqjq16zu9s8b"
|
353
|
+
}
|
354
|
+
},
|
355
|
+
"contentType": {
|
356
|
+
"sys": {
|
357
|
+
"type": "Link",
|
358
|
+
"linkType": "ContentType",
|
359
|
+
"id": "test"
|
360
|
+
}
|
361
|
+
},
|
362
|
+
"firstPublishedAt": "2016-10-14T12:02:51.245Z",
|
363
|
+
"publishedCounter": 1,
|
364
|
+
"publishedAt": "2016-10-14T12:02:51.245Z",
|
365
|
+
"publishedBy": {
|
366
|
+
"sys": {
|
367
|
+
"type": "Link",
|
368
|
+
"linkType": "User",
|
369
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
370
|
+
}
|
371
|
+
},
|
372
|
+
"publishedVersion": 8,
|
373
|
+
"version": 9,
|
374
|
+
"updatedAt": "2016-10-14T12:02:51.272Z",
|
375
|
+
"updatedBy": {
|
376
|
+
"sys": {
|
377
|
+
"type": "Link",
|
378
|
+
"linkType": "User",
|
379
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
380
|
+
}
|
381
|
+
}
|
382
|
+
},
|
383
|
+
"fields": {
|
384
|
+
"name": {
|
385
|
+
"en-US": "Foo",
|
386
|
+
"es": "Bar",
|
387
|
+
"zh": "Baz"
|
388
|
+
}
|
389
|
+
}
|
390
|
+
}
|
391
|
+
http_version:
|
392
|
+
recorded_at: Fri, 14 Oct 2016 12:12:28 GMT
|
393
|
+
- request:
|
394
|
+
method: put
|
395
|
+
uri: https://api.contentful.com/spaces/wqjq16zu9s8b/entries/6HSlhD1o3eqkyEWWuMQYyU
|
396
|
+
body:
|
397
|
+
encoding: UTF-8
|
398
|
+
string: '{"fields":{"name":{"en-US":"Foo","es":"Bar"}}}'
|
399
|
+
headers:
|
400
|
+
User-Agent:
|
401
|
+
- RubyContentfulManagementGem/1.3.0
|
402
|
+
Authorization:
|
403
|
+
- Bearer <ACCESS_TOKEN>
|
404
|
+
Content-Type:
|
405
|
+
- application/vnd.contentful.management.v1+json
|
406
|
+
X-Contentful-Version:
|
407
|
+
- '9'
|
408
|
+
Connection:
|
409
|
+
- close
|
410
|
+
Host:
|
411
|
+
- api.contentful.com
|
412
|
+
response:
|
413
|
+
status:
|
414
|
+
code: 200
|
415
|
+
message: OK
|
416
|
+
headers:
|
417
|
+
Access-Control-Allow-Headers:
|
418
|
+
- 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
|
419
|
+
Access-Control-Allow-Methods:
|
420
|
+
- DELETE,GET,HEAD,POST,PUT,OPTIONS
|
421
|
+
Access-Control-Allow-Origin:
|
422
|
+
- "*"
|
423
|
+
Access-Control-Expose-Headers:
|
424
|
+
- Etag
|
425
|
+
Access-Control-Max-Age:
|
426
|
+
- '1728000'
|
427
|
+
Cf-Space-Id:
|
428
|
+
- wqjq16zu9s8b
|
429
|
+
Content-Type:
|
430
|
+
- application/vnd.contentful.management.v1+json
|
431
|
+
Date:
|
432
|
+
- Fri, 14 Oct 2016 12:12:42 GMT
|
433
|
+
Etag:
|
434
|
+
- '"44799c327e0e3ceed7ea42fb3340d8e8"'
|
435
|
+
Server:
|
436
|
+
- Contentful
|
437
|
+
Strict-Transport-Security:
|
438
|
+
- max-age=15768000
|
439
|
+
X-Content-Type-Options:
|
440
|
+
- nosniff
|
441
|
+
X-Contentful-Ratelimit-Hour-Limit:
|
442
|
+
- '18000'
|
443
|
+
X-Contentful-Ratelimit-Hour-Remaining:
|
444
|
+
- '17896'
|
445
|
+
X-Contentful-Ratelimit-Reset:
|
446
|
+
- '0'
|
447
|
+
X-Contentful-Ratelimit-Second-Limit:
|
448
|
+
- '10'
|
449
|
+
X-Contentful-Ratelimit-Second-Remaining:
|
450
|
+
- '9'
|
451
|
+
X-Contentful-Request-Id:
|
452
|
+
- e17b1ff09ced7d7a730a6315df26366d
|
453
|
+
Content-Length:
|
454
|
+
- '1096'
|
455
|
+
Connection:
|
456
|
+
- Close
|
457
|
+
Set-Cookie:
|
458
|
+
- incap_ses_297_673446=GlfTV1tKnUKZVeROSigfBLrLAFgAAAAA9WtKh9R3k79RPWdnm7Adcw==;
|
459
|
+
path=/; Domain=.contentful.com
|
460
|
+
- nlbi_673446=Viy3F+gPg2Dh/hJX6lKYhQAAAADF/eaUZKTG1YDAQOfOqDU/; path=/; Domain=.contentful.com
|
461
|
+
- visid_incap_673446=stPpbS2IRgerUTwDvxCDUrrLAFgAAAAAQUIPAAAAAACC82/HXRyGhzHuPkRnbeEZ;
|
462
|
+
expires=Sat, 14 Oct 2017 08:29:05 GMT; path=/; Domain=.contentful.com
|
463
|
+
X-Iinfo:
|
464
|
+
- 1-6946572-6946578 NNNN CT(127 128 0) RT(1476447161244 287) q(0 0 2 -1) r(5
|
465
|
+
5) U5
|
466
|
+
X-Cdn:
|
467
|
+
- Incapsula
|
468
|
+
body:
|
469
|
+
encoding: ASCII-8BIT
|
470
|
+
string: |
|
471
|
+
{
|
472
|
+
"fields": {
|
473
|
+
"name": {
|
474
|
+
"en-US": "Foo",
|
475
|
+
"es": "Bar"
|
476
|
+
}
|
477
|
+
},
|
478
|
+
"sys": {
|
479
|
+
"id": "6HSlhD1o3eqkyEWWuMQYyU",
|
480
|
+
"type": "Entry",
|
481
|
+
"createdAt": "2016-10-14T12:02:37.658Z",
|
482
|
+
"createdBy": {
|
483
|
+
"sys": {
|
484
|
+
"type": "Link",
|
485
|
+
"linkType": "User",
|
486
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
487
|
+
}
|
488
|
+
},
|
489
|
+
"space": {
|
490
|
+
"sys": {
|
491
|
+
"type": "Link",
|
492
|
+
"linkType": "Space",
|
493
|
+
"id": "wqjq16zu9s8b"
|
494
|
+
}
|
495
|
+
},
|
496
|
+
"contentType": {
|
497
|
+
"sys": {
|
498
|
+
"type": "Link",
|
499
|
+
"linkType": "ContentType",
|
500
|
+
"id": "test"
|
501
|
+
}
|
502
|
+
},
|
503
|
+
"firstPublishedAt": "2016-10-14T12:02:51.245Z",
|
504
|
+
"publishedCounter": 1,
|
505
|
+
"publishedAt": "2016-10-14T12:02:51.245Z",
|
506
|
+
"publishedBy": {
|
507
|
+
"sys": {
|
508
|
+
"type": "Link",
|
509
|
+
"linkType": "User",
|
510
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
511
|
+
}
|
512
|
+
},
|
513
|
+
"publishedVersion": 8,
|
514
|
+
"version": 10,
|
515
|
+
"updatedAt": "2016-10-14T12:12:42.683Z",
|
516
|
+
"updatedBy": {
|
517
|
+
"sys": {
|
518
|
+
"type": "Link",
|
519
|
+
"linkType": "User",
|
520
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
521
|
+
}
|
522
|
+
}
|
523
|
+
}
|
524
|
+
}
|
525
|
+
http_version:
|
526
|
+
recorded_at: Fri, 14 Oct 2016 12:12:41 GMT
|
527
|
+
recorded_with: VCR 3.0.3
|
@@ -810,6 +810,26 @@ module Contentful
|
|
810
810
|
end
|
811
811
|
end
|
812
812
|
|
813
|
+
describe 'fallback locales' do
|
814
|
+
let(:space) { client.spaces.find('wqjq16zu9s8b') }
|
815
|
+
it "if a property is nil, it's removed from the request to undefine it in the API" do
|
816
|
+
vcr('entry/fallback_undefined') {
|
817
|
+
entry = space.entries.find('6HSlhD1o3eqkyEWWuMQYyU')
|
818
|
+
|
819
|
+
expect(entry.name).to eq 'Foo'
|
820
|
+
expect(entry.fields('es')[:name]).to eq 'Bar'
|
821
|
+
expect(entry.fields('zh')[:name]).to eq 'Baz'
|
822
|
+
|
823
|
+
entry.locale ='zh'
|
824
|
+
entry.name = nil
|
825
|
+
|
826
|
+
expect(entry.fields_for_query[:name].keys).not_to include 'zh'
|
827
|
+
|
828
|
+
entry.save
|
829
|
+
}
|
830
|
+
end
|
831
|
+
end
|
832
|
+
|
813
833
|
describe 'issues' do
|
814
834
|
describe 'handles multiple locales even when they are not all defined for the default locale - #70' do
|
815
835
|
it 'merges all present locales' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentful-management
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Protas
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|
@@ -401,6 +401,7 @@ files:
|
|
401
401
|
- spec/fixtures/vcr_cassettes/entry/create_with_symbols.yml
|
402
402
|
- spec/fixtures/vcr_cassettes/entry/destory_published.yml
|
403
403
|
- spec/fixtures/vcr_cassettes/entry/destroy.yml
|
404
|
+
- spec/fixtures/vcr_cassettes/entry/fallback_undefined.yml
|
404
405
|
- spec/fixtures/vcr_cassettes/entry/find-with-null-symbols.yml
|
405
406
|
- spec/fixtures/vcr_cassettes/entry/find.yml
|
406
407
|
- spec/fixtures/vcr_cassettes/entry/find_not_found.yml
|
@@ -694,6 +695,7 @@ test_files:
|
|
694
695
|
- spec/fixtures/vcr_cassettes/entry/create_with_symbols.yml
|
695
696
|
- spec/fixtures/vcr_cassettes/entry/destory_published.yml
|
696
697
|
- spec/fixtures/vcr_cassettes/entry/destroy.yml
|
698
|
+
- spec/fixtures/vcr_cassettes/entry/fallback_undefined.yml
|
697
699
|
- spec/fixtures/vcr_cassettes/entry/find-with-null-symbols.yml
|
698
700
|
- spec/fixtures/vcr_cassettes/entry/find.yml
|
699
701
|
- spec/fixtures/vcr_cassettes/entry/find_not_found.yml
|