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:25:26 GMT
85
+ X-Contentful-Request-Id:
86
+ - 908bb6c6-19da-4013-aa47-8f0cbd9a7898
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:25:26 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
+ - '1747'
159
+ Content-Type:
160
+ - application/vnd.contentful.management.v1+json
161
+ X-Contentful-Ratelimit-Hour-Remaining:
162
+ - '35998'
163
+ X-Contentful-Ratelimit-Second-Remaining:
164
+ - '8'
165
+ X-Contentful-Ratelimit-Hour-Limit:
166
+ - '36000'
167
+ X-Contentful-Ratelimit-Second-Limit:
168
+ - '10'
169
+ X-Contentful-Ratelimit-Reset:
170
+ - '0'
171
+ Cf-Environment-Id:
172
+ - master
173
+ Cf-Environment-Uuid:
174
+ - master
175
+ Cf-Space-Id:
176
+ - o4h6g9w3pooi
177
+ Etag:
178
+ - '"15097476158790064399"'
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:25:26 GMT
207
+ X-Contentful-Request-Id:
208
+ - 6b622ae0-6e72-4010-ae76-4d3dbd7019ac
209
+ body:
210
+ encoding: ASCII-8BIT
211
+ string: |
212
+ {
213
+ "metadata": {
214
+ "tags": [
215
+ {
216
+ "sys": {
217
+ "type": "Link",
218
+ "linkType": "Tag",
219
+ "id": "fooTag"
220
+ }
221
+ }
222
+ ]
223
+ },
224
+ "sys": {
225
+ "space": {
226
+ "sys": {
227
+ "type": "Link",
228
+ "linkType": "Space",
229
+ "id": "o4h6g9w3pooi"
230
+ }
231
+ },
232
+ "id": "686aLBcjj1f47uFWxrepj6",
233
+ "type": "Asset",
234
+ "createdAt": "2021-02-06T05:58:29.133Z",
235
+ "updatedAt": "2022-04-19T15:10:01.146Z",
236
+ "environment": {
237
+ "sys": {
238
+ "id": "master",
239
+ "type": "Link",
240
+ "linkType": "Environment"
241
+ }
242
+ },
243
+ "publishedVersion": 14,
244
+ "publishedAt": "2022-04-13T03:57:58.082Z",
245
+ "firstPublishedAt": "2021-02-06T05:59:37.794Z",
246
+ "createdBy": {
247
+ "sys": {
248
+ "type": "Link",
249
+ "linkType": "User",
250
+ "id": "59Erm8D1JuuD273aXNb65T"
251
+ }
252
+ },
253
+ "updatedBy": {
254
+ "sys": {
255
+ "type": "Link",
256
+ "linkType": "User",
257
+ "id": "59Erm8D1JuuD273aXNb65T"
258
+ }
259
+ },
260
+ "publishedCounter": 4,
261
+ "version": 18,
262
+ "publishedBy": {
263
+ "sys": {
264
+ "type": "Link",
265
+ "linkType": "User",
266
+ "id": "59Erm8D1JuuD273aXNb65T"
267
+ }
268
+ }
269
+ },
270
+ "fields": {
271
+ "title": {
272
+ "en-US": "Avatar"
273
+ },
274
+ "description": {
275
+ "en-US": "my photo"
276
+ },
277
+ "file": {
278
+ "en-US": {
279
+ "url": "//images.ctfassets.net/o4h6g9w3pooi/686aLBcjj1f47uFWxrepj6/3bd27e35028b8210ca732eb037f4b567/WhatsApp_Image_2019-06-25_at_12.17.04.jpeg",
280
+ "details": {
281
+ "size": 108963,
282
+ "image": {
283
+ "width": 868,
284
+ "height": 1000
285
+ }
286
+ },
287
+ "fileName": "WhatsApp Image 2019-06-25 at 12.17.04.jpeg",
288
+ "contentType": "image/jpeg"
289
+ }
290
+ }
291
+ }
292
+ }
293
+ http_version:
294
+ recorded_at: Tue, 19 Apr 2022 15:25:26 GMT
295
+ - request:
296
+ method: put
297
+ uri: https://api.contentful.com/spaces/o4h6g9w3pooi/environments/master/assets/686aLBcjj1f47uFWxrepj6
298
+ body:
299
+ encoding: UTF-8
300
+ 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
301
+ Image 2019-06-25 at 12.17.04.jpeg","contentType":"image/jpeg"}}},"metadata":{"tags":[]}}'
302
+ headers:
303
+ X-Contentful-User-Agent:
304
+ - sdk contentful-management.rb/3.3.0; platform ruby/2.7.2; os macOS/21;
305
+ Authorization:
306
+ - Bearer <ACCESS_TOKEN>
307
+ Content-Type:
308
+ - application/vnd.contentful.management.v1+json
309
+ X-Contentful-Version:
310
+ - '18'
311
+ Version:
312
+ - '18'
313
+ Connection:
314
+ - close
315
+ Host:
316
+ - api.contentful.com
317
+ User-Agent:
318
+ - http.rb/4.4.1
319
+ response:
320
+ status:
321
+ code: 200
322
+ message: OK
323
+ headers:
324
+ Connection:
325
+ - close
326
+ Content-Length:
327
+ - '1619'
328
+ Content-Type:
329
+ - application/vnd.contentful.management.v1+json
330
+ X-Contentful-Ratelimit-Second-Limit:
331
+ - '10'
332
+ X-Contentful-Ratelimit-Reset:
333
+ - '0'
334
+ X-Contentful-Ratelimit-Hour-Remaining:
335
+ - '35999'
336
+ X-Contentful-Ratelimit-Second-Remaining:
337
+ - '9'
338
+ X-Contentful-Ratelimit-Hour-Limit:
339
+ - '36000'
340
+ Cf-Environment-Id:
341
+ - master
342
+ Cf-Environment-Uuid:
343
+ - master
344
+ Cf-Space-Id:
345
+ - o4h6g9w3pooi
346
+ Etag:
347
+ - '"2102620886533987886"'
348
+ X-Contentful-Route:
349
+ - "/spaces/:space/environments/:environment/assets/:id"
350
+ Strict-Transport-Security:
351
+ - max-age=15768000
352
+ X-Content-Type-Options:
353
+ - nosniff
354
+ Contentful-Api:
355
+ - cma
356
+ Server:
357
+ - Contentful
358
+ Contentful-Upstream:
359
+ - content-api
360
+ Access-Control-Allow-Origin:
361
+ - "*"
362
+ Access-Control-Allow-Headers:
363
+ - 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
364
+ Access-Control-Expose-Headers:
365
+ - Etag
366
+ Access-Control-Allow-Methods:
367
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
368
+ Access-Control-Max-Age:
369
+ - '1728000'
370
+ Cache-Control:
371
+ - no-store
372
+ Accept-Ranges:
373
+ - bytes
374
+ Date:
375
+ - Tue, 19 Apr 2022 15:25:27 GMT
376
+ X-Contentful-Request-Id:
377
+ - 1512c311-add9-4511-a9b9-184508ca30ff
378
+ body:
379
+ encoding: ASCII-8BIT
380
+ string: |
381
+ {
382
+ "metadata": {
383
+ "tags": []
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:25:27.361Z",
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": 19,
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:25:27 GMT
456
+ recorded_with: VCR 4.0.0