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
@@ -2,13 +2,13 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.contentful.com/spaces/yr5m0jky5hsh/entries
5
+ uri: https://api.contentful.com/spaces/bfsvtul0c41g/entries
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
10
  User-Agent:
11
- - RubyContenfulManagementGem/0.0.1
11
+ - RubyContenfulManagementGem/0.0.2
12
12
  Authorization:
13
13
  - Bearer <ACCESS_TOKEN>
14
14
  Content-Type:
@@ -25,19 +25,19 @@ http_interactions:
25
25
  Server:
26
26
  - nginx
27
27
  Date:
28
- - Wed, 30 Jul 2014 12:43:09 GMT
28
+ - Mon, 18 Aug 2014 09:54:31 GMT
29
29
  Content-Type:
30
30
  - application/vnd.contentful.management.v1+json
31
31
  Content-Length:
32
- - '1841'
32
+ - '7181'
33
33
  Connection:
34
34
  - keep-alive
35
35
  X-Powered-By:
36
36
  - Express
37
37
  Cf-Space-Id:
38
- - yr5m0jky5hsh
38
+ - bfsvtul0c41g
39
39
  Etag:
40
- - '"529f9332be4d7910137275d2963c7a15"'
40
+ - '"503824fb8a9e484c62bdfe7c3e43434c"'
41
41
  Access-Control-Allow-Origin:
42
42
  - "*"
43
43
  Access-Control-Allow-Headers:
@@ -55,15 +55,123 @@ http_interactions:
55
55
  "sys": {
56
56
  "type": "Array"
57
57
  },
58
- "total": 1,
58
+ "total": 4,
59
59
  "skip": 0,
60
60
  "limit": 100,
