contentful-management 3.1.0 → 3.4.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 +3 -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/organization_user_methods_factory.rb +2 -2
  13. data/lib/contentful/management/resource/refresher.rb +1 -0
  14. data/lib/contentful/management/resource_requester.rb +2 -2
  15. data/lib/contentful/management/space_user_methods_factory.rb +2 -2
  16. data/lib/contentful/management/tag.rb +27 -0
  17. data/lib/contentful/management/version.rb +1 -1
  18. data/spec/fixtures/vcr_cassettes/editor_interfaces/update_sidebar.yml +553 -0
  19. data/spec/fixtures/vcr_cassettes/environment/tag_proxy.yml +658 -0
  20. data/spec/fixtures/vcr_cassettes/tag/add_tag_to_asset.yml +456 -0
  21. data/spec/fixtures/vcr_cassettes/tag/add_tag_to_entry.yml +315 -0
  22. data/spec/fixtures/vcr_cassettes/tag/all.yml +252 -0
  23. data/spec/fixtures/vcr_cassettes/tag/create_asset_with_tags.yml +147 -0
  24. data/spec/fixtures/vcr_cassettes/tag/create_entry_with_tags.yml +293 -0
  25. data/spec/fixtures/vcr_cassettes/tag/create_visibility_private.yml +125 -0
  26. data/spec/fixtures/vcr_cassettes/tag/create_visibility_public.yml +125 -0
  27. data/spec/fixtures/vcr_cassettes/tag/destroy.yml +208 -0
  28. data/spec/fixtures/vcr_cassettes/tag/destroy_referenced.yml +226 -0
  29. data/spec/fixtures/vcr_cassettes/tag/find.yml +125 -0
  30. data/spec/fixtures/vcr_cassettes/tag/not_found.yml +98 -0
  31. data/spec/fixtures/vcr_cassettes/tag/remove_tag_from_asset.yml +456 -0
  32. data/spec/fixtures/vcr_cassettes/tag/remove_tag_from_entry.yml +315 -0
  33. data/spec/fixtures/vcr_cassettes/tag/update.yml +251 -0
  34. data/spec/lib/contentful/management/editor_interface_spec.rb +30 -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 +43 -7
  38. data/.travis.yml +0 -12
