contentful-management 3.7.0 → 3.8.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: 48205cbf594bc68a7aff1b7017b9a46c4674c49c59af0294dd3ac16fe779deb1
4
- data.tar.gz: 19138b713d5061b4730545a8952267904015963f5f5a06803bb3ae8ab63320fd
3
+ metadata.gz: 44fc3acb4083375be13c59c07c353f90819b79a5d7c2bb0fbf7a86ebd0a68c22
4
+ data.tar.gz: bc3e20e2a8d4c13a4db0800cc877feb8cabf7f4b875b0a923c374470881c54a4
5
5
  SHA512:
6
- metadata.gz: ebb8d595852045a00a7a826584316799d36b58ec2953d5ef136d4e91d06a85e938c474a5c2cc6cde808fc5a59000c47bccaad43909a227b53479a084b2383fd8
7
- data.tar.gz: d5f33999d52caeb9a63d08dd27c386ddf1e88c01977cda743cec149870fd853d3a9d3e157d52b708aaa25cea916385d4c8d0c24511cb752784a59eb435430189
6
+ metadata.gz: 667643794c89aea0014825b1b3784676be4b9a9e9c141c92d0adac31cfb6342dcf267c172fc8ff80a6a91626bb100810451053fe2c96394fbb64f70c66008bc4
7
+ data.tar.gz: e802e14814ed3d5e73e9c0ff22a724e47ceb941d5cf6d6b9b1274b10916339dfeca2b5d5fc599307aae90b28ff05af4cf299f57a834ebe98c651292bbbb78482
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.8.0
4
+ * Added support for cross-space references
5
+
3
6
  ## 3.7.0
4
7
  * Replaces deprecated `URI.escape` with `URI.encode_www_form_component` in Contentful::Management::Request#id
5
8
  * Configured VCR to redact sensitive data
data/README.md CHANGED
@@ -468,6 +468,25 @@ or the field of link type:
468
468
  blog_post_content_type.fields.create(id: 'my_entry_link_field', name: 'My Entry Link Field', type: 'Link', link_type: 'Entry')
469
469
  ```
470
470
 
471
+ or the field of ResourceLink type:
472
+ ```ruby
473
+ blog_post_content_type.fields.create(
474
+ id: 'my_resource_link_id',
475
+ name: 'My Resource Link',
476
+ type: 'ResourceLink',
477
+ localized: true,
478
+ disabled: false,
479
+ omitted: false,
480
+ allowed_resources: [
481
+ {
482
+ type: 'Contentful:Entry',
483
+ source: 'crn:contentful:::content:spaces/space_id',
484
+ contentTypes: ["foo", "bar"]
485
+ }
486
+ ]
487
+ )
488
+ ```
489
+
471
490
  or the field of an array type:
472
491
  ```ruby
473
492
  items = Contentful::Management::Field.new
@@ -16,6 +16,7 @@ module Contentful
16
16
  property :disabled, :boolean
17
17
  property :localized, :boolean
18
18
  property :validations, Validation
19
+ property :allowedResources
19
20
 
20
21
  # Takes a field object of content type
21
22
  # Merges existing properties, items and validations of field with new one
@@ -3,6 +3,6 @@ module Contentful
3
3
  # Management Namespace
4
4
  module Management
5
5
  # Gem Version
6
- VERSION = '3.7.0'.freeze
6
+ VERSION = '3.8.0'.freeze
7
7
  end
8
8
  end
