contentful-management 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/CHANGELOG.md +8 -0
  2. data/README.md +17 -0
  3. data/lib/contentful/management/array.rb +3 -1
  4. data/lib/contentful/management/asset.rb +16 -14
  5. data/lib/contentful/management/client.rb +1 -1
  6. data/lib/contentful/management/content_type.rb +18 -18
  7. data/lib/contentful/management/entry.rb +20 -19
  8. data/lib/contentful/management/locale.rb +4 -4
  9. data/lib/contentful/management/request.rb +4 -2
  10. data/lib/contentful/management/resource.rb +8 -8
  11. data/lib/contentful/management/resource/refresher.rb +8 -1
  12. data/lib/contentful/management/resource_builder.rb +3 -3
  13. data/lib/contentful/management/response.rb +10 -3
  14. data/lib/contentful/management/space.rb +11 -11
  15. data/lib/contentful/management/version.rb +1 -1
  16. data/spec/fixtures/vcr_cassettes/asset/create_with_locale.yml +151 -0
  17. data/spec/fixtures/vcr_cassettes/asset/limited_assets_next_page.yml +123 -0
  18. data/spec/fixtures/vcr_cassettes/asset/reload.yml +406 -0
  19. data/spec/fixtures/vcr_cassettes/content_type/reload.yml +394 -0
  20. data/spec/fixtures/vcr_cassettes/entry/all.yml +231 -36
  21. data/spec/fixtures/vcr_cassettes/entry/content_type_entires.yml +99 -23
  22. data/spec/fixtures/vcr_cassettes/entry/create_with_specified_locale.yml +509 -0
  23. data/spec/fixtures/vcr_cassettes/entry/limited_entries.yml +236 -0
  24. data/spec/fixtures/vcr_cassettes/entry/reload.yml +1027 -0
  25. data/spec/fixtures/vcr_cassettes/locale/reload.yml +279 -0
  26. data/spec/fixtures/vcr_cassettes/space/asset/all_with_skip_and_limit.yml +355 -0
  27. data/spec/fixtures/vcr_cassettes/space/asset/with_skipped_and_limited_assets_next_page.yml +635 -0
  28. data/spec/fixtures/vcr_cassettes/space/entry/with_skipped_and_limited_entires_next_page.yml +648 -0
  29. data/spec/fixtures/vcr_cassettes/space/entry/with_skipped_andlimited_entires.yml +468 -0
  30. data/spec/fixtures/vcr_cassettes/space/reload.yml +739 -0
  31. data/spec/lib/contentful/management/asset_spec.rb +42 -2
  32. data/spec/lib/contentful/management/content_type_spec.rb +16 -1
  33. data/spec/lib/contentful/management/entry_spec.rb +38 -5
  34. data/spec/lib/contentful/management/locale_spec.rb +14 -0
  35. data/spec/lib/contentful/management/space_spec.rb +46 -2
  36. metadata +31 -5
