contentful-management 3.8.0 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -1
  3. data/.rubocop_todo.yml +72 -7
  4. data/CHANGELOG.md +11 -0
  5. data/contentful-management.gemspec +4 -3
  6. data/lib/contentful/management/api_key.rb +2 -0
  7. data/lib/contentful/management/array.rb +2 -0
  8. data/lib/contentful/management/asset.rb +5 -3
  9. data/lib/contentful/management/client.rb +8 -4
  10. data/lib/contentful/management/client_api_key_methods_factory.rb +2 -0
  11. data/lib/contentful/management/client_asset_methods_factory.rb +2 -0
  12. data/lib/contentful/management/client_association_all_published_method_factory.rb +2 -0
  13. data/lib/contentful/management/client_association_methods_factory.rb +2 -0
  14. data/lib/contentful/management/client_content_type_methods_factory.rb +2 -0
  15. data/lib/contentful/management/client_editor_interface_methods_factory.rb +2 -0
  16. data/lib/contentful/management/client_entry_methods_factory.rb +2 -0
  17. data/lib/contentful/management/client_environment_methods_factory.rb +2 -0
  18. data/lib/contentful/management/client_locale_methods_factory.rb +2 -0
  19. data/lib/contentful/management/client_organization_methods_factory.rb +2 -0
  20. data/lib/contentful/management/client_organization_periodic_usage_methods_factory.rb +2 -0
  21. data/lib/contentful/management/client_personal_access_tokens_methods_factory.rb +2 -0
  22. data/lib/contentful/management/client_preview_api_key_methods_factory.rb +2 -0
  23. data/lib/contentful/management/client_role_methods_factory.rb +2 -0
  24. data/lib/contentful/management/client_snapshot_methods_factory.rb +2 -0
  25. data/lib/contentful/management/client_space_membership_methods_factory.rb +2 -0
  26. data/lib/contentful/management/client_space_methods_factory.rb +2 -0
  27. data/lib/contentful/management/client_space_periodic_usage_methods_factory.rb +2 -0
  28. data/lib/contentful/management/client_tag_methods_factory.rb +2 -0
  29. data/lib/contentful/management/client_ui_extension_methods_factory.rb +2 -0
  30. data/lib/contentful/management/client_upload_methods_factory.rb +2 -0
  31. data/lib/contentful/management/client_user_methods_factory.rb +2 -0
  32. data/lib/contentful/management/client_webhook_call_methods_factory.rb +2 -0
  33. data/lib/contentful/management/client_webhook_health_methods_factory.rb +2 -0
  34. data/lib/contentful/management/client_webhook_methods_factory.rb +2 -0
  35. data/lib/contentful/management/content_type.rb +13 -11
  36. data/lib/contentful/management/content_type_editor_interface_methods_factory.rb +2 -0
  37. data/lib/contentful/management/content_type_entry_methods_factory.rb +2 -0
  38. data/lib/contentful/management/content_type_snapshot_methods_factory.rb +2 -0
  39. data/lib/contentful/management/dynamic_entry.rb +3 -3
  40. data/lib/contentful/management/editor_interface.rb +5 -3
  41. data/lib/contentful/management/entry.rb +5 -3
  42. data/lib/contentful/management/entry_association_methods_factory.rb +2 -0
  43. data/lib/contentful/management/entry_snapshot_methods_factory.rb +2 -0
  44. data/lib/contentful/management/environment.rb +2 -0
  45. data/lib/contentful/management/environment_asset_methods_factory.rb +2 -0
  46. data/lib/contentful/management/environment_association_methods_factory.rb +2 -0
  47. data/lib/contentful/management/environment_content_type_methods_factory.rb +2 -0
  48. data/lib/contentful/management/environment_editor_interface_methods_factory.rb +2 -0
  49. data/lib/contentful/management/environment_entry_methods_factory.rb +2 -0
  50. data/lib/contentful/management/environment_locale_methods_factory.rb +2 -0
  51. data/lib/contentful/management/environment_tag_methods_factory.rb +2 -0
  52. data/lib/contentful/management/environment_ui_extension_methods_factory.rb +2 -0
  53. data/lib/contentful/management/error.rb +5 -2
  54. data/lib/contentful/management/field.rb +4 -0
  55. data/lib/contentful/management/file.rb +2 -0
  56. data/lib/contentful/management/link.rb +2 -0
  57. data/lib/contentful/management/locale.rb +3 -1
  58. data/lib/contentful/management/location.rb +2 -0
  59. data/lib/contentful/management/organization.rb +2 -0
  60. data/lib/contentful/management/organization_periodic_usage.rb +2 -0
  61. data/lib/contentful/management/organization_user_methods_factory.rb +2 -0
  62. data/lib/contentful/management/personal_access_token.rb +2 -0
  63. data/lib/contentful/management/preview_api_key.rb +2 -0
  64. data/lib/contentful/management/request.rb +3 -8
  65. data/lib/contentful/management/resource/all_published.rb +2 -0
  66. data/lib/contentful/management/resource/archiver.rb +2 -0
  67. data/lib/contentful/management/resource/array_like.rb +2 -0
  68. data/lib/contentful/management/resource/asset_fields.rb +2 -0
  69. data/lib/contentful/management/resource/entry_fields.rb +2 -0
  70. data/lib/contentful/management/resource/environment_aware.rb +2 -0
  71. data/lib/contentful/management/resource/field_aware.rb +2 -0
  72. data/lib/contentful/management/resource/fields.rb +3 -1
  73. data/lib/contentful/management/resource/metadata.rb +3 -0
  74. data/lib/contentful/management/resource/publisher.rb +2 -0
  75. data/lib/contentful/management/resource/refresher.rb +3 -0
  76. data/lib/contentful/management/resource/system_properties.rb +3 -1
  77. data/lib/contentful/management/resource.rb +4 -3
  78. data/lib/contentful/management/resource_builder.rb +5 -2
  79. data/lib/contentful/management/resource_requester.rb +4 -1
  80. data/lib/contentful/management/response.rb +4 -2
  81. data/lib/contentful/management/role.rb +3 -1
  82. data/lib/contentful/management/snapshot.rb +2 -0
  83. data/lib/contentful/management/space.rb +3 -0
  84. data/lib/contentful/management/space_api_key_methods_factory.rb +2 -0
  85. data/lib/contentful/management/space_association_methods_factory.rb +2 -0
  86. data/lib/contentful/management/space_environment_methods_factory.rb +2 -0
  87. data/lib/contentful/management/space_membership.rb +2 -0
  88. data/lib/contentful/management/space_periodic_usage.rb +2 -0
  89. data/lib/contentful/management/space_preview_api_key_methods_factory.rb +2 -0
  90. data/lib/contentful/management/space_role_methods_factory.rb +2 -0
  91. data/lib/contentful/management/space_space_membership_methods_factory.rb +2 -0
  92. data/lib/contentful/management/space_user_methods_factory.rb +2 -0
  93. data/lib/contentful/management/space_webhook_methods_factory.rb +2 -0
  94. data/lib/contentful/management/support.rb +4 -2
  95. data/lib/contentful/management/tag.rb +2 -0
  96. data/lib/contentful/management/ui_extension.rb +4 -0
  97. data/lib/contentful/management/upload.rb +2 -0
  98. data/lib/contentful/management/user.rb +2 -0
  99. data/lib/contentful/management/validation.rb +2 -0
  100. data/lib/contentful/management/version.rb +3 -1
  101. data/lib/contentful/management/webhook.rb +2 -0
  102. data/lib/contentful/management/webhook_call.rb +2 -0
  103. data/lib/contentful/management/webhook_health.rb +2 -0
  104. data/lib/contentful/management/webhook_webhook_call_methods_factory.rb +2 -0
  105. data/lib/contentful/management/webhook_webhook_health_methods_factory.rb +2 -0
  106. data/lib/contentful/management.rb +2 -0
  107. data/spec/fixtures/vcr_cassettes/content_type/default_value.yml +487 -0
  108. data/spec/fixtures/vcr_cassettes/content_type/update_with_deleted_true.yml +483 -0
  109. data/spec/lib/contentful/management/content_type_spec.rb +50 -0
  110. metadata +17 -19