@@ -0,0 +1,316 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/yr5m0jky5hsh/environments/master/content_types/8KSpuKrl04eMAGQoQckweq
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/3.5.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
+ - '1313'
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
+ Cf-Environment-Id:
44
+ - master
45
+ Cf-Environment-Uuid:
46
+ - master
47
+ Cf-Space-Id:
48
+ - yr5m0jky5hsh
49
+ Etag:
50
+ - '"10374541921030338982"'
51
+ X-Contentful-Route:
52
+ - "/spaces/:space/environments/:environment/content_types/:id"
53
+ Strict-Transport-Security:
54
+ - max-age=15768000
55
+ X-Content-Type-Options:
56
+ - nosniff
57
+ Contentful-Api:
58
+ - cma
59
+ Server:
60
+ - Contentful
61
+ Contentful-Upstream:
62
+ - content-api
63
+ Access-Control-Allow-Origin:
64
+ - "*"
65
+ Access-Control-Allow-Headers:
66
+ - 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
67
+ Access-Control-Expose-Headers:
68
+ - Etag
69
+ Access-Control-Allow-Methods:
70
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
71
+ Access-Control-Max-Age:
72
+ - '1728000'
73
+ Accept-Ranges:
74
+ - bytes
75
+ Date:
76
+ - Mon, 26 Dec 2022 21:49:29 GMT
77
+ X-Contentful-Request-Id:
78
+ - e9306e05-aafe-417c-a16c-14922c2afad2
79
+ body:
80
+ encoding: ASCII-8BIT
81
+ string: |
82
+ {
83
+ "sys": {
84
+ "space": {
85
+ "sys": {
86
+ "type": "Link",
87
+ "linkType": "Space",
88
+ "id": "yr5m0jky5hsh"
89
+ }
90
+ },
91
+ "id": "8KSpuKrl04eMAGQoQckweq",
92
+ "type": "ContentType",
93
+ "createdAt": "2022-12-26T19:31:48.068Z",
94
+ "updatedAt": "2022-12-26T21:49:17.143Z",
95
+ "environment": {
96
+ "sys": {
97
+ "id": "master",
98
+ "type": "Link",
99
+ "linkType": "Environment"
100
+ }
101
+ },
102
+ "publishedVersion": 10,
103
+ "publishedAt": "2022-12-26T21:49:17.143Z",
104
+ "firstPublishedAt": "2022-12-26T19:31:48.360Z",
105
+ "createdBy": {
106
+ "sys": {
107
+ "type": "Link",
108
+ "linkType": "User",
109
+ "id": "59Erm8D1JuuD273aXNb65T"
110
+ }
111
+ },
112
+ "updatedBy": {
113
+ "sys": {
114
+ "type": "Link",
115
+ "linkType": "User",
116
+ "id": "59Erm8D1JuuD273aXNb65T"
117
+ }
118
+ },
119
+ "publishedCounter": 4,
120
+ "version": 11,
121
+ "publishedBy": {
122
+ "sys": {
123
+ "type": "Link",
124
+ "linkType": "User",
125
+ "id": "59Erm8D1JuuD273aXNb65T"
126
+ }
127
+ }
128
+ },
129
+ "displayField": "title",
130
+ "name": "From Ruby SDK",
131
+ "description": "",
132
+ "fields": [
133
+ {
134
+ "id": "title",
135
+ "name": "title",
136
+ "type": "Symbol",
137
+ "localized": false,
138
+ "required": false,
139
+ "validations": [],
140
+ "disabled": false,
141
+ "omitted": false
142
+ }
143
+ ]
144
+ }
145
+ http_version:
146
+ recorded_at: Mon, 26 Dec 2022 21:49:30 GMT
147
+ - request:
148
+ method: put
149
+ uri: https://api.contentful.com/spaces/yr5m0jky5hsh/environments/master/content_types/8KSpuKrl04eMAGQoQckweq
150
+ body:
151
+ encoding: UTF-8
152
+ string: '{"displayField":"title","name":"From Ruby SDK","description":"","fields":[{"id":"title","name":"title","type":"Symbol"},{"id":"myResourceLink","name":"My
153
+ Resource Link","type":"ResourceLink","localized":true,"allowedResources":[{"type":"Contentful:Entry","source":"crn:contentful:::content:spaces/yb41ceqgyiw5","contentTypes":["category","course"]}]}]}'
154
+ headers:
155
+ X-Contentful-User-Agent:
156
+ - sdk contentful-management.rb/3.5.0; platform ruby/3.0.0; os macOS/21;
157
+ Authorization:
158
+ - Bearer <ACCESS_TOKEN>
159
+ Content-Type:
160
+ - application/vnd.contentful.management.v1+json
161
+ X-Contentful-Version:
162
+ - '11'
163
+ Version:
164
+ - '11'
165
+ Connection:
166
+ - close
167
+ Host:
168
+ - api.contentful.com
169
+ User-Agent:
170
+ - http.rb/4.4.1
171
+ response:
172
+ status:
173
+ code: 200
174
+ message: OK
175
+ headers:
176
+ Connection:
177
+ - close
178
+ Content-Length:
179
+ - '1791'
180
+ Content-Type:
181
+ - application/vnd.contentful.management.v1+json
182
+ X-Contentful-Ratelimit-Hour-Remaining:
183
+ - '35999'
184
+ X-Contentful-Ratelimit-Second-Remaining:
185
+ - '9'
186
+ X-Contentful-Ratelimit-Hour-Limit:
187
+ - '36000'
188
+ X-Contentful-Ratelimit-Second-Limit:
189
+ - '10'
190
+ X-Contentful-Ratelimit-Reset:
191
+ - '0'
192
+ Cf-Environment-Id:
193
+ - master
194
+ Cf-Environment-Uuid:
195
+ - master
196
+ Cf-Space-Id:
197
+ - yr5m0jky5hsh
198
+ Etag:
199
+ - '"2125699879861347044"'
200
+ X-Contentful-Route:
201
+ - "/spaces/:space/environments/:environment/content_types/:id"
202
+ Strict-Transport-Security:
203
+ - max-age=15768000
204
+ X-Content-Type-Options:
205
+ - nosniff
206
+ Contentful-Api:
207
+ - cma
208
+ Server:
209
+ - Contentful
210
+ Contentful-Upstream:
211
+ - content-api
212
+ Access-Control-Allow-Origin:
213
+ - "*"
214
+ Access-Control-Allow-Headers:
215
+ - 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
216
+ Access-Control-Expose-Headers:
217
+ - Etag
218
+ Access-Control-Allow-Methods:
219
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
220
+ Access-Control-Max-Age:
221
+ - '1728000'
222
+ Accept-Ranges:
223
+ - bytes
224
+ Date:
225
+ - Mon, 26 Dec 2022 21:49:30 GMT
226
+ X-Contentful-Request-Id:
227
+ - 77d8a503-bee7-43a4-815d-e6d111692c46
228
+ body:
229
+ encoding: ASCII-8BIT
230
+ string: |
231
+ {
232
+ "sys": {
233
+ "space": {
234
+ "sys": {
235
+ "type": "Link",
236
+ "linkType": "Space",
237
+ "id": "yr5m0jky5hsh"
238
+ }
239
+ },
240
+ "id": "8KSpuKrl04eMAGQoQckweq",
241
+ "type": "ContentType",
242
+ "createdAt": "2022-12-26T19:31:48.068Z",
243
+ "updatedAt": "2022-12-26T21:49:30.449Z",
244
+ "environment": {
245
+ "sys": {
246
+ "id": "master",
247
+ "type": "Link",
248
+ "linkType": "Environment"
249
+ }
250
+ },
251
+ "publishedVersion": 10,
252
+ "publishedAt": "2022-12-26T21:49:17.143Z",
253
+ "firstPublishedAt": "2022-12-26T19:31:48.360Z",
254
+ "createdBy": {
255
+ "sys": {
256
+ "type": "Link",
257
+ "linkType": "User",
258
+ "id": "59Erm8D1JuuD273aXNb65T"
259
+ }
260
+ },
261
+ "updatedBy": {
262
+ "sys": {
263
+ "type": "Link",
264
+ "linkType": "User",
265
+ "id": "59Erm8D1JuuD273aXNb65T"
266
+ }
267
+ },
268
+ "publishedCounter": 4,
269
+ "version": 12,
270
+ "publishedBy": {
271
+ "sys": {
272
+ "type": "Link",
273
+ "linkType": "User",
274
+ "id": "59Erm8D1JuuD273aXNb65T"
275
+ }
276
+ }
277
+ },
278
+ "displayField": "title",
279
+ "name": "From Ruby SDK",
280
+ "description": "",
281
+ "fields": [
282
+ {
283
+ "id": "title",
284
+ "name": "title",
285
+ "type": "Symbol",
286
+ "localized": false,
287
+ "required": false,
288
+ "validations": [],
289
+ "disabled": false,
290
+ "omitted": false
291
+ },
292
+ {
293
+ "id": "myResourceLink",
294
+ "name": "My Resource Link",
295
+ "type": "ResourceLink",
296
+ "localized": true,
297
+ "required": false,
298
+ "validations": [],
299
+ "disabled": false,
300
+ "omitted": false,
301
+ "allowedResources": [
302
+ {
303
+ "type": "Contentful:Entry",
304
+ "source": "crn:contentful:::content:spaces/yb41ceqgyiw5",
305
+ "contentTypes": [
306
+ "foo",
307
+ "bar"
308
+ ]
309
+ }
310
+ ]
311
+ }
312
+ ]
313
+ }
314
+ http_version:
315
+ recorded_at: Mon, 26 Dec 2022 21:49:30 GMT
316
+ recorded_with: VCR 4.0.0
@@ -440,6 +440,34 @@ module Contentful
440
440
  expect(content_type.fields[11].type).to eq field_type
