contentful-management 3.4.0 → 3.6.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: 9945ef61ea841e1f83ad391afb7357f4b0a5dff52b5e783db87fffe702615c32
4
+ data.tar.gz: d96b10bfd523771b0161e8fc68263efff2cd3dfba0af7b93ab92e96a77299b9f
5
5
  SHA512:
6
- metadata.gz: be21b3435d4a8c17661f3db6f31e17a799962ed6cb0acac6edfdeee6f6242283cbd610f0b3af9e6929148b3a0c9fb39a9c3f13fc7f1f6d7d45ee56f138ba8a99
7
- data.tar.gz: a8cabfecc97f19740953a33dd92e6d5bc44479f4b393359d614d85c23d7a85f37cba0cc1de80c628a47598006a0154d9ba8c9119d85765e9a32751cefce463c1
6
+ metadata.gz: e67cf1768b981723e1a1de202bd208c14e8ce57e84d79add3632f1c813766298ce9ba37263659f7692a60f2d92b17523da0b5d441c327414b14633c95799424c
7
+ data.tar.gz: bac2a142ac94353c09f4ea59003b5583a540c5ff7981c0d336e5a8417224f374fdc05ea7fad3f2888067e6a6151ce4ff377417e27faf6ffd52118163b63deb39
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Master
4
4
 
5
+ ## 3.6.0
6
+ * Updated readme for Entry References
7
+ * Added examples of fetching entries by field values in readme
8
+ * Added pagination support for environments
9
+
10
+ ## 3.5.0
11
+ * Added support for Entry References API
12
+
5
13
  ## 3.4.0
6
14
  * Changed CI/CD vendor
7
15
  * Added support for Tags API
data/README.md CHANGED
@@ -331,6 +331,14 @@ Retrieving an entry by ID:
331
331
  entry = environment.entries.find('entry_id')
332
332
  ```
333
333
 
334
+ Retrieving entries by any other field value:
335
+
336
+ ```ruby
337
+ entries = environment.entries.all(content_type: content_type.id, 'fields.fieldName' => 'value')
338
+ ```
339
+
340
+ Note: all [search parameters](https://www.contentful.com/developers/docs/references/content-management-api/#/reference/search-parameters) are supported.
341
+
334
342
  Creating a location:
335
343
 
336
344
  ```ruby
@@ -1096,6 +1104,14 @@ Retrieving a snapshot for a given entry:
1096
1104
  snapshot = entry.snapshots.find('some_snapshot_id')
1097
1105
  ```
1098
1106
 
1107
+ ### Entry references
1108
+
1109
+ Retrieving entry references:
1110
+
1111
+ ```ruby
1112
+ references = entry.references(include: 1)
1113
+ ```
1114
+
1099
1115
  ### Content Type Snapshots
1100
1116
 
1101
1117
  Retrieving all snapshots for a given content type:
@@ -393,7 +393,6 @@ module Contentful
393
393
  logger.info(request: { url: url, query: request.query, header: request_headers(request) }) if logger
394
394
  raw_response = yield(url)
395
395
  logger.debug(response: raw_response) if logger
396
- clear_headers
397
396
  result = Response.new(raw_response, request)
398
397
  fail result.object if result.object.is_a?(Error) && configuration[:raise_errors]
399
398
  rescue Contentful::Management::RateLimitExceeded => rate_limit_error
@@ -406,6 +405,8 @@ module Contentful
406
405
  end
407
406
 
408
407
  raise
408
+ ensure
409
+ clear_headers
409
410
  end
410
411
 
411
412
  result
@@ -17,9 +17,12 @@ module Contentful
17
17
  # Gets a collection of environments.
18
18
  #
19
19
  # @return [Contentful::Management::Array<Contentful::Management::Environment>]
20
- def all
20
+ def all(params = {})
21
21
  @resource_requester.all(
22
- space_id: @space_id
22
+ {
23
+ space_id: @space_id
24
+ },
25
+ params
23
26
  )
24
27
  end
25
28
 
@@ -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.6.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
@@ -743,7 +743,7 @@ http_interactions:
743
743
  Content-Type:
744
744
  - application/vnd.contentful.management.v1+json
745
745
  X-Contentful-Version:
746
- - '30'
746
+ - '1'
747
747
  Content-Length:
748
748
  - '0'
749
749
  Host: