contentful-management 3.2.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +23 -0
  3. data/CHANGELOG.md +10 -0
  4. data/README.md +45 -1
  5. data/lib/contentful/management/asset.rb +2 -2
  6. data/lib/contentful/management/client.rb +10 -0
  7. data/lib/contentful/management/client_tag_methods_factory.rb +11 -0
  8. data/lib/contentful/management/editor_interface.rb +12 -4
  9. data/lib/contentful/management/entry.rb +16 -3
  10. data/lib/contentful/management/environment.rb +10 -0
  11. data/lib/contentful/management/environment_tag_methods_factory.rb +11 -0
  12. data/lib/contentful/management/resource/refresher.rb +1 -0
  13. data/lib/contentful/management/resource_requester.rb +2 -2
  14. data/lib/contentful/management/tag.rb +27 -0
  15. data/lib/contentful/management/version.rb +1 -1
  16. data/spec/fixtures/vcr_cassettes/editor_interfaces/update_sidebar.yml +553 -0
  17. data/spec/fixtures/vcr_cassettes/entry/references.yml +496 -0
  18. data/spec/fixtures/vcr_cassettes/environment/tag_proxy.yml +658 -0
  19. data/spec/fixtures/vcr_cassettes/tag/add_tag_to_asset.yml +456 -0
  20. data/spec/fixtures/vcr_cassettes/tag/add_tag_to_entry.yml +315 -0
  21. data/spec/fixtures/vcr_cassettes/tag/all.yml +252 -0
  22. data/spec/fixtures/vcr_cassettes/tag/create_asset_with_tags.yml +147 -0
  23. data/spec/fixtures/vcr_cassettes/tag/create_entry_with_tags.yml +293 -0
  24. data/spec/fixtures/vcr_cassettes/tag/create_visibility_private.yml +125 -0
  25. data/spec/fixtures/vcr_cassettes/tag/create_visibility_public.yml +125 -0
  26. data/spec/fixtures/vcr_cassettes/tag/destroy.yml +208 -0
  27. data/spec/fixtures/vcr_cassettes/tag/destroy_referenced.yml +226 -0
  28. data/spec/fixtures/vcr_cassettes/tag/find.yml +125 -0
  29. data/spec/fixtures/vcr_cassettes/tag/not_found.yml +98 -0
  30. data/spec/fixtures/vcr_cassettes/tag/remove_tag_from_asset.yml +456 -0
  31. data/spec/fixtures/vcr_cassettes/tag/remove_tag_from_entry.yml +315 -0
  32. data/spec/fixtures/vcr_cassettes/tag/update.yml +251 -0
  33. data/spec/lib/contentful/management/editor_interface_spec.rb +30 -0
  34. data/spec/lib/contentful/management/entry_spec.rb +11 -0
  35. data/spec/lib/contentful/management/environment_spec.rb +12 -0
  36. data/spec/lib/contentful/management/tag_spec.rb +186 -0
  37. metadata +45 -7
  38. data/.travis.yml +0 -12