441
441
  end
442
442
  end
443
+ it 'creates a new ResourceLink field with additional parameters' do
444
+ vcr('content_type/fields/resource_link_with_params') do
445
+ content_type = subject.find('8KSpuKrl04eMAGQoQckweq')
446
+ content_type.fields.create(
447
+ id: 'myResourceLink',
448
+ name: 'My Resource Link',
449
+ type: 'ResourceLink',
450
+ localized: true,
451
+ disabled: false,
452
+ omitted: false,
453
+ allowed_resources: [
454
+ {
455
+ type: 'Contentful:Entry',
456
+ source: 'crn:contentful:::content:spaces/yb41ceqgyiw5',
457
+ contentTypes: ["foo", "bar"]
458
+ }
459
+ ]
460
+ )
461
+ expect(content_type.fields.size).to eq 2
462
+ field = content_type.fields.last
463
+ expect(field.name).to eq 'My Resource Link'
464
+ expect(field.type).to eq 'ResourceLink'
465
+ expect(field.allowed_resources.size).to eq 1
466
+ expect(field.allowed_resources.first['type']).to eq 'Contentful:Entry'
467
+ expect(field.allowed_resources.first['source']).to eq 'crn:contentful:::content:spaces/yb41ceqgyiw5'
468
+ expect(field.allowed_resources.first['contentTypes']).to eq ["foo", "bar"]
469
+ end
470
+ end
443
471
  end
