contentful-management 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +37 -8
  3. data/Gemfile +0 -1
  4. data/README.md +130 -0
  5. data/Rakefile +0 -1
  6. data/contentful-management.gemspec +0 -1
  7. data/examples/blog.rb +1 -1
  8. data/lib/contentful/management.rb +0 -1
  9. data/lib/contentful/management/array.rb +0 -1
  10. data/lib/contentful/management/asset.rb +65 -26
  11. data/lib/contentful/management/client.rb +19 -9
  12. data/lib/contentful/management/content_type.rb +43 -28
  13. data/lib/contentful/management/dynamic_entry.rb +15 -15
  14. data/lib/contentful/management/entry.rb +73 -40
  15. data/lib/contentful/management/error.rb +6 -1
  16. data/lib/contentful/management/field.rb +63 -8
  17. data/lib/contentful/management/file.rb +0 -1
  18. data/lib/contentful/management/http_client.rb +0 -1
  19. data/lib/contentful/management/link.rb +0 -1
  20. data/lib/contentful/management/locale.rb +11 -3
  21. data/lib/contentful/management/location.rb +0 -1
  22. data/lib/contentful/management/request.rb +5 -7
  23. data/lib/contentful/management/resource.rb +3 -3
  24. data/lib/contentful/management/resource/array_like.rb +0 -1
  25. data/lib/contentful/management/resource/fields.rb +1 -2
  26. data/lib/contentful/management/resource/refresher.rb +3 -3
  27. data/lib/contentful/management/resource/system_properties.rb +0 -1
  28. data/lib/contentful/management/resource_builder.rb +16 -27
  29. data/lib/contentful/management/response.rb +36 -32
  30. data/lib/contentful/management/space.rb +16 -6
  31. data/lib/contentful/management/space_webhook_methods_factory.rb +0 -4
  32. data/lib/contentful/management/support.rb +0 -1
  33. data/lib/contentful/management/validation.rb +34 -0
  34. data/lib/contentful/management/version.rb +1 -2
  35. data/lib/contentful/management/webhook.rb +17 -10
  36. data/spec/fixtures/vcr_cassettes/content_type/validation/in.yml +588 -0
  37. data/spec/fixtures/vcr_cassettes/content_type/validation/in_add.yml +620 -0
  38. data/spec/fixtures/vcr_cassettes/content_type/validation/in_update.yml +668 -0
  39. data/spec/fixtures/vcr_cassettes/content_type/validation/link_content_type.yml +749 -0
  40. data/spec/fixtures/vcr_cassettes/content_type/validation/link_field.yml +770 -0
  41. data/spec/fixtures/vcr_cassettes/content_type/validation/link_mimetype_group.yml +766 -0
  42. data/spec/fixtures/vcr_cassettes/content_type/validation/multiple_add.yml +854 -0
  43. data/spec/fixtures/vcr_cassettes/content_type/validation/present.yml +808 -0
  44. data/spec/fixtures/vcr_cassettes/content_type/validation/range.yml +683 -0
  45. data/spec/fixtures/vcr_cassettes/content_type/validation/range_update.yml +697 -0
  46. data/spec/fixtures/vcr_cassettes/content_type/validation/regexp.yml +720 -0
  47. data/spec/fixtures/vcr_cassettes/content_type/validation/size.yml +791 -0
  48. data/spec/fixtures/vcr_cassettes/entry/service_unavailable.yml +52 -0
  49. data/spec/fixtures/vcr_cassettes/space/webhook/create.yml +439 -0
  50. data/spec/lib/contentful/management/asset_spec.rb +16 -16
  51. data/spec/lib/contentful/management/client_spec.rb +0 -1
  52. data/spec/lib/contentful/management/content_type_spec.rb +143 -1
  53. data/spec/lib/contentful/management/entry_spec.rb +10 -4
  54. data/spec/lib/contentful/management/locale_spec.rb +0 -1
  55. data/spec/lib/contentful/management/space_spec.rb +9 -1
  56. data/spec/lib/contentful/management/webhook_spec.rb +0 -1
  57. data/spec/spec_helper.rb +0 -1
  58. data/spec/support/vcr.rb +0 -1
  59. metadata +63 -62
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/yr5m0jky5hsh/entries/not_exist
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContenfulManagementGem/0.0.1
12
+ Authorization:
13
+ - Bearer <ACCESS_TOKEN>
14
+ Content-Type:
15
+ - application/vnd.contentful.management.v1+json
16
+ Content-Length:
17
+ - '0'
18
+ Host:
19
+ - api.contentful.com
20
+ response:
21
+ status:
22
+ code: 503
23
+ message: Service Unavailable
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Wed, 30 Jul 2014 12:43:14 GMT
29
+ Content-Type:
30
+ - application/vnd.contentful.management.v1+json
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ X-Powered-By:
36
+ - Express
37
+ Access-Control-Allow-Origin:
38
+ - "*"
39
+ Access-Control-Allow-Headers:
40
+ - 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
41
+ Access-Control-Allow-Methods:
42
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
43
+ "^access-Control-Expose-Headers":
44
+ - Etag
45
+ Access-Control-Max-Age:
46
+ - '1728000'
47
+ body:
48
+ encoding: UTF-8
49
+ string: ''
50
+ http_version:
51
+ recorded_at: Wed, 30 Jul 2014 12:43:14 GMT
52
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,439 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/v2umtz8ths9v
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContenfulManagementGem/0.2.1
12
+ Authorization:
13
+ - Bearer <ACCESS_TOKEN>
14
+ Content-Type:
15
+ - application/vnd.contentful.management.v1+json
16
+ Content-Length:
17
+ - '0'
18
+ Host:
19
+ - api.contentful.com
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ "^access-Control-Expose-Headers":
26
+ - Etag
27
+ Accept-Ranges:
28
+ - bytes
29
+ Access-Control-Allow-Headers:
30
+ - 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
31
+ Access-Control-Allow-Methods:
32
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
33
+ Access-Control-Allow-Origin:
34
+ - "*"
35
+ Access-Control-Max-Age:
36
+ - '1728000'
37
+ Cache-Control:
38
+ - max-age=0
39
+ Content-Type:
40
+ - application/vnd.contentful.management.v1+json
41
+ Date:
42
+ - Tue, 30 Sep 2014 07:15:20 GMT
43
+ Etag:
44
+ - '"35407b8a88882fe5717a4701910f6ce7"'
45
+ Server:
46
+ - nginx
47
+ Status:
48
+ - 200 OK
49
+ X-Contentful-Request-Id:
50
+ - f1c-1385368067
51
+ Content-Length:
52
+ - '459'
53
+ Connection:
54
+ - keep-alive
55
+ body:
56
+ encoding: UTF-8
57
+ string: |
58
+ {
59
+ "sys":{
60
+ "type":"Space",
61
+ "id":"v2umtz8ths9v",
62
+ "version":1,
63
+ "createdBy":{
64
+ "sys":{
65
+ "type":"Link",
66
+ "linkType":"User",
67
+ "id":"1E7acJL8I5XUXAMHQt9Grs"
68
+ }
69
+ },
70
+ "createdAt":"2014-08-21T13:32:11Z",
71
+ "updatedBy":{
72
+ "sys":{
73
+ "type":"Link",
74
+ "linkType":"User",
75
+ "id":"1E7acJL8I5XUXAMHQt9Grs"
76
+ }
77
+ },
78
+ "updatedAt":"2014-08-21T13:32:12Z"
79
+ },
80
+ "name":"CMA Demo Rails App"}
81
+ http_version:
82
+ recorded_at: Tue, 30 Sep 2014 07:17:04 GMT
83
+ - request:
84
+ method: get
85
+ uri: https://api.contentful.com/spaces/v2umtz8ths9v/content_types
86
+ body:
87
+ encoding: US-ASCII
88
+ string: ''
89
+ headers:
90
+ User-Agent:
91
+ - RubyContenfulManagementGem/0.2.1
92
+ Authorization:
93
+ - Bearer <ACCESS_TOKEN>
94
+ Content-Type:
95
+ - application/vnd.contentful.management.v1+json
96
+ Content-Length:
97
+ - '0'
98
+ Host:
99
+ - api.contentful.com
100
+ response:
101
+ status:
102
+ code: 200
103
+ message: OK
104
+ headers:
105
+ "^access-Control-Expose-Headers":
106
+ - Etag
107
+ Access-Control-Allow-Headers:
108
+ - 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
109
+ Access-Control-Allow-Methods:
110
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
111
+ Access-Control-Allow-Origin:
112
+ - "*"
113
+ Access-Control-Max-Age:
114
+ - '1728000'
115
+ Cf-Space-Id:
116
+ - v2umtz8ths9v
117
+ Content-Type:
118
+ - application/vnd.contentful.management.v1+json
119
+ Date:
120
+ - Tue, 30 Sep 2014 07:15:21 GMT
121
+ Etag:
122
+ - '"2a8abfd957b4ad9b6b47f853bd58078a"'
123
+ Server:
124
+ - nginx
125
+ X-Powered-By:
126
+ - Express
127
+ Content-Length:
128
+ - '5193'
129
+ Connection:
130
+ - keep-alive
131
+ body:
132
+ encoding: UTF-8
133
+ string: |
134
+ {
135
+ "sys": {
136
+ "type": "Array"
137
+ },
138
+ "total": 3,
139
+ "skip": 0,
140
+ "limit": 100,
141
+ "items": [
142
+ {
143
+ "fields": [
144
+ {
145
+ "name": "testowe",
146
+ "id": "testowe",
147
+ "type": "Link",
148
+ "uiid": "3q907mcb4lc",
149
+ "linkType": "Asset",
150
+ "required": true,
151
+ "localized": true
152
+ }
153
+ ],
154
+ "name": "test",
155
+ "sys": {
156
+ "id": "26eLfV14SIOeQkse44q4sw",
157
+ "type": "ContentType",
158
+ "createdAt": "2014-08-22T12:57:43.618Z",
159
+ "createdBy": {
160
+ "sys": {
161
+ "type": "Link",
162
+ "linkType": "User",
163
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
164
+ }
165
+ },
166
+ "space": {
167
+ "sys": {
168
+ "type": "Link",
169
+ "linkType": "Space",
170
+ "id": "v2umtz8ths9v"
171
+ }
172
+ },
173
+ "firstPublishedAt": "2014-08-22T12:57:53.093Z",
174
+ "publishedCounter": 2,
175
+ "publishedAt": "2014-08-22T12:57:58.628Z",
176
+ "publishedBy": {
177
+ "sys": {
178
+ "type": "Link",
179
+ "linkType": "User",
180
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
181
+ }
182
+ },
183
+ "publishedVersion": 13,
184
+ "version": 14,
185
+ "updatedAt": "2014-08-22T12:57:58.633Z",
186
+ "updatedBy": {
187
+ "sys": {
188
+ "type": "Link",
189
+ "linkType": "User",
190
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
191
+ }
192
+ }
193
+ }
194
+ },
195
+ {
196
+ "displayField": "title",
197
+ "name": "Post",
198
+ "description": "",
199
+ "fields": [
200
+ {
201
+ "id": "title",
202
+ "name": "Title",
203
+ "type": "Text",
204
+ "localized": true,
205
+ "uiid": "2sdir2f8kcg"
206
+ },
207
+ {
208
+ "id": "author",
209
+ "name": "Author",
210
+ "type": "Text",
211
+ "localized": true,
212
+ "uiid": "4x1018907pc"
213
+ },
214
+ {
215
+ "id": "body",
216
+ "name": "Body",
217
+ "type": "Text",
218
+ "localized": true,
219
+ "uiid": "4hj7cda89hc"
220
+ },
221
+ {
222
+ "id": "title_image",
223
+ "name": "Title Image",
224
+ "type": "Link",
225
+ "linkType": "Asset",
226
+ "required": true,
227
+ "localized": true,
228
+ "uiid": "4gcqrcma8lc"
229
+ },
230
+ {
231
+ "id": "second_image",
232
+ "name": "Second Image",
233
+ "type": "Link",
234
+ "linkType": "Asset",
235
+ "localized": true,
236
+ "uiid": "40440elrugw"
237
+ },
238
+ {
239
+ "id": "category",
240
+ "name": "Category",
241
+ "type": "Link",
242
+ "linkType": "Entry",
243
+ "uiid": "49vicjvqsxs",
244
+ "localized": true
245
+ }
246
+ ],
247
+ "sys": {
248
+ "id": "post_content_type",
249
+ "type": "ContentType",
250
+ "createdAt": "2014-08-21T13:32:30.401Z",
251
+ "createdBy": {
252
+ "sys": {
253
+ "type": "Link",
254
+ "linkType": "User",
255
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
256
+ }
257
+ },
258
+ "space": {
259
+ "sys": {
260
+ "type": "Link",
261
+ "linkType": "Space",
262
+ "id": "v2umtz8ths9v"
263
+ }
264
+ },
265
+ "firstPublishedAt": "2014-08-21T13:32:43.385Z",
266
+ "publishedCounter": 2,
267
+ "publishedAt": "2014-08-27T09:18:36.995Z",
268
+ "publishedBy": {
269
+ "sys": {
270
+ "type": "Link",
271
+ "linkType": "User",
272
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
273
+ }
274
+ },
275
+ "publishedVersion": 11,
276
+ "version": 12,
277
+ "updatedAt": "2014-08-27T09:18:37.003Z",
278
+ "updatedBy": {
279
+ "sys": {
280
+ "type": "Link",
281
+ "linkType": "User",
282
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
283
+ }
284
+ }
285
+ }
286
+ },
287
+ {
288
+ "displayField": "name",
289
+ "name": "Category",
290
+ "description": "",
291
+ "fields": [
292
+ {
293
+ "id": "name",
294
+ "name": "Name",
295
+ "type": "Text",
296
+ "localized": true,
297
+ "uiid": "3ic0t3qi51c"
298
+ },
299
+ {
300
+ "id": "description",
301
+ "name": "Description",
302
+ "type": "Text",
303
+ "localized": false,
304
+ "uiid": "38xiq8fobnk"
305
+ }
306
+ ],
307
+ "sys": {
308
+ "id": "category_content_type",
309
+ "type": "ContentType",
310
+ "createdAt": "2014-08-21T13:32:20.955Z",
311
+ "createdBy": {
312
+ "sys": {
313
+ "type": "Link",
314
+ "linkType": "User",
315
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
316
+ }
317
+ },
318
+ "space": {
319
+ "sys": {
320
+ "type": "Link",
321
+ "linkType": "Space",
322
+ "id": "v2umtz8ths9v"
323
+ }
324
+ },
325
+ "firstPublishedAt": "2014-08-21T13:32:27.109Z",
326
+ "publishedCounter": 8,
327
+ "publishedAt": "2014-09-04T18:02:17.407Z",
328
+ "publishedBy": {
329
+ "sys": {
330
+ "type": "Link",
331
+ "linkType": "User",
332
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
333
+ }
334
+ },
335
+ "publishedVersion": 31,
336
+ "version": 32,
337
+ "updatedAt": "2014-09-04T18:02:17.415Z",
338
+ "updatedBy": {
339
+ "sys": {
340
+ "type": "Link",
341
+ "linkType": "User",
342
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
343
+ }
344
+ }
345
+ }
346
+ }
347
+ ]
348
+ }
349
+ http_version:
350
+ recorded_at: Tue, 30 Sep 2014 07:17:05 GMT
351
+ - request:
352
+ method: post
353
+ uri: https://api.contentful.com/spaces/v2umtz8ths9v/webhook_definitions/
354
+ body:
355
+ encoding: UTF-8
356
+ string: '{"url":"https://www.example2.com","httpBasicUsername":"username","httpBasicPassword":"password"}'
357
+ headers:
358
+ User-Agent:
359
+ - RubyContenfulManagementGem/0.2.1
360
+ Authorization:
361
+ - Bearer <ACCESS_TOKEN>
362
+ Content-Type:
363
+ - application/vnd.contentful.management.v1+json
364
+ Host:
365
+ - api.contentful.com
366
+ response:
367
+ status:
368
+ code: 201
369
+ message: Created
370
+ headers:
371
+ "^access-Control-Expose-Headers":
372
+ - Etag
373
+ Accept-Ranges:
374
+ - bytes
375
+ Access-Control-Allow-Headers:
376
+ - 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
377
+ Access-Control-Allow-Methods:
378
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
379
+ Access-Control-Allow-Origin:
380
+ - "*"
381
+ Access-Control-Max-Age:
382
+ - '1728000'
383
+ Cache-Control:
384
+ - max-age=0
385
+ Content-Type:
386
+ - application/vnd.contentful.management.v1+json
387
+ Date:
388
+ - Tue, 30 Sep 2014 07:15:22 GMT
389
+ Etag:
390
+ - '"513cf90da6f46881e5ab8b83be3d95ab"'
391
+ Location:
392
+ - https://api.contentful.com/spaces/v2umtz8ths9v/webhook_definitions/3CBK9NzGAJYVrsYoBGZyh8
393
+ Server:
394
+ - nginx
395
+ Status:
396
+ - 201 Created
397
+ X-Contentful-Request-Id:
398
+ - 85f-945148745
399
+ Content-Length:
400
+ - '642'
401
+ Connection:
402
+ - keep-alive
403
+ body:
404
+ encoding: UTF-8
405
+ string: |
406
+ {
407
+ "sys":{
408
+ "type":"WebhookDefinition",
409
+ "id":"3CBK9NzGAJYVrsYoBGZyh8",
410
+ "version":0,
411
+ "space":{
412
+ "sys":{
413
+ "type":"Link",
414
+ "linkType":"Space",
415
+ "id":"v2umtz8ths9v"
416
+ }
417
+ },
418
+ "createdBy":{
419
+ "sys":{
420
+ "type":"Link",
421
+ "linkType":"User",
422
+ "id":"1E7acJL8I5XUXAMHQt9Grs"
423
+ }
424
+ },
425
+ "createdAt":"2014-09-30T07:15:22Z",
426
+ "updatedBy":{
427
+ "sys":{
428
+ "type":"Link",
429
+ "linkType":"User",
430
+ "id":"1E7acJL8I5XUXAMHQt9Grs"
431
+ }
432
+ },
433
+ "updatedAt":"2014-09-30T07:15:22Z"
434
+ },
435
+ "url":"https://www.example2.com",
436
+ "httpBasicUsername":"username"}
437
+ http_version:
438
+ recorded_at: Tue, 30 Sep 2014 07:17:07 GMT
439
+ recorded_with: VCR 2.9.2