@@ -0,0 +1,509 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/s37a4pe35l1x
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContenfulManagementGem/0.0.2
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
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Sun, 17 Aug 2014 13:17:09 GMT
29
+ Content-Type:
30
+ - application/vnd.contentful.management.v1+json
31
+ Content-Length:
32
+ - '459'
33
+ Connection:
34
+ - keep-alive
35
+ Status:
36
+ - 200 OK
37
+ X-Contentful-Request-Id:
38
+ - 85f-1336709330
39
+ Etag:
40
+ - '"9d5bcd9580cc469d4f68ace4996fab91"'
41
+ Accept-Ranges:
42
+ - bytes
43
+ Cache-Control:
44
+ - max-age=0
45
+ Access-Control-Allow-Origin:
46
+ - "*"
47
+ Access-Control-Allow-Headers:
48
+ - 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
49
+ Access-Control-Allow-Methods:
50
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
51
+ "^access-Control-Expose-Headers":
52
+ - Etag
53
+ Access-Control-Max-Age:
54
+ - '1728000'
55
+ body:
56
+ encoding: UTF-8
57
+ string: |
58
+ {
59
+ "sys":{
60
+ "type":"Space",
61
+ "id":"s37a4pe35l1x",
62
+ "version":1,
63
+ "createdBy":{
64
+ "sys":{
65
+ "type":"Link",
66
+ "linkType":"User",
67
+ "id":"1E7acJL8I5XUXAMHQt9Grs"
68
+ }
69
+ },
70
+ "createdAt":"2014-08-14T08:10:29Z",
71
+ "updatedBy":{
72
+ "sys":{
73
+ "type":"Link",
74
+ "linkType":"User",
75
+ "id":"1E7acJL8I5XUXAMHQt9Grs"
76
+ }
77
+ },
78
+ "updatedAt":"2014-08-14T08:10:29Z"
79
+ },
80
+ "name":"CMA_demo_rails_app"}
81
+ http_version:
82
+ recorded_at: Sun, 17 Aug 2014 13:17:13 GMT
83
+ - request:
84
+ method: get
85
+ uri: https://api.contentful.com/spaces/s37a4pe35l1x/content_types
86
+ body:
87
+ encoding: US-ASCII
88
+ string: ''
89
+ headers:
90
+ User-Agent:
91
+ - RubyContenfulManagementGem/0.0.2
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
+ Server:
106
+ - nginx
107
+ Date:
108
+ - Sun, 17 Aug 2014 13:17:09 GMT
109
+ Content-Type:
110
+ - application/vnd.contentful.management.v1+json
111
+ Content-Length:
112
+ - '3869'
113
+ Connection:
114
+ - keep-alive
115
+ X-Powered-By:
116
+ - Express
117
+ Cf-Space-Id:
118
+ - s37a4pe35l1x
119
+ Etag:
120
+ - '"a1a137f3c02effb86c458426f434e6c5"'
121
+ Access-Control-Allow-Origin:
122
+ - "*"
123
+ Access-Control-Allow-Headers:
124
+ - 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
125
+ Access-Control-Allow-Methods:
126
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
127
+ "^access-Control-Expose-Headers":
128
+ - Etag
129
+ Access-Control-Max-Age:
130
+ - '1728000'
131
+ body:
132
+ encoding: UTF-8
133
+ string: |
134
+ {
135
+ "sys": {
136
+ "type": "Array"
137
+ },
138
+ "total": 2,
139
+ "skip": 0,
140
+ "limit": 100,
141
+ "items": [
142
+ {
143
+ "displayField": "post_title",
144
+ "name": "Post",
145
+ "description": "",
146
+ "fields": [
147
+ {
148
+ "id": "post_title",
149
+ "name": "Title",
150
+ "type": "Text",
151
+ "localized": true,
152
+ "uiid": "3spughz6ghs"
153
+ },
154
+ {
155
+ "id": "post_author",
156
+ "name": "Author",
157
+ "type": "Text",
158
+ "localized": true,
159
+ "uiid": "4dkqg6h1csg"
160
+ },
161
+ {
162
+ "id": "post_body",
163
+ "name": "Body",
164
+ "type": "Text",
165
+ "localized": true,
166
+ "uiid": "3g74k6duiv4"
167
+ },
168
+ {
169
+ "id": "post_title_image",
170
+ "name": "Title Image",
171
+ "type": "Link",
172
+ "linkType": "Asset",
173
+ "required": true,
174
+ "localized": true,
175
+ "uiid": "354ugb4mdxc"
176
+ },
177
+ {
178
+ "id": "post_second_image",
179
+ "name": "Second Image",
180
+ "type": "Link",
181
+ "linkType": "Asset",
182
+ "localized": true,
183
+ "uiid": "4eddpb6ek8w"
184
+ },
185
+ {
186
+ "id": "post_category_id",
187
+ "name": "Category",
188
+ "type": "Link",
189
+ "linkType": "Entry",
190
+ "uiid": "351r9x54s1s"
191
+ }
192
+ ],
193
+ "sys": {
194
+ "id": "post_content_type",
195
+ "type": "ContentType",
196
+ "createdAt": "2014-08-14T08:10:42.615Z",
197
+ "createdBy": {
198
+ "sys": {
199
+ "type": "Link",
200
+ "linkType": "User",
201
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
202
+ }
203
+ },
204
+ "space": {
205
+ "sys": {
206
+ "type": "Link",
207
+ "linkType": "Space",
208
+ "id": "s37a4pe35l1x"
209
+ }
210
+ },
211
+ "firstPublishedAt": "2014-08-14T08:10:51.146Z",
212
+ "publishedCounter": 1,
213
+ "publishedAt": "2014-08-14T08:10:51.146Z",
214
+ "publishedBy": {
215
+ "sys": {
216
+ "type": "Link",
217
+ "linkType": "User",
218
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
219
+ }
220
+ },
221
+ "publishedVersion": 8,
222
+ "version": 10,
223
+ "updatedAt": "2014-08-14T08:25:00.305Z",
224
+ "updatedBy": {
225
+ "sys": {
226
+ "type": "Link",
227
+ "linkType": "User",
228
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
229
+ }
230
+ }
231
+ }
232
+ },
233
+ {
234
+ "displayField": "name",
235
+ "name": "Category",
236
+ "description": "",
237
+ "fields": [
238
+ {
239
+ "id": "name",
240
+ "name": "Name",
241
+ "type": "Text",
242
+ "localized": true,
243
+ "uiid": "321vjouktfk"
244
+ },
245
+ {
246
+ "id": "description",
247
+ "name": "Description",
248
+ "type": "Text",
249
+ "localized": true,
250
+ "uiid": "3u8ihlzl14w"
251
+ }
252
+ ],
253
+ "sys": {
254
+ "id": "category_content_type",
255
+ "type": "ContentType",
256
+ "createdAt": "2014-08-14T08:10:36.579Z",
257
+ "createdBy": {
258
+ "sys": {
259
+ "type": "Link",
260
+ "linkType": "User",
261
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
262
+ }
263
+ },
264
+ "space": {
265
+ "sys": {
266
+ "type": "Link",
267
+ "linkType": "Space",
268
+ "id": "s37a4pe35l1x"
269
+ }
270
+ },
271
+ "firstPublishedAt": "2014-08-14T08:10:41.390Z",
272
+ "publishedCounter": 1,
273
+ "publishedAt": "2014-08-14T08:10:41.390Z",
274
+ "publishedBy": {
275
+ "sys": {
276
+ "type": "Link",
277
+ "linkType": "User",
278
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
279
+ }
280
+ },
281
+ "publishedVersion": 4,
282
+ "version": 6,
283
+ "updatedAt": "2014-08-17T13:05:02.795Z",
284
+ "updatedBy": {
285
+ "sys": {
286
+ "type": "Link",
287
+ "linkType": "User",
288
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
289
+ }
290
+ }
291
+ }
292
+ }
293
+ ]
294
+ }
295
+ http_version:
296
+ recorded_at: Sun, 17 Aug 2014 13:17:14 GMT
297
+ - request:
298
+ method: get
299
+ uri: https://api.contentful.com/spaces/s37a4pe35l1x/content_types/category_content_type
300
+ body:
301
+ encoding: US-ASCII
302
+ string: ''
303
+ headers:
304
+ User-Agent:
305
+ - RubyContenfulManagementGem/0.0.2
306
+ Authorization:
307
+ - Bearer <ACCESS_TOKEN>
308
+ Content-Type:
309
+ - application/vnd.contentful.management.v1+json
310
+ Content-Length:
311
+ - '0'
312
+ Host:
313
+ - api.contentful.com
314
+ response:
315
+ status:
316
+ code: 200
317
+ message: OK
318
+ headers:
319
+ Server:
320
+ - nginx
321
+ Date:
322
+ - Sun, 17 Aug 2014 13:17:10 GMT
323
+ Content-Type:
324
+ - application/vnd.contentful.management.v1+json
325
+ Content-Length:
326
+ - '1251'
327
+ Connection:
328
+ - keep-alive
329
+ X-Powered-By:
330
+ - Express
331
+ Cf-Space-Id:
332
+ - s37a4pe35l1x
333
+ Etag:
334
+ - '"29e0549b4ddf2bfb7598f4a0e365fc5b"'
335
+ Access-Control-Allow-Origin:
336
+ - "*"
337
+ Access-Control-Allow-Headers:
338
+ - 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
339
+ Access-Control-Allow-Methods:
340
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
341
+ "^access-Control-Expose-Headers":
342
+ - Etag
343
+ Access-Control-Max-Age:
344
+ - '1728000'
345
+ body:
346
+ encoding: UTF-8
347
+ string: |
348
+ {
349
+ "displayField": "name",
350
+ "name": "Category",
351
+ "description": "",
352
+ "fields": [
353
+ {
354
+ "id": "name",
355
+ "name": "Name",
356
+ "type": "Text",
357
+ "localized": true,
358
+ "uiid": "321vjouktfk"
359
+ },
360
+ {
361
+ "id": "description",
362
+ "name": "Description",
363
+ "type": "Text",
364
+ "localized": true,
365
+ "uiid": "3u8ihlzl14w"
366
+ }
367
+ ],
368
+ "sys": {
369
+ "id": "category_content_type",
370
+ "type": "ContentType",
371
+ "createdAt": "2014-08-14T08:10:36.579Z",
372
+ "createdBy": {
373
+ "sys": {
374
+ "type": "Link",
375
+ "linkType": "User",
376
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
377
+ }
378
+ },
379
+ "space": {
380
+ "sys": {
381
+ "type": "Link",
382
+ "linkType": "Space",
383
+ "id": "s37a4pe35l1x"
384
+ }
385
+ },
386
+ "firstPublishedAt": "2014-08-14T08:10:41.390Z",
387
+ "publishedCounter": 1,
388
+ "publishedAt": "2014-08-14T08:10:41.390Z",
389
+ "publishedBy": {
390
+ "sys": {
391
+ "type": "Link",
392
+ "linkType": "User",
393
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
394
+ }
395
+ },
396
+ "publishedVersion": 4,
397
+ "version": 6,
398
+ "updatedAt": "2014-08-17T13:05:02.795Z",
399
+ "updatedBy": {
400
+ "sys": {
401
+ "type": "Link",
402
+ "linkType": "User",
403
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
404
+ }
405
+ }
406
+ }
407
+ }
408
+ http_version:
409
+ recorded_at: Sun, 17 Aug 2014 13:17:14 GMT
410
+ - request:
411
+ method: post
412
+ uri: https://api.contentful.com/spaces/s37a4pe35l1x/entries/
413
+ body:
414
+ encoding: UTF-8
415
+ string: '{"fields":{"name":{"pl-PL":"Create test"},"description":{"pl-PL":"Test
416
+ - create entry with specified locale."}}}'
417
+ headers:
418
+ User-Agent:
419
+ - RubyContenfulManagementGem/0.0.2
420
+ Authorization:
421
+ - Bearer <ACCESS_TOKEN>
422
+ Content-Type:
423
+ - application/vnd.contentful.management.v1+json
424
+ X-Contentful-Content-Type:
425
+ - category_content_type
426
+ Host:
427
+ - api.contentful.com
428
+ response:
429
+ status:
430
+ code: 201
431
+ message: Created
432
+ headers:
433
+ Server:
434
+ - nginx
435
+ Date:
436
+ - Sun, 17 Aug 2014 13:17:11 GMT
437
+ Content-Type:
438
+ - application/vnd.contentful.management.v1+json
439
+ Content-Length:
440
+ - '894'
441
+ Connection:
442
+ - keep-alive
443
+ X-Powered-By:
444
+ - Express
445
+ Cf-Space-Id:
446
+ - s37a4pe35l1x
447
+ Etag:
448
+ - '"234fcf2651164c8dc53ab047b9bd9b3d"'
449
+ Access-Control-Allow-Origin:
450
+ - "*"
451
+ Access-Control-Allow-Headers:
452
+ - 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
453
+ Access-Control-Allow-Methods:
454
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
455
+ "^access-Control-Expose-Headers":
456
+ - Etag
457
+ Access-Control-Max-Age:
458
+ - '1728000'
459
+ body:
460
+ encoding: UTF-8
461
+ string: |
462
+ {
463
+ "fields": {
464
+ "name": {
465
+ "pl-PL": "Create test"
466
+ },
467
+ "description": {
468
+ "pl-PL": "Test - create entry with specified locale."
469
+ }
470
+ },
471
+ "sys": {
472
+ "id": "6R4Ya9FbPOco0cEiSGUa2y",
473
+ "type": "Entry",
474
+ "version": 1,
475
+ "createdAt": "2014-08-17T13:17:11.481Z",
476
+ "createdBy": {
477
+ "sys": {
478
+ "type": "Link",
479
+ "linkType": "User",
480
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
481
+ }
482
+ },
483
+ "space": {
484
+ "sys": {
485
+ "type": "Link",
486
+ "linkType": "Space",
487
+ "id": "s37a4pe35l1x"
488
+ }
489
+ },
490
+ "contentType": {
491
+ "sys": {
492
+ "type": "Link",
493
+ "linkType": "ContentType",
494
+ "id": "category_content_type"
495
+ }
496
+ },
497
+ "updatedAt": "2014-08-17T13:17:11.481Z",
498
+ "updatedBy": {
499
+ "sys": {
500
+ "type": "Link",
501
+ "linkType": "User",
502
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
503
+ }
504
+ }
505
+ }
506
+ }
507
+ http_version:
508
+ recorded_at: Sun, 17 Aug 2014 13:17:15 GMT
509
+ recorded_with: VCR 2.9.2