444
472
 
445
473
  describe '#fields.add' do
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.7.0
4
+ version: 3.8.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-12-20 00:00:00.000000000 Z
13
+ date: 2023-01-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -518,6 +518,7 @@ files:
518
518
  - spec/fixtures/vcr_cassettes/content_type/fields/create_array_with_params.yml
519
519
  - spec/fixtures/vcr_cassettes/content_type/fields/create_with_params.yml
520
520
  - spec/fixtures/vcr_cassettes/content_type/fields/destroy.yml
521
+ - spec/fixtures/vcr_cassettes/content_type/fields/resource_link_with_params.yml
521
522
  - spec/fixtures/vcr_cassettes/content_type/fields/update_field.yml
522
523
  - spec/fixtures/vcr_cassettes/content_type/find.yml
523
524
  - spec/fixtures/vcr_cassettes/content_type/find_not_found.yml
@@ -951,6 +952,7 @@ test_files:
951
952
  - spec/fixtures/vcr_cassettes/content_type/fields/create_array_with_params.yml
952
953
  - spec/fixtures/vcr_cassettes/content_type/fields/create_with_params.yml
953
954
  - spec/fixtures/vcr_cassettes/content_type/fields/destroy.yml
955
+ - spec/fixtures/vcr_cassettes/content_type/fields/resource_link_with_params.yml
954
956
  - spec/fixtures/vcr_cassettes/content_type/fields/update_field.yml
955
957
  - spec/fixtures/vcr_cassettes/content_type/find.yml
956
958
  - spec/fixtures/vcr_cassettes/content_type/find_not_found.yml