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,456 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/o4h6g9w3pooi/environments/master
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/3.3.0; platform ruby/2.7.2; 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
+ - '688'
31
+ Content-Type:
32
+ - application/vnd.contentful.management.v1+json
33
+ X-Contentful-Ratelimit-Reset:
34
+ - '0'
35
+ X-Contentful-Ratelimit-Hour-Remaining:
36
+ - '35999'
37
+ X-Contentful-Ratelimit-Second-Remaining:
38
+ - '9'
39
+ X-Contentful-Ratelimit-Hour-Limit:
40
+ - '36000'
41
+ X-Contentful-Ratelimit-Second-Limit:
42
+ - '10'
43
+ Accept-Ranges:
44
+ - bytes
45
+ Cf-Organization-Id:
46
+ - 4kQeJmhUWIKtNNmMkketza
47
+ Cf-Space-Id:
48
+ - o4h6g9w3pooi
49
+ Etag:
50
+ - W/"1306585c8e58f0da92149c1d8c2ab520"
51
+ Referrer-Policy:
52
+ - strict-origin-when-cross-origin
53
+ X-Content-Type-Options:
54
+ - nosniff
55
+ X-Contentful-Route:
56
+ - "/spaces/:space_id/environments/:id"
57
+ X-Download-Options:
58
+ - noopen
59
+ X-Permitted-Cross-Domain-Policies:
60
+ - none
61
+ X-Xss-Protection:
62
+ - '0'
63
+ Strict-Transport-Security:
64
+ - max-age=15768000
65
+ Server:
66
+ - Contentful
67
+ Contentful-Api:
68
+ - cma
69
+ Contentful-Upstream:
70
+ - gatekeeper
71
+ Access-Control-Allow-Origin:
72
+ - "*"
73
+ Access-Control-Allow-Headers:
74
+ - 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
75
+ Access-Control-Expose-Headers:
76
+ - Etag
77
+ Access-Control-Allow-Methods:
78
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
79
+ Access-Control-Max-Age:
80
+ - '1728000'
81
+ Cache-Control:
82
+ - no-store
83
+ Date:
84
+ - Tue, 19 Apr 2022 15:26:35 GMT
85
+ X-Contentful-Request-Id:
86
+ - 6e1d2f68-6d9f-4171-b5ce-abd480571161
87
+ body:
88
+ encoding: ASCII-8BIT
89
+ string: |+
90
+ {
91
+ "name":"master",
92
+ "sys":{
93
+ "type":"Environment",
94
+ "id":"master",
95
+ "version":1,
96
+ "space":{
97
+ "sys":{
98
+ "type":"Link",
99
+ "linkType":"Space",
100
+ "id":"o4h6g9w3pooi"
101
+ }
102
+ },
103
+ "status":{
104
+ "sys":{
105
+ "type":"Link",
106
+ "linkType":"Status",
107
+ "id":"ready"
108
+ }
109
+ },
110
+ "createdBy":{
111
+ "sys":{
112
+ "type":"Link",
113
+ "linkType":"User",
114
+ "id":"5HvjqrbdXRupD8jmTsskvE"
115
+ }
116
+ },
117
+ "createdAt":"2020-11-02T09:11:49Z",
118
+ "updatedBy":{
119
+ "sys":{
120
+ "type":"Link",
121
+ "linkType":"User",
122
+ "id":"5HvjqrbdXRupD8jmTsskvE"
123
+ }
124
+ },
125
+ "updatedAt":"2020-11-02T09:11:49Z"
126
+ }
127
+ }
128
+
129
+ http_version:
130
+ recorded_at: Tue, 19 Apr 2022 15:26:35 GMT
131
+ - request:
132
+ method: get
133
+ uri: https://api.contentful.com/spaces/o4h6g9w3pooi/environments/master/assets/686aLBcjj1f47uFWxrepj6
134
+ body:
135
+ encoding: UTF-8
136
+ string: ''
137
+ headers:
138
+ X-Contentful-User-Agent:
139
+ - sdk contentful-management.rb/3.3.0; platform ruby/2.7.2; os macOS/21;
140
+ Authorization:
141
+ - Bearer <ACCESS_TOKEN>
142
+ Content-Type:
143
+ - application/vnd.contentful.management.v1+json
144
+ Connection:
145
+ - close
146
+ Host:
147
+ - api.contentful.com
148
+ User-Agent:
149
+ - http.rb/4.4.1
150
+ response:
151
+ status:
152
+ code: 200
153
+ message: OK
154
+ headers:
155
+ Connection:
156
+ - close
157
+ Content-Length:
158
+ - '1619'
159
+ Content-Type:
160
+ - application/vnd.contentful.management.v1+json
161
+ X-Contentful-Ratelimit-Second-Limit:
162
+ - '10'
163
+ X-Contentful-Ratelimit-Reset:
164
+ - '0'
165
+ X-Contentful-Ratelimit-Hour-Remaining:
166
+ - '35999'
167
+ X-Contentful-Ratelimit-Second-Remaining:
168
+ - '9'
169
+ X-Contentful-Ratelimit-Hour-Limit:
170
+ - '36000'
171
+ Cf-Environment-Id:
172
+ - master
173
+ Cf-Environment-Uuid:
174
+ - master
175
+ Cf-Space-Id:
176
+ - o4h6g9w3pooi
177
+ Etag:
178
+ - '"2102620886533987886"'
179
+ X-Contentful-Route:
180
+ - "/spaces/:space/environments/:environment/assets/:id"
181
+ Strict-Transport-Security:
182
+ - max-age=15768000
183
+ X-Content-Type-Options:
184
+ - nosniff
185
+ Contentful-Api:
186
+ - cma
187
+ Server:
188
+ - Contentful
189
+ Contentful-Upstream:
190
+ - content-api
191
+ Access-Control-Allow-Origin:
192
+ - "*"
193
+ Access-Control-Allow-Headers:
194
+ - 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
195
+ Access-Control-Expose-Headers:
196
+ - Etag
197
+ Access-Control-Allow-Methods:
198
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
199
+ Access-Control-Max-Age:
200
+ - '1728000'
201
+ Cache-Control:
202
+ - no-store
203
+ Accept-Ranges:
204
+ - bytes
205
+ Date:
206
+ - Tue, 19 Apr 2022 15:26:36 GMT
207
+ X-Contentful-Request-Id:
208
+ - 78386731-cffe-46fc-af59-bcdef6ceb984
209
+ body:
210
+ encoding: ASCII-8BIT
211
+ string: |
212
+ {
213
+ "metadata": {
214
+ "tags": []
215
+ },
216
+ "sys": {
217
+ "space": {
218
+ "sys": {
219
+ "type": "Link",
220
+ "linkType": "Space",
221
+ "id": "o4h6g9w3pooi"
222
+ }
223
+ },
224
+ "id": "686aLBcjj1f47uFWxrepj6",
225
+ "type": "Asset",
226
+ "createdAt": "2021-02-06T05:58:29.133Z",
227
+ "updatedAt": "2022-04-19T15:25:27.361Z",
228
+ "environment": {
229
+ "sys": {
230
+ "id": "master",
231
+ "type": "Link",
232
+ "linkType": "Environment"
233
+ }
234
+ },
235
+ "publishedVersion": 14,
236
+ "publishedAt": "2022-04-13T03:57:58.082Z",
237
+ "firstPublishedAt": "2021-02-06T05:59:37.794Z",
238
+ "createdBy": {
239
+ "sys": {
240
+ "type": "Link",
241
+ "linkType": "User",
242
+ "id": "59Erm8D1JuuD273aXNb65T"
243
+ }
244
+ },
245
+ "updatedBy": {
246
+ "sys": {
247
+ "type": "Link",
248
+ "linkType": "User",
249
+ "id": "59Erm8D1JuuD273aXNb65T"
250
+ }
251
+ },
252
+ "publishedCounter": 4,
253
+ "version": 19,
254
+ "publishedBy": {
255
+ "sys": {
256
+ "type": "Link",
257
+ "linkType": "User",
258
+ "id": "59Erm8D1JuuD273aXNb65T"
259
+ }
260
+ }
261
+ },
262
+ "fields": {
263
+ "title": {
264
+ "en-US": "Avatar"
265
+ },
266
+ "description": {
267
+ "en-US": "my photo"
268
+ },
269
+ "file": {
270
+ "en-US": {
271
+ "url": "//images.ctfassets.net/o4h6g9w3pooi/686aLBcjj1f47uFWxrepj6/3bd27e35028b8210ca732eb037f4b567/WhatsApp_Image_2019-06-25_at_12.17.04.jpeg",
272
+ "details": {
273
+ "size": 108963,
274
+ "image": {
275
+ "width": 868,
276
+ "height": 1000
277
+ }
278
+ },
279
+ "fileName": "WhatsApp Image 2019-06-25 at 12.17.04.jpeg",
280
+ "contentType": "image/jpeg"
281
+ }
282
+ }
283
+ }
284
+ }
285
+ http_version:
286
+ recorded_at: Tue, 19 Apr 2022 15:26:36 GMT
287
+ - request:
288
+ method: put
289
+ uri: https://api.contentful.com/spaces/o4h6g9w3pooi/environments/master/assets/686aLBcjj1f47uFWxrepj6
290
+ body:
291
+ encoding: UTF-8
292
+ string: '{"fields":{"title":{"en-US":"Avatar"},"description":{"en-US":"my photo"},"file":{"en-US":{"details":{"size":108963,"image":{"width":868,"height":1000}},"url":"//images.ctfassets.net/o4h6g9w3pooi/686aLBcjj1f47uFWxrepj6/3bd27e35028b8210ca732eb037f4b567/WhatsApp_Image_2019-06-25_at_12.17.04.jpeg","fileName":"WhatsApp
293
+ Image 2019-06-25 at 12.17.04.jpeg","contentType":"image/jpeg"}}},"metadata":{"tags":[{"sys":{"type":"Link","linkType":"Tag","id":"icon"}}]}}'
294
+ headers:
295
+ X-Contentful-User-Agent:
296
+ - sdk contentful-management.rb/3.3.0; platform ruby/2.7.2; os macOS/21;
297
+ Authorization:
298
+ - Bearer <ACCESS_TOKEN>
299
+ Content-Type:
300
+ - application/vnd.contentful.management.v1+json
301
+ X-Contentful-Version:
302
+ - '19'
303
+ Version:
304
+ - '19'
305
+ Connection:
306
+ - close
307
+ Host:
308
+ - api.contentful.com
309
+ User-Agent:
310
+ - http.rb/4.4.1
311
+ response:
312
+ status:
313
+ code: 200
314
+ message: OK
315
+ headers:
316
+ Connection:
317
+ - close
318
+ Content-Length:
319
+ - '1745'
320
+ Content-Type:
321
+ - application/vnd.contentful.management.v1+json
322
+ X-Contentful-Ratelimit-Second-Limit:
323
+ - '10'
324
+ X-Contentful-Ratelimit-Reset:
325
+ - '0'
326
+ X-Contentful-Ratelimit-Hour-Remaining:
327
+ - '35998'
328
+ X-Contentful-Ratelimit-Second-Remaining:
329
+ - '8'
330
+ X-Contentful-Ratelimit-Hour-Limit:
331
+ - '36000'
332
+ Cf-Environment-Id:
333
+ - master
334
+ Cf-Environment-Uuid:
335
+ - master
336
+ Cf-Space-Id:
337
+ - o4h6g9w3pooi
338
+ Etag:
339
+ - '"2380613190790968201"'
340
+ X-Contentful-Route:
341
+ - "/spaces/:space/environments/:environment/assets/:id"
342
+ Strict-Transport-Security:
343
+ - max-age=15768000
344
+ X-Content-Type-Options:
345
+ - nosniff
346
+ Contentful-Api:
347
+ - cma
348
+ Server:
349
+ - Contentful
350
+ Contentful-Upstream:
351
+ - content-api
352
+ Access-Control-Allow-Origin:
353
+ - "*"
354
+ Access-Control-Allow-Headers:
355
+ - 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
356
+ Access-Control-Expose-Headers:
357
+ - Etag
358
+ Access-Control-Allow-Methods:
359
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
360
+ Access-Control-Max-Age:
361
+ - '1728000'
362
+ Cache-Control:
363
+ - no-store
364
+ Accept-Ranges:
365
+ - bytes
366
+ Date:
367
+ - Tue, 19 Apr 2022 15:26:37 GMT
368
+ X-Contentful-Request-Id:
369
+ - 6523a88f-e3ce-4e6f-841d-14893cb0ac0b
370
+ body:
371
+ encoding: ASCII-8BIT
372
+ string: |
373
+ {
374
+ "metadata": {
375
+ "tags": [
376
+ {
377
+ "sys": {
378
+ "type": "Link",
379
+ "linkType": "Tag",
380
+ "id": "icon"
381
+ }
382
+ }
383
+ ]
384
+ },
385
+ "sys": {
386
+ "space": {
387
+ "sys": {
388
+ "type": "Link",
389
+ "linkType": "Space",
390
+ "id": "o4h6g9w3pooi"
391
+ }
392
+ },
393
+ "id": "686aLBcjj1f47uFWxrepj6",
394
+ "type": "Asset",
395
+ "createdAt": "2021-02-06T05:58:29.133Z",
396
+ "updatedAt": "2022-04-19T15:26:36.984Z",
397
+ "environment": {
398
+ "sys": {
399
+ "id": "master",
400
+ "type": "Link",
401
+ "linkType": "Environment"
402
+ }
403
+ },
404
+ "publishedVersion": 14,
405
+ "publishedAt": "2022-04-13T03:57:58.082Z",
406
+ "firstPublishedAt": "2021-02-06T05:59:37.794Z",
407
+ "createdBy": {
408
+ "sys": {
409
+ "type": "Link",
410
+ "linkType": "User",
411
+ "id": "59Erm8D1JuuD273aXNb65T"
412
+ }
413
+ },
414
+ "updatedBy": {
415
+ "sys": {
416
+ "type": "Link",
417
+ "linkType": "User",
418
+ "id": "59Erm8D1JuuD273aXNb65T"
419
+ }
420
+ },
421
+ "publishedCounter": 4,
422
+ "version": 20,
423
+ "publishedBy": {
424
+ "sys": {
425
+ "type": "Link",
426
+ "linkType": "User",
427
+ "id": "59Erm8D1JuuD273aXNb65T"
428
+ }
429
+ }
430
+ },
431
+ "fields": {
432
+ "title": {
433
+ "en-US": "Avatar"
434
+ },
435
+ "description": {
436
+ "en-US": "my photo"
437
+ },
438
+ "file": {
439
+ "en-US": {
440
+ "url": "//images.ctfassets.net/o4h6g9w3pooi/686aLBcjj1f47uFWxrepj6/3bd27e35028b8210ca732eb037f4b567/WhatsApp_Image_2019-06-25_at_12.17.04.jpeg",
441
+ "details": {
442
+ "size": 108963,
443
+ "image": {
444
+ "width": 868,
445
+ "height": 1000
446
+ }
447
+ },
448
+ "fileName": "WhatsApp Image 2019-06-25 at 12.17.04.jpeg",
449
+ "contentType": "image/jpeg"
450
+ }
451
+ }
452
+ }
453
+ }
454
+ http_version:
455
+ recorded_at: Tue, 19 Apr 2022 15:26:37 GMT
456
+ recorded_with: VCR 4.0.0