@@ -0,0 +1,483 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/32dbl893yf99
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/3.9.0; platform ruby/3.2.2; os Windows/ucrt;
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/5.0.1
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Connection:
28
+ - close
29
+ Content-Length:
30
+ - '594'
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
+ X-Xss-Protection:
44
+ - '0'
45
+ X-Content-Type-Options:
46
+ - nosniff
47
+ X-Download-Options:
48
+ - noopen
49
+ X-Permitted-Cross-Domain-Policies:
50
+ - none
51
+ Referrer-Policy:
52
+ - strict-origin-when-cross-origin
53
+ X-Contentful-Route:
54
+ - "/spaces/:id"
55
+ Cf-Space-Id:
56
+ - 32dbl893yf99
57
+ Cf-Organization-Id:
58
+ - 5JMqP9UrBoEuRnPSzJRKep
59
+ Cf-User-Id:
60
+ - 1cRzCWn3HdX3jCI0Gkisl6
61
+ Etag:
62
+ - W/"53a9b2eb2ba7bd06b11e0b065f3a5e70"
63
+ Content-Security-Policy:
64
+ - 'default-src ''self'' static.contentful.com; font-src ''self'' data: static.contentful.com
65
+ https://www.contentful.com fonts.googleapis.com static.contentful.com www.ctfstatic.com
66
+ fonts.gstatic.com https://use.typekit.net https://storage.googleapis.com;
67
+ img-src ''self'' data: static.contentful.com https://www.contentful.com www.ctfstatic.com
68
+ https://segments.company-target.com https://match.prod.bidr.io https://scripts.demandbase.com/
69
+ https://www.gstatic.com https://www.google-analytics.com; object-src ''none'';
70
+ script-src ''self'' static.contentful.com https://tag.demandbase.com https://autocomplete.demandbase.com
71
+ https://www.gstatic.com https://static.zuora.com https://www.recaptcha.net
72
+ https://www.google-analytics.com https://js.hcaptcha.com ''nonce-4+EDRiVrRcBxUnogmQUVEw=='';
73
+ style-src ''self'' static.contentful.com https://www.contentful.com fonts.googleapis.com
74
+ www.ctfstatic.com https://scripts.demandbase.com ''nonce-4+EDRiVrRcBxUnogmQUVEw=='';
75
+ connect-src ''self'' static.contentful.com https://api.company-target.com
76
+ https://segments.company-target.com https://www.google-analytics.com https://sentry.io;
77
+ frame-src https://*.zuora.com https://www.google.com https://www.recaptcha.net
78
+ https://newassets.hcaptcha.com; frame-ancestors ''self'' https://app.contentful.com;
79
+ report-uri https://51772a31e6668243854408567273914e.report-uri.com/r/t/csp/enforce'
80
+ Accept-Ranges:
81
+ - bytes
82
+ Cache-Control:
83
+ - max-age=0
84
+ Strict-Transport-Security:
85
+ - max-age=15768000
86
+ Server:
87
+ - Contentful
88
+ Contentful-Api:
89
+ - cma
90
+ Contentful-Upstream:
91
+ - gatekeeper
92
+ Access-Control-Allow-Origin:
93
+ - "*"
94
+ Access-Control-Allow-Headers:
95
+ - Accept,Accept-Language,Authorization,Cache-Control,CF-Context,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,X-Contentful-Comment-Body-Format,X-Contentful-Parent-Entity-Reference
96
+ Access-Control-Expose-Headers:
97
+ - Etag,x-contentful-request-id
98
+ Access-Control-Allow-Methods:
99
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
100
+ Access-Control-Max-Age:
101
+ - '1728000'
102
+ Date:
103
+ - Sat, 09 Sep 2023 03:46:18 GMT
104
+ X-Contentful-Request-Id:
105
+ - 30a936aa-d530-4e6b-96d4-112464383b7e
106
+ body:
107
+ encoding: ASCII-8BIT
108
+ string: |+
109
+ {
110
+ "name":"Blank",
111
+ "sys":{
112
+ "type":"Space",
113
+ "id":"32dbl893yf99",
114
+ "version":1,
115
+ "createdBy":{
116
+ "sys":{
117
+ "type":"Link",
118
+ "linkType":"User",
119
+ "id":"1cRzCWn3HdX3jCI0Gkisl6"
120
+ }
121
+ },
122
+ "createdAt":"2023-09-09T02:37:44Z",
123
+ "updatedBy":{
124
+ "sys":{
125
+ "type":"Link",
126
+ "linkType":"User",
127
+ "id":"1cRzCWn3HdX3jCI0Gkisl6"
128
+ }
129
+ },
130
+ "updatedAt":"2023-09-09T02:37:44Z",
131
+ "organization":{
132
+ "sys":{
133
+ "type":"Link",
134
+ "linkType":"Organization",
135
+ "id":"5JMqP9UrBoEuRnPSzJRKep"
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ recorded_at: Sat, 09 Sep 2023 03:46:18 GMT
142
+ - request:
143
+ method: put
144
+ uri: https://api.contentful.com/spaces/32dbl893yf99/environments/master/content_types/content_with_field_to_delete
145
+ body:
146
+ encoding: UTF-8
147
+ string: '{"name":"Content With Field To Delete","fields":[{"id":"field_to_delete","name":"field_to_delete","type":"Text","omitted":true}]}'
148
+ headers:
149
+ X-Contentful-User-Agent:
150
+ - sdk contentful-management.rb/3.9.0; platform ruby/3.2.2; os Windows/ucrt;
151
+ Authorization:
152
+ - Bearer <ACCESS_TOKEN>
153
+ Content-Type:
154
+ - application/vnd.contentful.management.v1+json
155
+ Connection:
156
+ - close
157
+ Host:
158
+ - api.contentful.com
159
+ User-Agent:
160
+ - http.rb/5.0.1
161
+ response:
162
+ status:
163
+ code: 201
164
+ message: Created
165
+ headers:
166
+ Connection:
167
+ - close
168
+ Content-Length:
169
+ - '730'
170
+ Content-Type:
171
+ - application/vnd.contentful.management.v1+json
172
+ X-Contentful-Ratelimit-Hour-Remaining:
173
+ - '35998'
174
+ X-Contentful-Ratelimit-Second-Remaining:
175
+ - '8'
176
+ X-Contentful-Ratelimit-Hour-Limit:
177
+ - '36000'
178
+ X-Contentful-Ratelimit-Second-Limit:
179
+ - '10'
180
+ X-Contentful-Ratelimit-Reset:
181
+ - '0'
182
+ Cf-Environment-Id:
183
+ - master
184
+ Cf-Environment-Uuid:
185
+ - master
186
+ Cf-Space-Id:
187
+ - 32dbl893yf99
188
+ Etag:
189
+ - '"867790919839850038"'
190
+ X-Contentful-Route:
191
+ - "/spaces/:space/environments/:environment/content_types/:id"
192
+ Strict-Transport-Security:
193
+ - max-age=15768000
194
+ X-Content-Type-Options:
195
+ - nosniff
196
+ Contentful-Api:
197
+ - cma
198
+ Server:
199
+ - Contentful
200
+ Contentful-Upstream:
201
+ - content-api
202
+ Access-Control-Allow-Origin:
203
+ - "*"
204
+ Access-Control-Allow-Headers:
205
+ - Accept,Accept-Language,Authorization,Cache-Control,CF-Context,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,X-Contentful-Comment-Body-Format,X-Contentful-Parent-Entity-Reference
206
+ Access-Control-Expose-Headers:
207
+ - Etag,x-contentful-request-id
208
+ Access-Control-Allow-Methods:
209
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
210
+ Access-Control-Max-Age:
211
+ - '1728000'
212
+ Accept-Ranges:
213
+ - bytes
214
+ Date:
215
+ - Sat, 09 Sep 2023 03:46:18 GMT
216
+ X-Contentful-Request-Id:
217
+ - bac10013-f9e9-4035-a91c-6e7c05e560d7
218
+ body:
219
+ encoding: ASCII-8BIT
220
+ string: '{"sys":{"space":{"sys":{"type":"Link","linkType":"Space","id":"32dbl893yf99"}},"id":"content_with_field_to_delete","type":"ContentType","createdAt":"2023-09-09T03:46:18.865Z","updatedAt":"2023-09-09T03:46:18.865Z","environment":{"sys":{"id":"master","type":"Link","linkType":"Environment"}},"createdBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}},"updatedBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}},"publishedCounter":0,"version":1},"displayField":null,"name":"Content
221
+ With Field To Delete","description":null,"fields":[{"id":"field_to_delete","name":"field_to_delete","type":"Text","localized":false,"required":false,"validations":[],"disabled":false,"omitted":true}]}
222
+
223
+ '
224
+ recorded_at: Sat, 09 Sep 2023 03:46:18 GMT
225
+ - request:
226
+ method: put
227
+ uri: https://api.contentful.com/spaces/32dbl893yf99/environments/master/content_types/content_with_field_to_delete/published
228
+ body:
229
+ encoding: UTF-8
230
+ string: ''
231
+ headers:
232
+ X-Contentful-User-Agent:
233
+ - sdk contentful-management.rb/3.9.0; platform ruby/3.2.2; os Windows/ucrt;
234
+ Authorization:
235
+ - Bearer <ACCESS_TOKEN>
236
+ Content-Type:
237
+ - application/vnd.contentful.management.v1+json
238
+ X-Contentful-Version:
239
+ - '1'
240
+ Version:
241
+ - '1'
242
+ Connection:
243
+ - close
244
+ Host:
245
+ - api.contentful.com
246
+ User-Agent:
247
+ - http.rb/5.0.1
248
+ response:
249
+ status:
250
+ code: 200
251
+ message: OK
252
+ headers:
253
+ Connection:
254
+ - close
255
+ Content-Length:
256
+ - '924'
257
+ Content-Type:
258
+ - application/vnd.contentful.management.v1+json
259
+ X-Contentful-Ratelimit-Hour-Remaining:
260
+ - '35999'
261
+ X-Contentful-Ratelimit-Second-Remaining:
262
+ - '9'
263
+ X-Contentful-Ratelimit-Hour-Limit:
264
+ - '36000'
265
+ X-Contentful-Ratelimit-Second-Limit:
266
+ - '10'
267
+ X-Contentful-Ratelimit-Reset:
268
+ - '0'
269
+ Cf-Environment-Id:
270
+ - master
271
+ Cf-Environment-Uuid:
272
+ - master
273
+ Cf-Space-Id:
274
+ - 32dbl893yf99
275
+ Etag:
276
+ - '"8267765743534796938"'
277
+ X-Contentful-Route:
278
+ - "/spaces/:space/environments/:environment/content_types/:id/published"
279
+ Strict-Transport-Security:
280
+ - max-age=15768000
281
+ X-Content-Type-Options:
282
+ - nosniff
283
+ Contentful-Api:
284
+ - cma
285
+ Server:
286
+ - Contentful
287
+ Contentful-Upstream:
288
+ - content-api
289
+ Access-Control-Allow-Origin:
290
+ - "*"
291
+ Access-Control-Allow-Headers:
292
+ - Accept,Accept-Language,Authorization,Cache-Control,CF-Context,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,X-Contentful-Comment-Body-Format,X-Contentful-Parent-Entity-Reference
293
+ Access-Control-Expose-Headers:
294
+ - Etag,x-contentful-request-id
295
+ Access-Control-Allow-Methods:
296
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
297
+ Access-Control-Max-Age:
298
+ - '1728000'
299
+ Accept-Ranges:
300
+ - bytes
301
+ Date:
302
+ - Sat, 09 Sep 2023 03:46:19 GMT
303
+ X-Contentful-Request-Id:
304
+ - 3af608ff-a1ee-40f8-91f8-24e4d847907e
305
+ body:
306
+ encoding: ASCII-8BIT
307
+ string: '{"sys":{"space":{"sys":{"type":"Link","linkType":"Space","id":"32dbl893yf99"}},"id":"content_with_field_to_delete","type":"ContentType","createdAt":"2023-09-09T03:46:18.865Z","updatedAt":"2023-09-09T03:46:19.112Z","environment":{"sys":{"id":"master","type":"Link","linkType":"Environment"}},"createdBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}},"updatedBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}},"publishedCounter":1,"version":2,"firstPublishedAt":"2023-09-09T03:46:19.112Z","publishedAt":"2023-09-09T03:46:19.112Z","publishedBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}},"publishedVersion":1},"displayField":null,"name":"Content
308
+ With Field To Delete","description":null,"fields":[{"id":"field_to_delete","name":"field_to_delete","type":"Text","localized":false,"required":false,"validations":[],"disabled":false,"omitted":true}]}
309
+
310
+ '
311
+ recorded_at: Sat, 09 Sep 2023 03:46:18 GMT
312
+ - request:
313
+ method: get
314
+ uri: https://api.contentful.com/spaces/32dbl893yf99/environments/master/content_types/content_with_field_to_delete
315
+ body:
316
+ encoding: UTF-8
317
+ string: ''
318
+ headers:
319
+ X-Contentful-User-Agent:
320
+ - sdk contentful-management.rb/3.9.0; platform ruby/3.2.2; os Windows/ucrt;
321
+ Authorization:
322
+ - Bearer <ACCESS_TOKEN>
323
+ Content-Type:
324
+ - application/vnd.contentful.management.v1+json
325
+ Connection:
326
+ - close
327
+ Host:
328
+ - api.contentful.com
329
+ User-Agent:
330
+ - http.rb/5.0.1
331
+ response:
332
+ status:
333
+ code: 200
334
+ message: OK
335
+ headers:
336
+ Connection:
337
+ - close
338
+ Content-Length:
339
+ - '924'
340
+ Content-Type:
341
+ - application/vnd.contentful.management.v1+json
342
+ X-Contentful-Ratelimit-Second-Remaining:
343
+ - '8'
344
+ X-Contentful-Ratelimit-Hour-Limit:
345
+ - '36000'
346
+ X-Contentful-Ratelimit-Second-Limit:
347
+ - '10'
348
+ X-Contentful-Ratelimit-Reset:
349
+ - '0'
350
+ X-Contentful-Ratelimit-Hour-Remaining:
351
+ - '35998'
352
+ Cf-Environment-Id:
353
+ - master
354
+ Cf-Environment-Uuid:
355
+ - master
356
+ Cf-Space-Id:
357
+ - 32dbl893yf99
358
+ Etag:
359
+ - '"10721659139756783581"'
360
+ X-Contentful-Route:
361
+ - "/spaces/:space/environments/:environment/content_types/:id"
362
+ Strict-Transport-Security:
363
+ - max-age=15768000
364
+ X-Content-Type-Options:
365
+ - nosniff
366
+ Contentful-Api:
367
+ - cma
368
+ Server:
369
+ - Contentful
370
+ Contentful-Upstream:
371
+ - content-api
372
+ Access-Control-Allow-Origin:
373
+ - "*"
374
+ Access-Control-Allow-Headers:
375
+ - Accept,Accept-Language,Authorization,Cache-Control,CF-Context,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,X-Contentful-Comment-Body-Format,X-Contentful-Parent-Entity-Reference
376
+ Access-Control-Expose-Headers:
377
+ - Etag,x-contentful-request-id
378
+ Access-Control-Allow-Methods:
379
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
380
+ Access-Control-Max-Age:
381
+ - '1728000'
382
+ Accept-Ranges:
383
+ - bytes
384
+ Date:
385
+ - Sat, 09 Sep 2023 03:46:19 GMT
386
+ X-Contentful-Request-Id:
387
+ - fa08d3dd-c7b4-4b43-976a-85f4ecf42d75
388
+ body:
389
+ encoding: ASCII-8BIT
390
+ string: '{"sys":{"space":{"sys":{"type":"Link","linkType":"Space","id":"32dbl893yf99"}},"id":"content_with_field_to_delete","type":"ContentType","createdAt":"2023-09-09T03:46:18.865Z","updatedAt":"2023-09-09T03:46:19.112Z","environment":{"sys":{"id":"master","type":"Link","linkType":"Environment"}},"publishedVersion":1,"publishedAt":"2023-09-09T03:46:19.112Z","firstPublishedAt":"2023-09-09T03:46:19.112Z","createdBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}},"updatedBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}},"publishedCounter":1,"version":2,"publishedBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}}},"displayField":null,"name":"Content
391
+ With Field To Delete","description":null,"fields":[{"id":"field_to_delete","name":"field_to_delete","type":"Text","localized":false,"required":false,"validations":[],"disabled":false,"omitted":true}]}
392
+
393
+ '
394
+ recorded_at: Sat, 09 Sep 2023 03:46:19 GMT
395
+ - request:
396
+ method: put
397
+ uri: https://api.contentful.com/spaces/32dbl893yf99/environments/master/content_types/content_with_field_to_delete
398
+ body:
399
+ encoding: UTF-8
400
+ string: '{"name":"Content With Field To Delete","fields":[{"id":"field_to_delete","name":"field_to_delete","type":"Text","omitted":true,"deleted":true}]}'
401
+ headers:
402
+ X-Contentful-User-Agent:
403
+ - sdk contentful-management.rb/3.9.0; platform ruby/3.2.2; os Windows/ucrt;
404
+ Authorization:
405
+ - Bearer <ACCESS_TOKEN>
406
+ Content-Type:
407
+ - application/vnd.contentful.management.v1+json
408
+ X-Contentful-Version:
409
+ - '2'
410
+ Version:
411
+ - '2'
412
+ Connection:
413
+ - close
414
+ Host:
415
+ - api.contentful.com
416
+ User-Agent:
417
+ - http.rb/5.0.1
418
+ response:
419
+ status:
420
+ code: 200
421
+ message: OK
422
+ headers:
423
+ Connection:
424
+ - close
425
+ Content-Length:
426
+ - '777'
427
+ Content-Type:
428
+ - application/vnd.contentful.management.v1+json
429
+ X-Contentful-Ratelimit-Hour-Remaining:
430
+ - '35997'
431
+ X-Contentful-Ratelimit-Second-Remaining:
432
+ - '7'
433
+ X-Contentful-Ratelimit-Hour-Limit:
434
+ - '36000'
435
+ X-Contentful-Ratelimit-Second-Limit:
436
+ - '10'
437
+ X-Contentful-Ratelimit-Reset:
438
+ - '0'
439
+ Cf-Environment-Id:
440
+ - master
441
+ Cf-Environment-Uuid:
442
+ - master
443
+ Cf-Space-Id:
444
+ - 32dbl893yf99
445
+ Etag:
446
+ - '"2699166329675537603"'
447
+ X-Contentful-Route:
448
+ - "/spaces/:space/environments/:environment/content_types/:id"
449
+ Strict-Transport-Security:
450
+ - max-age=15768000
451
+ X-Content-Type-Options:
452
+ - nosniff
453
+ Contentful-Api:
454
+ - cma
455
+ Server:
456
+ - Contentful
457
+ Contentful-Upstream:
458
+ - content-api
459
+ Access-Control-Allow-Origin:
460
+ - "*"
461
+ Access-Control-Allow-Headers:
462
+ - Accept,Accept-Language,Authorization,Cache-Control,CF-Context,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,X-Contentful-Comment-Body-Format,X-Contentful-Parent-Entity-Reference
463
+ Access-Control-Expose-Headers:
464
+ - Etag,x-contentful-request-id
465
+ Access-Control-Allow-Methods:
466
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
467
+ Access-Control-Max-Age:
468
+ - '1728000'
469
+ Accept-Ranges:
470
+ - bytes
471
+ Date:
472
+ - Sat, 09 Sep 2023 03:46:19 GMT
473
+ X-Contentful-Request-Id:
474
+ - 42e7113c-55a2-410c-8f7e-77e51bc9a52e
475
+ body:
476
+ encoding: ASCII-8BIT
477
+ string: '{"sys":{"space":{"sys":{"type":"Link","linkType":"Space","id":"32dbl893yf99"}},"id":"content_with_field_to_delete","type":"ContentType","createdAt":"2023-09-09T03:46:18.865Z","updatedAt":"2023-09-09T03:46:19.717Z","environment":{"sys":{"id":"master","type":"Link","linkType":"Environment"}},"publishedVersion":1,"publishedAt":"2023-09-09T03:46:19.112Z","firstPublishedAt":"2023-09-09T03:46:19.112Z","createdBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}},"updatedBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}},"publishedCounter":1,"version":3,"publishedBy":{"sys":{"type":"Link","linkType":"User","id":"1cRzCWn3HdX3jCI0Gkisl6"}}},"displayField":null,"name":"Content
478
+ With Field To Delete","description":null,"fields":[]}
479
+
480
+ '
481
+ recorded_at: Sat, 09 Sep 2023 03:46:19 GMT
482
+ recorded_with: VCR 6.2.0
483
+ ...
@@ -272,6 +272,30 @@ module Contentful
272
272
  expect(field.omitted).to be_falsey
273
273
  }
274
274
  end
275
+
276
+ it 'creates a content_type with a default value' do
277
+ vcr('content_type/default_value') {
278
+ space = client.spaces.find('32dbl893yf99')
279
+
280
+ default_value_field = Contentful::Management::Field.new
281
+ default_value_field.id = 'default_value_field'
282
+ default_value_field.name = 'default_value_field'
283
+ default_value_field.type = 'Text'
284
+ default_value_field.default_value = { 'en-US' => 'default content' }
285
+
286
+ content_type = client.content_types(space.id, 'master').create(
287
+ id: 'content_with_default_value',
288
+ name: 'Content With Default Value',
289
+ fields: [default_value_field]
290
+ )
291
+
292
+ content_type.activate
293
+ content_type.reload
294
+ entry = content_type.entries.new.save
295
+
296
+ expect(entry.default_value_field).to eq 'default content'
297
+ }
298
+ end
275
299
  end
276
300
 
277
301
  describe '#update' do
@@ -342,6 +366,32 @@ module Contentful
342
366
  end
343
367
  end
344
368
 
369
+ it 'deletes a field when updated with deleted set to true' do
370
+ vcr('content_type/update_with_deleted_true') {
371
+ space = client.spaces.find('32dbl893yf99')
372
+
373
+ field_to_delete = Contentful::Management::Field.new
374
+ field_to_delete.id = 'field_to_delete'
375
+ field_to_delete.name = 'field_to_delete'
376
+ field_to_delete.type = 'Text'
377
+ field_to_delete.omitted = true
378
+
379
+ content_type = client.content_types(space.id, 'master').create(
380
+ id: 'content_with_field_to_delete',
381
+ name: 'Content With Field To Delete',
382
+ fields: [field_to_delete]
383
+ )
384
+
385
+ content_type.activate
386
+ content_type.reload
387
+
388
+ field = content_type.fields.detect { _1.name == 'field_to_delete' }
389
+ field.deleted = true
390
+ content_type.update(fields: content_type.fields)
391
+
392
+ expect(content_type.fields).to be_empty
393
+ }
394
+ end
345
395
  end
346
396
 
347
397
  describe '#save' do
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-management
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Protas
8
8
  - Tomasz Warkocki
9
9
  - Contentful GmbH (Andreas Tiefenthaler)
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-01-12 00:00:00.000000000 Z
13
+ date: 2024-02-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ">"
20
- - !ruby/object:Gem::Version
21
- version: '1.0'
22
- - - "<"
19
+ - - "~>"
23
20
  - !ruby/object:Gem::Version
24
21
  version: '5.0'
25
22
  type: :runtime
26
23
  prerelease: false
27
24
  version_requirements: !ruby/object:Gem::Requirement
28
25
  requirements:
29
- - - ">"
30
- - !ruby/object:Gem::Version
31
- version: '1.0'
32
- - - "<"
26
+ - - "~>"
33
27
  - !ruby/object:Gem::Version
34
28
  version: '5.0'
35
29
  - !ruby/object:Gem::Dependency
@@ -198,14 +192,14 @@ dependencies:
198
192
  requirements:
199
193
  - - "~>"
200
194
  - !ruby/object:Gem::Version
201
- version: 0.49.1
195
+ version: 1.56.2
202
196
  type: :development
203
197
  prerelease: false
204
198
  version_requirements: !ruby/object:Gem::Requirement
205
199
  requirements:
206
200
  - - "~>"
207
201
  - !ruby/object:Gem::Version
208
- version: 0.49.1
202
+ version: 1.56.2
209
203
  - !ruby/object:Gem::Dependency
210
204
  name: listen
211
205
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +220,14 @@ dependencies:
226
220
  requirements:
227
221
  - - "~>"
228
222
  - !ruby/object:Gem::Version
229
- version: '4.0'
223
+ version: 6.2.0
230
224
  type: :development
231
225
  prerelease: false
232
226
  version_requirements: !ruby/object:Gem::Requirement
233
227
  requirements:
234
228
  - - "~>"
235
229
  - !ruby/object:Gem::Version
236
- version: '4.0'
230
+ version: 6.2.0
237
231
  - !ruby/object:Gem::Dependency
238
232
  name: webmock
239
233
  requirement: !ruby/object:Gem::Requirement
@@ -501,6 +495,7 @@ files:
501
495
  - spec/fixtures/vcr_cassettes/content_type/deactivate_already_deactivated.yml
502
496
  - spec/fixtures/vcr_cassettes/content_type/deactivate_with_entries.yml
503
497
  - spec/fixtures/vcr_cassettes/content_type/deactivate_with_version_change.yml
498
+ - spec/fixtures/vcr_cassettes/content_type/default_value.yml
504
499
  - spec/fixtures/vcr_cassettes/content_type/destroy.yml
505
500
  - spec/fixtures/vcr_cassettes/content_type/destroy_activated.yml
506
501
  - spec/fixtures/vcr_cassettes/content_type/entry/all.yml
@@ -531,6 +526,7 @@ files:
531
526
  - spec/fixtures/vcr_cassettes/content_type/update.yml
532
527
  - spec/fixtures/vcr_cassettes/content_type/update_change_field_name.yml
533
528
  - spec/fixtures/vcr_cassettes/content_type/update_remove_field.yml
529
+ - spec/fixtures/vcr_cassettes/content_type/update_with_deleted_true.yml
534
530
  - spec/fixtures/vcr_cassettes/content_type/update_with_fields.yml
535
531
  - spec/fixtures/vcr_cassettes/content_type/update_with_one_new_field.yml
536
532
  - spec/fixtures/vcr_cassettes/content_type/validation/in.yml
@@ -820,7 +816,7 @@ homepage: https://github.com/contentful/contentful-management.rb
820
816
  licenses:
821
817
  - MIT
822
818
  metadata: {}
823
- post_install_message:
819
+ post_install_message:
824
820
  rdoc_options: []
825
821
  require_paths:
826
822
  - lib
@@ -828,15 +824,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
828
824
  requirements:
829
825
  - - ">="
830
826
  - !ruby/object:Gem::Version
831
- version: '0'
827
+ version: '3.0'
832
828
  required_rubygems_version: !ruby/object:Gem::Requirement
833
829
  requirements:
834
830
  - - ">="
835
831
  - !ruby/object:Gem::Version
836
832
  version: '0'
837
833
  requirements: []
838
- rubygems_version: 3.1.6
839
- signing_key:
834
+ rubygems_version: 3.3.26
835
+ signing_key:
840
836
  specification_version: 4
841
837
  summary: contentful management api
842
838
  test_files:
@@ -935,6 +931,7 @@ test_files:
935
931
  - spec/fixtures/vcr_cassettes/content_type/deactivate_already_deactivated.yml
936
932
  - spec/fixtures/vcr_cassettes/content_type/deactivate_with_entries.yml
937
933
  - spec/fixtures/vcr_cassettes/content_type/deactivate_with_version_change.yml
934
+ - spec/fixtures/vcr_cassettes/content_type/default_value.yml
938
935
  - spec/fixtures/vcr_cassettes/content_type/destroy.yml
939
936
  - spec/fixtures/vcr_cassettes/content_type/destroy_activated.yml
940
937
  - spec/fixtures/vcr_cassettes/content_type/entry/all.yml
@@ -965,6 +962,7 @@ test_files:
965
962
  - spec/fixtures/vcr_cassettes/content_type/update.yml
966
963
  - spec/fixtures/vcr_cassettes/content_type/update_change_field_name.yml
967
964
  - spec/fixtures/vcr_cassettes/content_type/update_remove_field.yml
965
+ - spec/fixtures/vcr_cassettes/content_type/update_with_deleted_true.yml
968
966
  - spec/fixtures/vcr_cassettes/content_type/update_with_fields.yml
969
967
  - spec/fixtures/vcr_cassettes/content_type/update_with_one_new_field.yml
970
968
  - spec/fixtures/vcr_cassettes/content_type/validation/in.yml