@@ -0,0 +1,496 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/yr5m0jky5hsh/environments/master/entries/4Rouux8SoUCKwkyCq2I0E0
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/3.4.0; platform ruby/3.0.0; os macOS/21;
12
+ Authorization:
13
+ - Bearer <ACCESS_TOKEN>
14
+ Content-Type:
15
+ - application/vnd.contentful.management.v1+json
16
+ Connection:
17
+ - close
18
+ Host:
19
+ - api.contentful.com
20
+ User-Agent:
21
+ - http.rb/4.4.1
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Connection:
28
+ - close
29
+ Content-Length:
30
+ - '1634'
31
+ Content-Type:
32
+ - application/vnd.contentful.management.v1+json
33
+ X-Contentful-Ratelimit-Hour-Remaining:
34
+ - '35999'
35
+ X-Contentful-Ratelimit-Second-Remaining:
36
+ - '9'
37
+ X-Contentful-Ratelimit-Hour-Limit:
38
+ - '36000'
39
+ X-Contentful-Ratelimit-Second-Limit:
40
+ - '10'
41
+ X-Contentful-Ratelimit-Reset:
42
+ - '0'
43
+ Accept-Patch:
44
+ - application/json-patch+json
45
+ Cf-Environment-Id:
46
+ - master
47
+ Cf-Environment-Uuid:
48
+ - master
49
+ Cf-Space-Id:
50
+ - yr5m0jky5hsh
51
+ Etag:
52
+ - '"7516995411287516067"'
53
+ X-Contentful-Route:
54
+ - "/spaces/:space/environments/:environment/entries/:id"
55
+ Strict-Transport-Security:
56
+ - max-age=15768000
57
+ X-Content-Type-Options:
58
+ - nosniff
59
+ Contentful-Api:
60
+ - cma
61
+ Server:
62
+ - Contentful
63
+ Contentful-Upstream:
64
+ - content-api
65
+ Access-Control-Allow-Origin:
66
+ - "*"
67
+ Access-Control-Allow-Headers:
68
+ - 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-Tag-Visibility,X-Contentful-User-Agent,X-Contentful-Enable-Alpha-Feature,X-Contentful-Source-Environment,X-Contentful-Team,X-Contentful-Parent-Id,x-contentful-validate-only,X-Contentful-Skip-UI-Draft-Validation,X-Contentful-Marketplace,X-Contentful-UI-Content-Auto-Save,cf-trace
69
+ Access-Control-Expose-Headers:
70
+ - Etag
71
+ Access-Control-Allow-Methods:
72
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
73
+ Access-Control-Max-Age:
74
+ - '1728000'
75
+ Cache-Control:
76
+ - no-store
77
+ Accept-Ranges:
78
+ - bytes
79
+ Date:
80
+ - Tue, 07 Jun 2022 08:10:26 GMT
81
+ X-Contentful-Request-Id:
82
+ - c459707d-a600-4711-b45a-4e6c5c46e3fc
83
+ body:
84
+ encoding: ASCII-8BIT
85
+ string: |
86
+ {
87
+ "metadata": {
88
+ "tags": []
89
+ },
90
+ "sys": {
91
+ "space": {
92
+ "sys": {
93
+ "type": "Link",
94
+ "linkType": "Space",
95
+ "id": "yr5m0jky5hsh"
96
+ }
97
+ },
98
+ "id": "4Rouux8SoUCKwkyCq2I0E0",
99
+ "type": "Entry",
100
+ "createdAt": "2022-05-05T08:31:57.029Z",
101
+ "updatedAt": "2022-05-10T06:57:20.997Z",
102
+ "environment": {
103
+ "sys": {
104
+ "id": "master",
105
+ "type": "Link",
106
+ "linkType": "Environment"
107
+ }
108
+ },
109
+ "publishedVersion": 5,
110
+ "publishedAt": "2022-05-10T06:57:20.997Z",
111
+ "firstPublishedAt": "2022-05-05T08:32:19.385Z",
112
+ "createdBy": {
113
+ "sys": {
114
+ "type": "Link",
115
+ "linkType": "User",
116
+ "id": "59Erm8D1JuuD273aXNb65T"
117
+ }
118
+ },
119
+ "updatedBy": {
120
+ "sys": {
121
+ "type": "Link",
122
+ "linkType": "User",
123
+ "id": "59Erm8D1JuuD273aXNb65T"
124
+ }
125
+ },
126
+ "publishedCounter": 2,
127
+ "version": 6,
128
+ "publishedBy": {
129
+ "sys": {
130
+ "type": "Link",
131
+ "linkType": "User",
132
+ "id": "59Erm8D1JuuD273aXNb65T"
133
+ }
134
+ },
135
+ "contentType": {
136
+ "sys": {
137
+ "type": "Link",
138
+ "linkType": "ContentType",
139
+ "id": "withReferences"
140
+ }
141
+ }
142
+ },
143
+ "fields": {
144
+ "title": {
145
+ "en-US": "first ref"
146
+ },
147
+ "ref1": {
148
+ "en-US": {
149
+ "sys": {
150
+ "type": "Link",
151
+ "linkType": "Entry",
152
+ "id": "K1ONQrCXf2N7G6wjboGZu"
153
+ }
154
+ }
155
+ },
156
+ "ref21": {
157
+ "en-US": [
158
+ {
159
+ "sys": {
160
+ "type": "Link",
161
+ "linkType": "Entry",
162
+ "id": "5W0cO0oCa4yDh2Z5CvoVxZ"
163
+ }
164
+ }
165
+ ]
166
+ }
167
+ }
168
+ }
169
+ http_version:
170
+ recorded_at: Tue, 07 Jun 2022 08:10:26 GMT
171
+ - request:
172
+ method: get
173
+ uri: https://api.contentful.com/spaces/yr5m0jky5hsh/environments/master/entries/4Rouux8SoUCKwkyCq2I0E0/references?include=1
174
+ body:
175
+ encoding: UTF-8
176
+ string: ''
177
+ headers:
178
+ X-Contentful-User-Agent:
179
+ - sdk contentful-management.rb/3.4.0; platform ruby/3.0.0; os macOS/21;
180
+ Authorization:
181
+ - Bearer <ACCESS_TOKEN>
182
+ Content-Type:
183
+ - application/vnd.contentful.management.v1+json
184
+ Connection:
185
+ - close
186
+ Host:
187
+ - api.contentful.com
188
+ User-Agent:
189
+ - http.rb/4.4.1
190
+ response:
191
+ status:
192
+ code: 200
193
+ message: OK
194
+ headers:
195
+ Connection:
196
+ - close
197
+ Content-Length:
198
+ - '5861'
199
+ Content-Type:
200
+ - application/vnd.contentful.management.v1+json
201
+ X-Contentful-Ratelimit-Hour-Remaining:
202
+ - '35998'
203
+ X-Contentful-Ratelimit-Second-Remaining:
204
+ - '8'
205
+ X-Contentful-Ratelimit-Hour-Limit:
206
+ - '36000'
207
+ X-Contentful-Ratelimit-Second-Limit:
208
+ - '10'
209
+ X-Contentful-Ratelimit-Reset:
210
+ - '0'
211
+ Accept-Patch:
212
+ - application/json-patch+json
213
+ Cf-Environment-Id:
214
+ - master
215
+ Cf-Environment-Uuid:
216
+ - master
217
+ Cf-Space-Id:
218
+ - yr5m0jky5hsh
219
+ Etag:
220
+ - '"14536440406235544239"'
221
+ X-Contentful-Route:
222
+ - "/spaces/:space/environments/:environment/entries/:id/references"
223
+ Strict-Transport-Security:
224
+ - max-age=15768000
225
+ X-Content-Type-Options:
226
+ - nosniff
227
+ Contentful-Api:
228
+ - cma
229
+ Server:
230
+ - Contentful
231
+ Contentful-Upstream:
232
+ - content-api
233
+ Access-Control-Allow-Origin:
234
+ - "*"
235
+ Access-Control-Allow-Headers:
236
+ - 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-Tag-Visibility,X-Contentful-User-Agent,X-Contentful-Enable-Alpha-Feature,X-Contentful-Source-Environment,X-Contentful-Team,X-Contentful-Parent-Id,x-contentful-validate-only,X-Contentful-Skip-UI-Draft-Validation,X-Contentful-Marketplace,X-Contentful-UI-Content-Auto-Save,cf-trace
237
+ Access-Control-Expose-Headers:
238
+ - Etag
239
+ Access-Control-Allow-Methods:
240
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
241
+ Access-Control-Max-Age:
242
+ - '1728000'
243
+ Cache-Control:
244
+ - no-store
245
+ Accept-Ranges:
246
+ - bytes
247
+ Date:
248
+ - Tue, 07 Jun 2022 08:10:27 GMT
249
+ X-Contentful-Request-Id:
250
+ - 1fcefb5b-0bb5-4840-895e-9c9a7603406e
251
+ body:
252
+ encoding: ASCII-8BIT
253
+ string: |
254
+ {
255
+ "sys": {
256
+ "type": "Array"
257
+ },
258
+ "items": [
259
+ {
260
+ "metadata": {
261
+ "tags": []
262
+ },
263
+ "sys": {
264
+ "space": {
265
+ "sys": {
266
+ "type": "Link",
267
+ "linkType": "Space",
268
+ "id": "yr5m0jky5hsh"
269
+ }
270
+ },
271
+ "id": "4Rouux8SoUCKwkyCq2I0E0",
272
+ "type": "Entry",
273
+ "createdAt": "2022-05-05T08:31:57.029Z",
274
+ "updatedAt": "2022-05-10T06:57:20.997Z",
275
+ "environment": {
276
+ "sys": {
277
+ "id": "master",
278
+ "type": "Link",
279
+ "linkType": "Environment"
280
+ }
281
+ },
282
+ "publishedVersion": 5,
283
+ "publishedAt": "2022-05-10T06:57:20.997Z",
284
+ "firstPublishedAt": "2022-05-05T08:32:19.385Z",
285
+ "createdBy": {
286
+ "sys": {
287
+ "type": "Link",
288
+ "linkType": "User",
289
+ "id": "59Erm8D1JuuD273aXNb65T"
290
+ }
291
+ },
292
+ "updatedBy": {
293
+ "sys": {
294
+ "type": "Link",
295
+ "linkType": "User",
296
+ "id": "59Erm8D1JuuD273aXNb65T"
297
+ }
298
+ },
299
+ "publishedCounter": 2,
300
+ "version": 6,
301
+ "publishedBy": {
302
+ "sys": {
303
+ "type": "Link",
304
+ "linkType": "User",
305
+ "id": "59Erm8D1JuuD273aXNb65T"
306
+ }
307
+ },
308
+ "contentType": {
309
+ "sys": {
310
+ "type": "Link",
311
+ "linkType": "ContentType",
312
+ "id": "withReferences"
313
+ }
314
+ }
315
+ },
316
+ "fields": {
317
+ "title": {
318
+ "en-US": "first ref"
319
+ },
320
+ "ref1": {
321
+ "en-US": {
322
+ "sys": {
323
+ "type": "Link",
324
+ "linkType": "Entry",
325
+ "id": "K1ONQrCXf2N7G6wjboGZu"
326
+ }
327
+ }
328
+ },
329
+ "ref21": {
330
+ "en-US": [
331
+ {
332
+ "sys": {
333
+ "type": "Link",
334
+ "linkType": "Entry",
335
+ "id": "5W0cO0oCa4yDh2Z5CvoVxZ"
336
+ }
337
+ }
338
+ ]
339
+ }
340
+ }
341
+ }
342
+ ],
343
+ "includes": {
344
+ "Entry": [
345
+ {
346
+ "metadata": {
347
+ "tags": []
348
+ },
349
+ "sys": {
350
+ "space": {
351
+ "sys": {
352
+ "type": "Link",
353
+ "linkType": "Space",
354
+ "id": "yr5m0jky5hsh"
355
+ }
356
+ },
357
+ "id": "5W0cO0oCa4yDh2Z5CvoVxZ",
358
+ "type": "Entry",
359
+ "createdAt": "2022-05-10T06:56:06.593Z",
360
+ "updatedAt": "2022-05-10T06:57:16.956Z",
361
+ "environment": {
362
+ "sys": {
363
+ "id": "master",
364
+ "type": "Link",
365
+ "linkType": "Environment"
366
+ }
367
+ },
368
+ "publishedVersion": 4,
369
+ "publishedAt": "2022-05-10T06:57:16.956Z",
370
+ "firstPublishedAt": "2022-05-10T06:57:16.956Z",
371
+ "createdBy": {
372
+ "sys": {
373
+ "type": "Link",
374
+ "linkType": "User",
375
+ "id": "59Erm8D1JuuD273aXNb65T"
376
+ }
377
+ },
378
+ "updatedBy": {
379
+ "sys": {
380
+ "type": "Link",
381
+ "linkType": "User",
382
+ "id": "59Erm8D1JuuD273aXNb65T"
383
+ }
384
+ },
385
+ "publishedCounter": 1,
386
+ "version": 5,
387
+ "publishedBy": {
388
+ "sys": {
389
+ "type": "Link",
390
+ "linkType": "User",
391
+ "id": "59Erm8D1JuuD273aXNb65T"
392
+ }
393
+ },
394
+ "automationTags": [],
395
+ "contentType": {
396
+ "sys": {
397
+ "type": "Link",
398
+ "linkType": "ContentType",
399
+ "id": "footer"
400
+ }
401
+ }
402
+ },
403
+ "fields": {
404
+ "title": {
405
+ "en-US": "footer1"
406
+ },
407
+ "foobarRef": {
408
+ "en-US": [
409
+ {
410
+ "sys": {
411
+ "type": "Link",
412
+ "linkType": "Entry",
413
+ "id": "6zLEPQQNT9XZI3Ret5NcpV"
414
+ }
415
+ },
416
+ {
417
+ "sys": {
418
+ "type": "Link",
419
+ "linkType": "Entry",
420
+ "id": "5qPzFnmjTsobP7R6JldiTN"
421
+ }
422
+ }
423
+ ]
424
+ }
425
+ }
426
+ },
427
+ {
428
+ "metadata": {
429
+ "tags": []
430
+ },
431
+ "sys": {
432
+ "space": {
433
+ "sys": {
434
+ "type": "Link",
435
+ "linkType": "Space",
436
+ "id": "yr5m0jky5hsh"
437
+ }
438
+ },
439
+ "id": "K1ONQrCXf2N7G6wjboGZu",
440
+ "type": "Entry",
441
+ "createdAt": "2022-05-05T08:32:06.913Z",
442
+ "updatedAt": "2022-05-05T08:32:13.839Z",
443
+ "environment": {
444
+ "sys": {
445
+ "id": "master",
446
+ "type": "Link",
447
+ "linkType": "Environment"
448
+ }
449
+ },
450
+ "publishedVersion": 2,
451
+ "publishedAt": "2022-05-05T08:32:13.839Z",
452
+ "firstPublishedAt": "2022-05-05T08:32:13.839Z",
453
+ "createdBy": {
454
+ "sys": {
455
+ "type": "Link",
456
+ "linkType": "User",
457
+ "id": "59Erm8D1JuuD273aXNb65T"
458
+ }
459
+ },
460
+ "updatedBy": {
461
+ "sys": {
462
+ "type": "Link",
463
+ "linkType": "User",
464
+ "id": "59Erm8D1JuuD273aXNb65T"
465
+ }
466
+ },
467
+ "publishedCounter": 1,
468
+ "version": 3,
469
+ "publishedBy": {
470
+ "sys": {
471
+ "type": "Link",
472
+ "linkType": "User",
473
+ "id": "59Erm8D1JuuD273aXNb65T"
474
+ }
475
+ },
476
+ "automationTags": [],
477
+ "contentType": {
478
+ "sys": {
479
+ "type": "Link",
480
+ "linkType": "ContentType",
481
+ "id": "simple"
482
+ }
483
+ }
484
+ },
485
+ "fields": {
486
+ "name": {
487
+ "en-US": "simplwaala"
488
+ }
489
+ }
490
+ }
491
+ ]
492
+ }
493
+ }
494
+ http_version:
495
+ recorded_at: Tue, 07 Jun 2022 08:10:27 GMT
496
+ recorded_with: VCR 4.0.0