@@ -0,0 +1,315 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/o4h6g9w3pooi/environments/master/entries/28spH12WTOl0xUQeC4AL1a
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
+ - '1253'
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
+ - o4h6g9w3pooi
51
+ Etag:
52
+ - '"8030875535273010872"'
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, 19 Apr 2022 15:24:37 GMT
81
+ X-Contentful-Request-Id:
82
+ - aca569ea-dddd-4903-b3d8-fa8e8f431a5d
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": "o4h6g9w3pooi"
96
+ }
97
+ },
98
+ "id": "28spH12WTOl0xUQeC4AL1a",
99
+ "type": "Entry",
100
+ "createdAt": "2022-04-12T05:11:03.393Z",
101
+ "updatedAt": "2022-04-19T15:09:57.795Z",
102
+ "environment": {
103
+ "sys": {
104
+ "id": "master",
105
+ "type": "Link",
106
+ "linkType": "Environment"
107
+ }
108
+ },
109
+ "publishedVersion": 20,
110
+ "publishedAt": "2022-04-12T05:43:44.184Z",
111
+ "firstPublishedAt": "2022-04-12T05:11:24.530Z",
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": 6,
127
+ "version": 39,
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": "simple"
140
+ }
141
+ }
142
+ },
143
+ "fields": {
144
+ "name": {
145
+ "en-US": "bhushan"
146
+ }
147
+ }
148
+ }
149
+ http_version:
150
+ recorded_at: Tue, 19 Apr 2022 15:24:37 GMT
151
+ - request:
152
+ method: put
153
+ uri: https://api.contentful.com/spaces/o4h6g9w3pooi/environments/master/entries/28spH12WTOl0xUQeC4AL1a
154
+ body:
155
+ encoding: UTF-8
156
+ string: '{"metadata":{"tags":[{"sys":{"type":"Link","linkType":"Tag","id":"icon"}}]},"fields":{"name":{"en-US":"bhushan"}}}'
157
+ headers:
158
+ X-Contentful-User-Agent:
159
+ - sdk contentful-management.rb/3.3.0; platform ruby/2.7.2; os macOS/21;
160
+ Authorization:
161
+ - Bearer <ACCESS_TOKEN>
162
+ Content-Type:
163
+ - application/vnd.contentful.management.v1+json
164
+ X-Contentful-Version:
165
+ - '39'
166
+ X-Contentful-Content-Type:
167
+ - simple
168
+ Content-Type-Id:
169
+ - simple
170
+ Version:
171
+ - '39'
172
+ Connection:
173
+ - close
174
+ Host:
175
+ - api.contentful.com
176
+ User-Agent:
177
+ - http.rb/4.4.1
178
+ response:
179
+ status:
180
+ code: 200
181
+ message: OK
182
+ headers:
183
+ Connection:
184
+ - close
185
+ Content-Length:
186
+ - '1379'
187
+ Content-Type:
188
+ - application/vnd.contentful.management.v1+json
189
+ X-Contentful-Ratelimit-Second-Limit:
190
+ - '10'
191
+ X-Contentful-Ratelimit-Reset:
192
+ - '0'
193
+ X-Contentful-Ratelimit-Hour-Remaining:
194
+ - '35998'
195
+ X-Contentful-Ratelimit-Second-Remaining:
196
+ - '8'
197
+ X-Contentful-Ratelimit-Hour-Limit:
198
+ - '36000'
199
+ Accept-Patch:
200
+ - application/json-patch+json
201
+ Cf-Environment-Id:
202
+ - master
203
+ Cf-Environment-Uuid:
204
+ - master
205
+ Cf-Space-Id:
206
+ - o4h6g9w3pooi
207
+ Etag:
208
+ - '"9062438159635568901"'
209
+ X-Contentful-Route:
210
+ - "/spaces/:space/environments/:environment/entries/:id"
211
+ Strict-Transport-Security:
212
+ - max-age=15768000
213
+ X-Content-Type-Options:
214
+ - nosniff
215
+ Contentful-Api:
216
+ - cma
217
+ Server:
218
+ - Contentful
219
+ Contentful-Upstream:
220
+ - content-api
221
+ Access-Control-Allow-Origin:
222
+ - "*"
223
+ Access-Control-Allow-Headers:
224
+ - 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
225
+ Access-Control-Expose-Headers:
226
+ - Etag
227
+ Access-Control-Allow-Methods:
228
+ - DELETE,GET,HEAD,POST,PUT,PATCH,OPTIONS
229
+ Access-Control-Max-Age:
230
+ - '1728000'
231
+ Cache-Control:
232
+ - no-store
233
+ Accept-Ranges:
234
+ - bytes
235
+ Date:
236
+ - Tue, 19 Apr 2022 15:24:38 GMT
237
+ X-Contentful-Request-Id:
238
+ - 1b5468f8-7da9-4e6c-a6da-aa2a37515af6
239
+ body:
240
+ encoding: ASCII-8BIT
241
+ string: |
242
+ {
243
+ "metadata": {
244
+ "tags": [
245
+ {
246
+ "sys": {
247
+ "type": "Link",
248
+ "linkType": "Tag",
249
+ "id": "icon"
250
+ }
251
+ }
252
+ ]
253
+ },
254
+ "sys": {
255
+ "space": {
256
+ "sys": {
257
+ "type": "Link",
258
+ "linkType": "Space",
259
+ "id": "o4h6g9w3pooi"
260
+ }
261
+ },
262
+ "id": "28spH12WTOl0xUQeC4AL1a",
263
+ "type": "Entry",
264
+ "createdAt": "2022-04-12T05:11:03.393Z",
265
+ "updatedAt": "2022-04-19T15:24:37.977Z",
266
+ "environment": {
267
+ "sys": {
268
+ "id": "master",
269
+ "type": "Link",
270
+ "linkType": "Environment"
271
+ }
272
+ },
273
+ "publishedVersion": 20,
274
+ "publishedAt": "2022-04-12T05:43:44.184Z",
275
+ "firstPublishedAt": "2022-04-12T05:11:24.530Z",
276
+ "createdBy": {
277
+ "sys": {
278
+ "type": "Link",
279
+ "linkType": "User",
280
+ "id": "59Erm8D1JuuD273aXNb65T"
281
+ }
282
+ },
283
+ "updatedBy": {
284
+ "sys": {
285
+ "type": "Link",
286
+ "linkType": "User",
287
+ "id": "59Erm8D1JuuD273aXNb65T"
288
+ }
289
+ },
290
+ "publishedCounter": 6,
291
+ "version": 40,
292
+ "publishedBy": {
293
+ "sys": {
294
+ "type": "Link",
295
+ "linkType": "User",
296
+ "id": "59Erm8D1JuuD273aXNb65T"
297
+ }
298
+ },
299
+ "contentType": {
300
+ "sys": {
301
+ "type": "Link",
302
+ "linkType": "ContentType",
303
+ "id": "simple"
304
+ }
305
+ }
306
+ },
307
+ "fields": {
308
+ "name": {
309
+ "en-US": "bhushan"
310
+ }
311
+ }
312
+ }
313
+ http_version:
314
+ recorded_at: Tue, 19 Apr 2022 15:24:38 GMT
315
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,252 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/o4h6g9w3pooi/environments/master/tags
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
+ - '3758'
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
+ - o4h6g9w3pooi
49
+ Etag:
50
+ - '"16358391347644020993"'
51
+ X-Contentful-Route:
52
+ - "/spaces/:space/environments/:environment/tags"
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
+ Cache-Control:
74
+ - no-store
75
+ Accept-Ranges:
76
+ - bytes
77
+ Date:
78
+ - Tue, 19 Apr 2022 15:12:02 GMT
79
+ X-Contentful-Request-Id:
80
+ - 0c632bbc-0592-40aa-b436-04207652259c
81
+ body:
82
+ encoding: ASCII-8BIT
83
+ string: |
84
+ {
85
+ "sys": {
86
+ "type": "Array"
87
+ },
88
+ "total": 4,
89
+ "skip": 0,
90
+ "limit": 100,
91
+ "items": [
92
+ {
93
+ "sys": {
94
+ "space": {
95
+ "sys": {
96
+ "type": "Link",
97
+ "linkType": "Space",
98
+ "id": "o4h6g9w3pooi"
99
+ }
100
+ },
101
+ "id": "fooTag",
102
+ "type": "Tag",
103
+ "createdAt": "2022-04-12T05:09:33.997Z",
104
+ "updatedAt": "2022-04-19T15:11:43.850Z",
105
+ "environment": {
106
+ "sys": {
107
+ "id": "master",
108
+ "type": "Link",
109
+ "linkType": "Environment"
110
+ }
111
+ },
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
+ "version": 2,
127
+ "visibility": "private"
128
+ },
129
+ "name": "Foo Tag"
130
+ },
131
+ {
132
+ "sys": {
133
+ "space": {
134
+ "sys": {
135
+ "type": "Link",
136
+ "linkType": "Space",
137
+ "id": "o4h6g9w3pooi"
138
+ }
139
+ },
140
+ "id": "testPublic",
141
+ "type": "Tag",
142
+ "createdAt": "2022-04-19T15:10:04.165Z",
143
+ "updatedAt": "2022-04-19T15:10:04.165Z",
144
+ "environment": {
145
+ "sys": {
146
+ "id": "master",
147
+ "type": "Link",
148
+ "linkType": "Environment"
149
+ }
150
+ },
151
+ "createdBy": {
152
+ "sys": {
153
+ "type": "Link",
154
+ "linkType": "User",
155
+ "id": "59Erm8D1JuuD273aXNb65T"
156
+ }
157
+ },
158
+ "updatedBy": {
159
+ "sys": {
160
+ "type": "Link",
161
+ "linkType": "User",
162
+ "id": "59Erm8D1JuuD273aXNb65T"
163
+ }
164
+ },
165
+ "version": 1,
166
+ "visibility": "public"
167
+ },
168
+ "name": "test public"
169
+ },
170
+ {
171
+ "sys": {
172
+ "space": {
173
+ "sys": {
174
+ "type": "Link",
175
+ "linkType": "Space",
176
+ "id": "o4h6g9w3pooi"
177
+ }
178
+ },
179
+ "id": "testPrivate",
180
+ "type": "Tag",
181
+ "createdAt": "2022-04-19T15:10:03.478Z",
182
+ "updatedAt": "2022-04-19T15:10:03.478Z",
183
+ "environment": {
184
+ "sys": {
185
+ "id": "master",
186
+ "type": "Link",
187
+ "linkType": "Environment"
188
+ }
189
+ },
190
+ "createdBy": {
191
+ "sys": {
192
+ "type": "Link",
193
+ "linkType": "User",
194
+ "id": "59Erm8D1JuuD273aXNb65T"
195
+ }
196
+ },
197
+ "updatedBy": {
198
+ "sys": {
199
+ "type": "Link",
200
+ "linkType": "User",
201
+ "id": "59Erm8D1JuuD273aXNb65T"
202
+ }
203
+ },
204
+ "version": 1,
205
+ "visibility": "private"
206
+ },
207
+ "name": "test private"
208
+ },
209
+ {
210
+ "sys": {
211
+ "space": {
212
+ "sys": {
213
+ "type": "Link",
214
+ "linkType": "Space",
215
+ "id": "o4h6g9w3pooi"
216
+ }
217
+ },
218
+ "id": "icon",
219
+ "type": "Tag",
220
+ "createdAt": "2022-01-19T18:50:31.193Z",
221
+ "updatedAt": "2022-01-19T18:50:31.193Z",
222
+ "environment": {
223
+ "sys": {
224
+ "id": "master",
225
+ "type": "Link",
226
+ "linkType": "Environment"
227
+ }
228
+ },
229
+ "createdBy": {
230
+ "sys": {
231
+ "type": "Link",
232
+ "linkType": "User",
233
+ "id": "59Erm8D1JuuD273aXNb65T"
234
+ }
235
+ },
236
+ "updatedBy": {
237
+ "sys": {
238
+ "type": "Link",
239
+ "linkType": "User",
240
+ "id": "59Erm8D1JuuD273aXNb65T"
241
+ }
242
+ },
243
+ "version": 1,
244
+ "visibility": "public"
245
+ },
246
+ "name": "icon"
247
+ }
248
+ ]
249
+ }
250
+ http_version:
251
+ recorded_at: Tue, 19 Apr 2022 15:12:02 GMT
252
+ recorded_with: VCR 4.0.0