61
61
  "items": [
62
62
  {
63
+ "fields": {
64
+ "post_title": {
65
+ "en-US": "Some title of post"
66
+ },
67
+ "post_author": {
68
+ "en-US": "Tom Dom"
69
+ },
70
+ "post_body": {
71
+ "en-US": "Letterpress sustainable authentic, disrupt semiotics actually kitsch. Direct trade Cosby sweater Austin, Pitchfork flexitarian small batch authentic roof party 8-bit YOLO literally Neutra pour-over American Apparel dreamcatcher. High Life distillery cliche YOLO, flexitarian four loko put a bird on it plaid Marfa Shoreditch seitan Echo Park bicycle rights Pinterest PBR. Drinking vinegar Banksy gastropub, stumptown occupy farm-to-table Blue Bottle tattooed Truffaut single-origin coffee iPhone locavore pug"
72
+ },
73
+ "post_title_image": {
74
+ "en-US": {
75
+ "sys": {
76
+ "type": "Link",
77
+ "linkType": "Asset",
78
+ "id": "5LCvaD9lfycy02uqkwyE8S"
79
+ }
80
+ },
81
+ "de-DE": {
82
+ "sys": {
83
+ "type": "Link",
84
+ "linkType": "Asset",
85
+ "id": "5LCvaD9lfycy02uqkwyE8S"
86
+ }
87
+ },
88
+ "pl-PL": {
89
+ "sys": {
90
+ "type": "Link",
91
+ "linkType": "Asset",
92
+ "id": "5LCvaD9lfycy02uqkwyE8S"
93
+ }
94
+ }
95
+ },
96
+ "post_second_image": {
97
+ "en-US": {
98
+ "sys": {
99
+ "type": "Link",
100
+ "linkType": "Asset",
101
+ "id": "5LCvaD9lfycy02uqkwyE8S"
102
+ }
103
+ }
104
+ },
105
+ "post_category_id": {
106
+ "en-US": {
107
+ "sys": {
108
+ "type": "Link",
109
+ "linkType": "Entry",
110
+ "id": "5zZ8SnlKNiy2yEMOaecegy"
111
+ }
112
+ }
113
+ }
114
+ },
115
+ "sys": {
116
+ "id": "2arjcjtY7ucC4AGeIOIkok",
117
+ "type": "Entry",
118
+ "createdAt": "2014-08-18T06:54:57.974Z",
119
+ "createdBy": {
120
+ "sys": {
121
+ "type": "Link",
122
+ "linkType": "User",
123
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
124
+ }
125
+ },
126
+ "space": {
127
+ "sys": {
128
+ "type": "Link",
129
+ "linkType": "Space",
130
+ "id": "bfsvtul0c41g"
131
+ }
132
+ },
133
+ "contentType": {
134
+ "sys": {
135
+ "type": "Link",
136
+ "linkType": "ContentType",
137
+ "id": "post_content_type"
138
+ }
139
+ },
140
+ "firstPublishedAt": "2014-08-18T07:06:32.551Z",
141
+ "publishedCounter": 3,
142
+ "publishedAt": "2014-08-18T07:14:47.935Z",
143
+ "publishedBy": {
144
+ "sys": {
145
+ "type": "Link",
146
+ "linkType": "User",
147
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
148
+ }
149
+ },
150
+ "publishedVersion": 9,
151
+ "version": 10,
152
+ "updatedAt": "2014-08-18T07:14:47.944Z",
153
+ "updatedBy": {
154
+ "sys": {
155
+ "type": "Link",
156
+ "linkType": "User",
157
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
158
+ }
159
+ }
160
+ }
161
+ },
162
+ {
163
+ "fields": {
164
+ "name": {
165
+ "en-US": "Sport"
166
+ },
167
+ "description": {
168
+ "en-US": "Sport category"
169
+ }
170
+ },
63
171
  "sys": {
64
- "id": "4Rouux8SoUCKwkyCq2I0E0",
172
+ "id": "5zZ8SnlKNiy2yEMOaecegy",
65
173
  "type": "Entry",
66
- "createdAt": "2014-07-30T12:37:49.078Z",
174
+ "createdAt": "2014-08-18T07:14:23.057Z",
67
175
  "createdBy": {
68
176
  "sys": {
69
177
  "type": "Link",
@@ -75,19 +183,19 @@ http_interactions:
75
183
  "sys": {
76
184
  "type": "Link",
77
185
  "linkType": "Space",
78
- "id": "yr5m0jky5hsh"
186
+ "id": "bfsvtul0c41g"
79
187
  }
80
188
  },
81
189
  "contentType": {
82
190
  "sys": {
83
191
  "type": "Link",
84
192
  "linkType": "ContentType",
85
- "id": "5DSpuKrl04eMAGQoQckeIq"
193
+ "id": "category_content_type"
86
194
  }
87
195
  },
88
- "firstPublishedAt": "2014-07-30T12:39:05.868Z",
196
+ "firstPublishedAt": "2014-08-18T08:17:36.632Z",
89
197
  "publishedCounter": 1,
90
- "publishedAt": "2014-07-30T12:39:05.868Z",
198
+ "publishedAt": "2014-08-18T08:17:36.632Z",
91
199
  "publishedBy": {
92
200
  "sys": {
93
201
  "type": "Link",
@@ -95,9 +203,57 @@ http_interactions:
95
203
  "id": "1E7acJL8I5XUXAMHQt9Grs"
96
204
  }
97
205
  },
98
- "publishedVersion": 26,
99
- "version": 27,
100
- "updatedAt": "2014-07-30T12:39:05.874Z",
206
+ "publishedVersion": 1,
207
+ "version": 2,
208
+ "updatedAt": "2014-08-18T08:17:36.636Z",
209
+ "updatedBy": {
210
+ "sys": {
211
+ "type": "Link",
212
+ "linkType": "User",
213
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
214
+ }
215
+ }
216
+ }
217
+ },
218
+ {
219
+ "sys": {
220
+ "id": "3BERBnawlySqMgMqW6MgKw",
221
+ "type": "Entry",
222
+ "createdAt": "2014-08-18T08:16:40.050Z",
223
+ "createdBy": {
224
+ "sys": {
225
+ "type": "Link",
226
+ "linkType": "User",
227
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
228
+ }
229
+ },
230
+ "space": {
231
+ "sys": {
232
+ "type": "Link",
233
+ "linkType": "Space",
234
+ "id": "bfsvtul0c41g"
235
+ }
236
+ },
237
+ "contentType": {
238
+ "sys": {
239
+ "type": "Link",
240
+ "linkType": "ContentType",
241
+ "id": "category_content_type"
242
+ }
243
+ },
244
+ "firstPublishedAt": "2014-08-18T08:16:50.130Z",
245
+ "publishedCounter": 1,
246
+ "publishedAt": "2014-08-18T08:16:50.130Z",
247
+ "publishedBy": {
248
+ "sys": {
249
+ "type": "Link",
250
+ "linkType": "User",
251
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
252
+ }
253
+ },
254
+ "publishedVersion": 7,
255
+ "version": 8,
256
+ "updatedAt": "2014-08-18T08:16:50.134Z",
101
257
  "updatedBy": {
102
258
  "sys": {
103
259
  "type": "Link",
@@ -108,32 +264,71 @@ http_interactions:
108
264
  },
109
265
  "fields": {
110
266
  "name": {
111
- "en-US": "Tom Handy"
267
+ "en-US": "SF"
112
268
  },
113
- "age": {
114
- "en-US": 39
269
+ "description": {
270
+ "en-US": "sf"
271
+ }
272
+ }
273
+ },
274
+ {
275
+ "sys": {
276
+ "id": "6lClwnQgX6UEESuIqUkc4E",
277
+ "type": "Entry",
278
+ "createdAt": "2014-08-18T09:11:00.234Z",
279
+ "createdBy": {
280
+ "sys": {
281
+ "type": "Link",
282
+ "linkType": "User",
283
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
284
+ }
115
285
  },
116
- "city": {
117
- "en-US": {
118
- "lat": 52.1464575,
119
- "lon": 21.05050319999998
120
- }
121
- },
122
- "assets": {
123
- "en-US": [
124
- {
125
- "sys": {
126
- "type": "Link",
127
- "linkType": "Asset",
128
- "id": "4k8mYw2MzS6kYG0eGq0Yi0"
129
- }
130
- }
131
- ]
286
+ "space": {
287
+ "sys": {
288
+ "type": "Link",
289
+ "linkType": "Space",
290
+ "id": "bfsvtul0c41g"
291
+ }
292
+ },
293
+ "contentType": {
294
+ "sys": {
295
+ "type": "Link",
296
+ "linkType": "ContentType",
297
+ "id": "category_content_type"
298
+ }
299
+ },
300
+ "firstPublishedAt": "2014-08-18T09:11:04.986Z",
301
+ "publishedCounter": 1,
302
+ "publishedAt": "2014-08-18T09:11:04.986Z",
303
+ "publishedBy": {
304
+ "sys": {
305
+ "type": "Link",
306
+ "linkType": "User",
307
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
308
+ }
309
+ },
310
+ "publishedVersion": 8,
311
+ "version": 9,
312
+ "updatedAt": "2014-08-18T09:11:04.989Z",
313
+ "updatedBy": {
314
+ "sys": {
315
+ "type": "Link",
316
+ "linkType": "User",
317
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
318
+ }
319
+ }
320
+ },
321
+ "fields": {
322
+ "name": {
323
+ "en-US": "sss"
324
+ },
325
+ "description": {
326
+ "en-US": "ssss"
132
327
  }
133
328
  }
134
329
  }
135
330
  ]
136
331
  }
137
332
  http_version:
138
- recorded_at: Wed, 30 Jul 2014 12:43:09 GMT
333
+ recorded_at: Mon, 18 Aug 2014 09:54:35 GMT
139
334
  recorded_with: VCR 2.9.2
@@ -2,19 +2,17 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.contentful.com/spaces/9lxkhjnp8gyx/entries?content_type=category_content_type
5
+ uri: https://api.contentful.com/spaces/bfsvtul0c41g/entries?content_type=category_content_type
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
10
  User-Agent:
11
- - RubyContenfulManagementGem/0.0.1.pre
11
+ - RubyContenfulManagementGem/0.0.2
12
12
  Authorization:
13
13
  - Bearer <ACCESS_TOKEN>
14
14
  Content-Type:
15
15
  - application/vnd.contentful.management.v1+json
16
- Content-Length:
17
- - '0'
18
16
  Host:
19
17
  - api.contentful.com
20
18
  response:
@@ -25,19 +23,19 @@ http_interactions:
25
23
  Server:
26
24
  - nginx
27
25
  Date:
28
- - Wed, 13 Aug 2014 08:30:04 GMT
26
+ - Mon, 18 Aug 2014 09:59:33 GMT
29
27
  Content-Type:
30
28
  - application/vnd.contentful.management.v1+json
31
29
  Content-Length:
32
- - '2176'
30
+ - '4212'
33
31
  Connection:
34
32
  - keep-alive
35
33
  X-Powered-By:
36
34
  - Express
37
35
  Cf-Space-Id:
38
- - 9lxkhjnp8gyx
36
+ - bfsvtul0c41g
39
37
  Etag:
40
- - '"971ee4a299e08e65093824445f32ad78"'
38
+ - '"f6ed4ced9a8e40cca410b8aa490c926c"'
41
39
  Access-Control-Allow-Origin:
42
40
  - "*"
43
41
  Access-Control-Allow-Headers:
@@ -55,7 +53,7 @@ http_interactions:
55
53
  "sys": {
56
54
  "type": "Array"
57
55
  },
58
- "total": 2,
56
+ "total": 3,
59
57
  "skip": 0,
60
58
  "limit": 100,
61
59
  "items": [
@@ -69,9 +67,9 @@ http_interactions:
69
67
  }
70
68
  },
71
69
  "sys": {
72
- "id": "1CpB2YkA5q0aMywe0wmCCQ",
70
+ "id": "5zZ8SnlKNiy2yEMOaecegy",
73
71
  "type": "Entry",
74
- "createdAt": "2014-08-13T07:08:52.842Z",
72
+ "createdAt": "2014-08-18T07:14:23.057Z",
75
73
  "createdBy": {
76
74
  "sys": {
77
75
  "type": "Link",
@@ -83,7 +81,7 @@ http_interactions:
83
81
  "sys": {
84
82
  "type": "Link",
85
83
  "linkType": "Space",
86
- "id": "9lxkhjnp8gyx"
84
+ "id": "bfsvtul0c41g"
87
85
  }
88
86
  },
89
87
  "contentType": {
@@ -93,8 +91,19 @@ http_interactions:
93
91
  "id": "category_content_type"
94
92
  }
95
93
  },
96
- "version": 1,
97
- "updatedAt": "2014-08-13T07:08:52.850Z",
94
+ "firstPublishedAt": "2014-08-18T08:17:36.632Z",
95
+ "publishedCounter": 1,
96
+ "publishedAt": "2014-08-18T08:17:36.632Z",
97
+ "publishedBy": {
98
+ "sys": {
99
+ "type": "Link",
100
+ "linkType": "User",
101
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
102
+ }
103
+ },
104
+ "publishedVersion": 1,
105
+ "version": 2,
106
+ "updatedAt": "2014-08-18T08:17:36.636Z",
98
107
  "updatedBy": {
99
108
  "sys": {
100
109
  "type": "Link",
@@ -105,18 +114,66 @@ http_interactions:
105
114
  }
106
115
  },
107
116
  {
117
+ "sys": {
118
+ "id": "3BERBnawlySqMgMqW6MgKw",
119
+ "type": "Entry",
120
+ "createdAt": "2014-08-18T08:16:40.050Z",
121
+ "createdBy": {
122
+ "sys": {
123
+ "type": "Link",
124
+ "linkType": "User",
125
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
126
+ }
127
+ },
128
+ "space": {
129
+ "sys": {
130
+ "type": "Link",
131
+ "linkType": "Space",
132
+ "id": "bfsvtul0c41g"
133
+ }
134
+ },
135
+ "contentType": {
136
+ "sys": {
137
+ "type": "Link",
138
+ "linkType": "ContentType",
139
+ "id": "category_content_type"
140
+ }
141
+ },
142
+ "firstPublishedAt": "2014-08-18T08:16:50.130Z",
143
+ "publishedCounter": 1,
144
+ "publishedAt": "2014-08-18T08:16:50.130Z",
145
+ "publishedBy": {
146
+ "sys": {
147
+ "type": "Link",
148
+ "linkType": "User",
149
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
150
+ }
151
+ },
152
+ "publishedVersion": 7,
153
+ "version": 8,
154
+ "updatedAt": "2014-08-18T08:16:50.134Z",
155
+ "updatedBy": {
156
+ "sys": {
157
+ "type": "Link",
158
+ "linkType": "User",
159
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
160
+ }
161
+ }
162
+ },
108
163
  "fields": {
109
164
  "name": {
110
- "en-US": "Categoru"
165
+ "en-US": "SF"
111
166
  },
112
167
  "description": {
113
- "en-US": "asdasd"
168
+ "en-US": "sf"
114
169
  }
115
- },
170
+ }
171
+ },
172
+ {
116
173
  "sys": {
117
- "id": "3B7dW2mpO8SqOGaUs8kGCq",
174
+ "id": "6lClwnQgX6UEESuIqUkc4E",
118
175
  "type": "Entry",
119
- "createdAt": "2014-08-13T07:34:34.456Z",
176
+ "createdAt": "2014-08-18T09:11:00.234Z",
120
177
  "createdBy": {
121
178
  "sys": {
122
179
  "type": "Link",
@@ -128,7 +185,7 @@ http_interactions:
128
185
  "sys": {
129
186
  "type": "Link",
130
187
  "linkType": "Space",
131
- "id": "9lxkhjnp8gyx"
188
+ "id": "bfsvtul0c41g"
132
189
  }
133
190
  },
134
191
  "contentType": {
@@ -138,8 +195,19 @@ http_interactions:
138
195
  "id": "category_content_type"
139
196
  }
140
197
  },
141
- "version": 1,
142
- "updatedAt": "2014-08-13T07:34:34.459Z",
198
+ "firstPublishedAt": "2014-08-18T09:11:04.986Z",
199
+ "publishedCounter": 1,
200
+ "publishedAt": "2014-08-18T09:11:04.986Z",
201
+ "publishedBy": {
202
+ "sys": {
203
+ "type": "Link",
204
+ "linkType": "User",
205
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
206
+ }
207
+ },
208
+ "publishedVersion": 8,
209
+ "version": 9,
210
+ "updatedAt": "2014-08-18T09:11:04.989Z",
143
211
  "updatedBy": {
144
212
  "sys": {
145
213
  "type": "Link",
@@ -147,10 +215,18 @@ http_interactions:
147
215
  "id": "1E7acJL8I5XUXAMHQt9Grs"
148
216
  }
149
217
  }
218
+ },
219
+ "fields": {
220
+ "name": {
221
+ "en-US": "sss"
222
+ },
223
+ "description": {
224
+ "en-US": "ssss"
225
+ }
150
226
  }
151
227
  }
152
228
  ]
153
229
  }
154
230
  http_version:
155
- recorded_at: Wed, 13 Aug 2014 08:30:05 GMT
231
+ recorded_at: Mon, 18 Aug 2014 09:59:36 GMT
156
232
  recorded_with: VCR 2.9.2