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,468 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/bfsvtul0c41g
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
+ - Mon, 18 Aug 2014 10:36:04 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-1336822588
39
+ Etag:
40
+ - '"4c0ee33eddaabc719d0b81c1ef79fdc4"'
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":"bfsvtul0c41g",
62
+ "version":1,
63
+ "createdBy":{
64
+ "sys":{
65
+ "type":"Link",
66
+ "linkType":"User",
67
+ "id":"1E7acJL8I5XUXAMHQt9Grs"
68
+ }
69
+ },
70
+ "createdAt":"2014-08-18T06:51:53Z",
71
+ "updatedBy":{
72
+ "sys":{
73
+ "type":"Link",
74
+ "linkType":"User",
75
+ "id":"1E7acJL8I5XUXAMHQt9Grs"
76
+ }
77
+ },
78
+ "updatedAt":"2014-08-18T06:51:53Z"
79
+ },
80
+ "name":"CMA_demo_rails_app"}
81
+ http_version:
82
+ recorded_at: Mon, 18 Aug 2014 10:36:07 GMT
83
+ - request:
84
+ method: get
85
+ uri: https://api.contentful.com/spaces/bfsvtul0c41g/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
+ - Mon, 18 Aug 2014 10:36:05 GMT
109
+ Content-Type:
110
+ - application/vnd.contentful.management.v1+json
111
+ Content-Length:
112
+ - '3803'
113
+ Connection:
114
+ - keep-alive
115
+ X-Powered-By:
116
+ - Express
117
+ Cf-Space-Id:
118
+ - bfsvtul0c41g
119
+ Etag:
120
+ - '"f8683c81df6a0f04b760d45a4691c0d1"'
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": "4c2845dis5c"
153
+ },
154
+ {
155
+ "id": "post_author",
156
+ "name": "Author",
157
+ "type": "Text",
158
+ "localized": true,
159
+ "uiid": "33civwoz2m8"
160
+ },
161
+ {
162
+ "id": "post_body",
163
+ "name": "Body",
164
+ "type": "Text",
165
+ "localized": true,
166
+ "uiid": "4j1mezqb11c"
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": "2kxgld064g0"
176
+ },
177
+ {
178
+ "id": "post_second_image",
179
+ "name": "Second Image",
180
+ "type": "Link",
181
+ "linkType": "Asset",
182
+ "localized": true,
183
+ "uiid": "4enlmvd4ow0"
184
+ },
185
+ {
186
+ "id": "post_category_id",
187
+ "name": "Category",
188
+ "type": "Link",
189
+ "linkType": "Entry",
190
+ "uiid": "3nqbmf37k00"
191
+ }
192
+ ],
193
+ "sys": {
194
+ "id": "post_content_type",
195
+ "type": "ContentType",
196
+ "createdAt": "2014-08-18T06:52:03.545Z",
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": "bfsvtul0c41g"
209
+ }
210
+ },
211
+ "firstPublishedAt": "2014-08-18T06:52:10.462Z",
212
+ "publishedCounter": 1,
213
+ "publishedAt": "2014-08-18T06:52:10.462Z",
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-18T06:52:58.404Z",
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
+ },
244
+ {
245
+ "id": "description",
246
+ "name": "Description",
247
+ "type": "Text",
248
+ "localized": true
249
+ }
250
+ ],
251
+ "sys": {
252
+ "id": "category_content_type",
253
+ "type": "ContentType",
254
+ "createdAt": "2014-08-18T06:51:59.560Z",
255
+ "createdBy": {
256
+ "sys": {
257
+ "type": "Link",
258
+ "linkType": "User",
259
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
260
+ }
261
+ },
262
+ "space": {
263
+ "sys": {
264
+ "type": "Link",
265
+ "linkType": "Space",
266
+ "id": "bfsvtul0c41g"
267
+ }
268
+ },
269
+ "firstPublishedAt": "2014-08-18T06:52:02.517Z",
270
+ "publishedCounter": 1,
271
+ "publishedAt": "2014-08-18T06:52:02.517Z",
272
+ "publishedBy": {
273
+ "sys": {
274
+ "type": "Link",
275
+ "linkType": "User",
276
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
277
+ }
278
+ },
279
+ "publishedVersion": 4,
280
+ "version": 5,
281
+ "updatedAt": "2014-08-18T06:52:02.524Z",
282
+ "updatedBy": {
283
+ "sys": {
284
+ "type": "Link",
285
+ "linkType": "User",
286
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
287
+ }
288
+ }
289
+ }
290
+ }
291
+ ]
292
+ }
293
+ http_version:
294
+ recorded_at: Mon, 18 Aug 2014 10:36:08 GMT
295
+ - request:
296
+ method: get
297
+ uri: https://api.contentful.com/spaces/bfsvtul0c41g/entries?limit=2&skip=1
298
+ body:
299
+ encoding: US-ASCII
300
+ string: ''
301
+ headers:
302
+ User-Agent:
303
+ - RubyContenfulManagementGem/0.0.2
304
+ Authorization:
305
+ - Bearer <ACCESS_TOKEN>
306
+ Content-Type:
307
+ - application/vnd.contentful.management.v1+json
308
+ Host:
309
+ - api.contentful.com
310
+ response:
311
+ status:
312
+ code: 200
313
+ message: OK
314
+ headers:
315
+ Server:
316
+ - nginx
317
+ Date:
318
+ - Mon, 18 Aug 2014 10:36:05 GMT
319
+ Content-Type:
320
+ - application/vnd.contentful.management.v1+json
321
+ Content-Length:
322
+ - '2842'
323
+ Connection:
324
+ - keep-alive
325
+ X-Powered-By:
326
+ - Express
327
+ Cf-Space-Id:
328
+ - bfsvtul0c41g
329
+ Etag:
330
+ - '"f2c89a70a541675cf0c4979205a37bfd"'
331
+ Access-Control-Allow-Origin:
332
+ - "*"
333
+ Access-Control-Allow-Headers:
334
+ - 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
335
+ Access-Control-Allow-Methods:
336
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
337
+ "^access-Control-Expose-Headers":
338
+ - Etag
339
+ Access-Control-Max-Age:
340
+ - '1728000'
341
+ body:
342
+ encoding: UTF-8
343
+ string: |
344
+ {
345
+ "sys": {
346
+ "type": "Array"
347
+ },
348
+ "total": 4,
349
+ "skip": 1,
350
+ "limit": 2,
351
+ "items": [
352
+ {
353
+ "fields": {
354
+ "name": {
355
+ "en-US": "Sport"
356
+ },
357
+ "description": {
358
+ "en-US": "Sport category"
359
+ }
360
+ },
361
+ "sys": {
362
+ "id": "5zZ8SnlKNiy2yEMOaecegy",
363
+ "type": "Entry",
364
+ "createdAt": "2014-08-18T07:14:23.057Z",
365
+ "createdBy": {
366
+ "sys": {
367
+ "type": "Link",
368
+ "linkType": "User",
369
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
370
+ }
371
+ },
372
+ "space": {
373
+ "sys": {
374
+ "type": "Link",
375
+ "linkType": "Space",
376
+ "id": "bfsvtul0c41g"
377
+ }
378
+ },
379
+ "contentType": {
380
+ "sys": {
381
+ "type": "Link",
382
+ "linkType": "ContentType",
383
+ "id": "category_content_type"
384
+ }
385
+ },
386
+ "firstPublishedAt": "2014-08-18T08:17:36.632Z",
387
+ "publishedCounter": 1,
388
+ "publishedAt": "2014-08-18T08:17:36.632Z",
389
+ "publishedBy": {
390
+ "sys": {
391
+ "type": "Link",
392
+ "linkType": "User",
393
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
394
+ }
395
+ },
396
+ "publishedVersion": 1,
397
+ "version": 2,
398
+ "updatedAt": "2014-08-18T08:17:36.636Z",
399
+ "updatedBy": {
400
+ "sys": {
401
+ "type": "Link",
402
+ "linkType": "User",
403
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
404
+ }
405
+ }
406
+ }
407
+ },
408
+ {
409
+ "sys": {
410
+ "id": "3BERBnawlySqMgMqW6MgKw",
411
+ "type": "Entry",
412
+ "createdAt": "2014-08-18T08:16:40.050Z",
413
+ "createdBy": {
414
+ "sys": {
415
+ "type": "Link",
416
+ "linkType": "User",
417
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
418
+ }
419
+ },
420
+ "space": {
421
+ "sys": {
422
+ "type": "Link",
423
+ "linkType": "Space",
424
+ "id": "bfsvtul0c41g"
425
+ }
426
+ },
427
+ "contentType": {
428
+ "sys": {
429
+ "type": "Link",
430
+ "linkType": "ContentType",
431
+ "id": "category_content_type"
432
+ }
433
+ },
434
+ "firstPublishedAt": "2014-08-18T08:16:50.130Z",
435
+ "publishedCounter": 1,
436
+ "publishedAt": "2014-08-18T08:16:50.130Z",
437
+ "publishedBy": {
438
+ "sys": {
439
+ "type": "Link",
440
+ "linkType": "User",
441
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
442
+ }
443
+ },
444
+ "publishedVersion": 7,
445
+ "version": 8,
446
+ "updatedAt": "2014-08-18T08:16:50.134Z",
447
+ "updatedBy": {
448
+ "sys": {
449
+ "type": "Link",
450
+ "linkType": "User",
451
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
452
+ }
453
+ }
454
+ },
455
+ "fields": {
456
+ "name": {
457
+ "en-US": "SF"
458
+ },
459
+ "description": {
460
+ "en-US": "sf"
461
+ }
462
+ }
463
+ }
464
+ ]
465
+ }
466
+ http_version:
467
+ recorded_at: Mon, 18 Aug 2014 10:36:08 GMT
468
+ recorded_with: VCR 2.9.2