contentful-management 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c115843f4cb0a16069a1a41ada3cc3661f274ab5b2e53a3b51f085f30bd7377
4
- data.tar.gz: 2c9c760b683b0f2174b24d1d40473a90dc1d001f6da8fccd32c70e5f511e1633
3
+ metadata.gz: 60951b91e0b816f76ce81387b1be4d70673f7365b384161d3882fadbc04d947e
4
+ data.tar.gz: ffbde8522e8ffb96dd247f2c14508e48b505ca00f6e4c71047f905472cc30eb0
5
5
  SHA512:
6
- metadata.gz: be21b3435d4a8c17661f3db6f31e17a799962ed6cb0acac6edfdeee6f6242283cbd610f0b3af9e6929148b3a0c9fb39a9c3f13fc7f1f6d7d45ee56f138ba8a99
7
- data.tar.gz: a8cabfecc97f19740953a33dd92e6d5bc44479f4b393359d614d85c23d7a85f37cba0cc1de80c628a47598006a0154d9ba8c9119d85765e9a32751cefce463c1
6
+ metadata.gz: dbda6173a0e1cb13a62f4f9aa8274969a011bca71866aab1be0983f367dfabb6041b2cc132c9fbb5b4d22d235e9d07647c6ec28a6ebe84cfd2ddffb3f1c09271
7
+ data.tar.gz: fac67fa15e95c1dbdcf44c9ebe0934d7be17d54825dc24f16b12cea7a1b746f90ba31b301b4023040a815b97574b89eb3ad09c0f476f36eb3170dfeb02166cf7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## Master
4
4
 
5
+ ## 3.5.0
6
+ * Added support for Entry References API
7
+
5
8
  ## 3.4.0
6
9
  * Changed CI/CD vendor
7
10
  * Added support for Tags API
@@ -179,6 +179,19 @@ module Contentful
179
179
  EntrySnapshotMethodsFactory.new(self)
180
180
  end
181
181
 
182
+ def references(query = {}, headers = {})
183
+ ResourceRequester.new(client, self.class).all(
184
+ {
185
+ space_id: space.id,
186
+ environment_id: environment_id,
187
+ resource_id: id,
188
+ suffix: '/references'
189
+ },
190
+ query,
191
+ headers
192
+ )
193
+ end
194
+
182
195
  protected
183
196
 
184
197
  def query_attributes(attributes)
@@ -3,6 +3,6 @@ module Contentful
3
3
  # Management Namespace
4
4
  module Management
5
5
  # Gem Version
6
- VERSION = '3.4.0'.freeze
6
+ VERSION = '3.5.0'.freeze
7
7
  end
8
8
  end
@@ -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
@@ -1239,4 +1239,15 @@ describe Contentful::Management::Entry do
1239
1239
  end
1240
1240
  end
1241
1241
  end
1242
+
1243
+ describe '#references' do
1244
+ it 'can fetch references' do
1245
+ vcr('entry/references') do
1246
+ result = subject.find(entry_id).references(include: 1)
1247
+
1248
+ expect(result).to be_kind_of Contentful::Management::Array
1249
+ expect(result)
1250
+ end
1251
+ end
1252
+ end
1242
1253
  end
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: 3.4.0
4
+ version: 3.5.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: 2022-04-26 00:00:00.000000000 Z
13
+ date: 2022-06-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -599,6 +599,7 @@ files:
599
599
  - spec/fixtures/vcr_cassettes/entry/publish_already_published.yml
600
600
  - spec/fixtures/vcr_cassettes/entry/published_false.yml
601
601
  - spec/fixtures/vcr_cassettes/entry/published_true.yml
602
+ - spec/fixtures/vcr_cassettes/entry/references.yml
602
603
  - spec/fixtures/vcr_cassettes/entry/reload.yml
603
604
  - spec/fixtures/vcr_cassettes/entry/save_update.yml
604
605
  - spec/fixtures/vcr_cassettes/entry/search_filter/equality_operator.yml
@@ -1029,6 +1030,7 @@ test_files:
1029
1030
  - spec/fixtures/vcr_cassettes/entry/publish_already_published.yml
1030
1031
  - spec/fixtures/vcr_cassettes/entry/published_false.yml
1031
1032
  - spec/fixtures/vcr_cassettes/entry/published_true.yml
1033
+ - spec/fixtures/vcr_cassettes/entry/references.yml
1032
1034
  - spec/fixtures/vcr_cassettes/entry/reload.yml
1033
1035
  - spec/fixtures/vcr_cassettes/entry/save_update.yml
1034
1036
  - spec/fixtures/vcr_cassettes/entry/search_filter/equality_operator.yml