contentful-management 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require_relative 'resource'
3
2
  require_relative 'locale'
4
3
  require_relative 'space_locale_methods_factory'
@@ -51,7 +50,12 @@ module Contentful
51
50
  # Takes a hash of attributes with optional organization id if client has more than one organization.
52
51
  # Returns a Contentful::Management::Space.
53
52
  def self.create(attributes)
54
- request = Request.new('', {'name' => attributes.fetch(:name)}, id = nil, organization_id: attributes[:organization_id])
53
+ request = Request.new(
54
+ '',
55
+ {'name' => attributes.fetch(:name)},
56
+ id = nil,
57
+ organization_id: attributes[:organization_id]
58
+ )
55
59
  response = request.post
56
60
  result = ResourceBuilder.new(response, {}, {})
57
61
  result.run
@@ -61,7 +65,13 @@ module Contentful
61
65
  # Takes a hash of attributes with optional organization id if client has more than one organization.
62
66
  # Returns a Contentful::Management::Space.
63
67
  def update(attributes)
64
- request = Request.new("/#{ id }", {'name' => attributes.fetch(:name)}, id = nil, version: sys[:version], organization_id: attributes[:organization_id])
68
+ request = Request.new(
69
+ "/#{ id }",
70
+ {'name' => attributes.fetch(:name)},
71
+ id = nil,
72
+ version: sys[:version],
73
+ organization_id: attributes[:organization_id]
74
+ )
65
75
  response = request.put
66
76
  result = ResourceBuilder.new(response, {}, {})
67
77
  refresh_data(result.run)
@@ -70,11 +80,11 @@ module Contentful
70
80
  # If a space is new, an object gets created in the Contentful, otherwise the existing space gets updated.
71
81
  # See README for details.
72
82
  def save
73
- if id.nil?
83
+ if id
84
+ update(name: name, organization_id: organization)
85
+ else
74
86
  new_instance = self.class.create(name: name, organization_id: organization)
75
87
  refresh_data(new_instance)
76
- else
77
- update(name: name, organization_id: organization)
78
88
  end
79
89
  end
80
90
 
@@ -5,10 +5,6 @@ module Contentful
5
5
  class SpaceWebhookMethodsFactory
6
6
  include Contentful::Management::SpaceAssociationMethodsFactory
7
7
 
8
- def create(_attributes)
9
- fail 'Not supported'
10
- end
11
-
12
8
  def new
13
9
  fail 'Not supported'
14
10
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  module Contentful
3
2
  module Management
4
3
  # Utility methods used by the contentful management gem
@@ -0,0 +1,34 @@
1
+ require_relative 'resource'
2
+
3
+ module Contentful
4
+ module Management
5
+ # A ContentType's validations schema
6
+ class Validation
7
+ include Contentful::Management::Resource
8
+
9
+ property :in, :array
10
+ property :size, :hash
11
+ property :present, :boolean
12
+ property :validations, Validation
13
+ property :regexp, :hash
14
+ property :linkContentType, :array
15
+ property :range, :hash
16
+ property :linkMimetypeGroup, :string
17
+ property :linkField, :boolean
18
+
19
+ def properties_to_hash
20
+ properties.each_with_object({}) do |(key, value), results|
21
+ results[key] = value if Field.value_exists?(value)
22
+ end
23
+ end
24
+
25
+ # Returns type of validation
26
+ def type
27
+ properties.keys.each do |type|
28
+ return type if !self.send(Support.snakify(type)).nil?
29
+ end
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -1,6 +1,5 @@
1
- # -*- encoding: utf-8 -*-
2
1
  module Contentful
3
2
  module Management
4
- VERSION = '0.2.1'
3
+ VERSION = '0.3.0'
5
4
  end
6
5
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require_relative 'resource'
3
2
 
4
3
  module Contentful
@@ -17,7 +16,10 @@ module Contentful
17
16
  # Takes an id of space and hash of parameters.
18
17
  # Returns a Contentful::Management::Array of Contentful::Management::Webhook.
19
18
  def self.all(space_id, parameters = {})
20
- request = Request.new("/#{ space_id }/webhook_definitions", parameters)
19
+ request = Request.new(
20
+ "/#{ space_id }/webhook_definitions",
21
+ parameters
22
+ )
21
23
  response = request.get
22
24
  result = ResourceBuilder.new(response, {}, {})
23
25
  result.run
@@ -37,8 +39,12 @@ module Contentful
37
39
  # Takes a space id and hash with attributes (url, httpBasicUsername, httpBasicPassword)
38
40
  # Returns a Contentful::Management::Webhook.
39
41
  def self.create(space_id, attributes)
40
- request = Request.new("/#{ space_id }/webhook_definitions/#{ attributes[:id] || ''}", endpoint_parameters(attributes))
41
- response = attributes[:id].nil? ? request.post : request.put
42
+ id = attributes[:id]
43
+ request = Request.new(
44
+ "/#{ space_id }/webhook_definitions/#{ id }",
45
+ endpoint_parameters(attributes)
46
+ )
47
+ response = id.nil? ? request.post : request.put
42
48
  ResourceBuilder.new(response, {}, {}).run
43
49
  end
44
50
 
@@ -46,7 +52,12 @@ module Contentful
46
52
  # Takes a hash with attributes.
47
53
  # Returns a Contentful::Management::Webhook.
48
54
  def update(attributes)
49
- request = Request.new("/#{ space.id }/webhook_definitions/#{ id }", self.class.endpoint_parameters(attributes), id = nil, version: sys[:version])
55
+ request = Request.new(
56
+ "/#{ space.id }/webhook_definitions/#{ id }",
57
+ self.class.endpoint_parameters(attributes),
58
+ id = nil,
59
+ version: sys[:version]
60
+ )
50
61
  response = request.put
51
62
  result = ResourceBuilder.new(response, {}, {})
52
63
  refresh_data(result.run)
@@ -66,11 +77,7 @@ module Contentful
66
77
  end
67
78
 
68
79
  def self.endpoint_parameters(attributes)
69
- parameters = {}
70
- parameters.merge!(url: attributes[:url]) if attributes[:url]
71
- parameters.merge!(httpBasicUsername: attributes[:httpBasicUsername]) if attributes[:httpBasicUsername]
72
- parameters.merge!(httpBasicPassword: attributes[:httpBasicPassword]) if attributes[:httpBasicPassword]
73
- parameters
80
+ attributes.select { |key, _value| [:httpBasicUsername, :httpBasicPassword, :url].include? key }
74
81
  end
75
82
  end
76
83
  end
@@ -0,0 +1,588 @@
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
+ - Wed, 15 Oct 2014 08:39:10 GMT
43
+ Etag:
44
+ - '"35407b8a88882fe5717a4701910f6ce7"'
45
+ Server:
46
+ - nginx
47
+ Status:
48
+ - 200 OK
49
+ X-Contentful-Request-Id:
50
+ - f1c-2117926825
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: Wed, 15 Oct 2014 08:39:10 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
+ - Wed, 15 Oct 2014 08:39:11 GMT
121
+ Etag:
122
+ - '"2b1db3abe63f59af461175d7191647c5"'
123
+ Server:
124
+ - nginx
125
+ X-Powered-By:
126
+ - Express
127
+ Content-Length:
128
+ - '4897'
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
+ "displayField": "title",
144
+ "name": "Post",
145
+ "description": "",
146
+ "fields": [
147
+ {
148
+ "id": "title",
149
+ "name": "Title",
150
+ "type": "Text",
151
+ "localized": true,
152
+ "uiid": "2sdir2f8kcg"
153
+ },
154
+ {
155
+ "id": "author",
156
+ "name": "Author",
157
+ "type": "Text",
158
+ "localized": true,
159
+ "uiid": "4x1018907pc"
160
+ },
161
+ {
162
+ "id": "body",
163
+ "name": "Body",
164
+ "type": "Text",
165
+ "localized": true,
166
+ "uiid": "4hj7cda89hc"
167
+ },
168
+ {
169
+ "id": "title_image",
170
+ "name": "Title Image",
171
+ "type": "Link",
172
+ "linkType": "Asset",
173
+ "required": true,
174
+ "localized": true,
175
+ "uiid": "4gcqrcma8lc"
176
+ },
177
+ {
178
+ "id": "second_image",
179
+ "name": "Second Image",
180
+ "type": "Link",
181
+ "linkType": "Asset",
182
+ "localized": true,
183
+ "uiid": "40440elrugw"
184
+ },
185
+ {
186
+ "id": "category",
187
+ "name": "Category",
188
+ "type": "Link",
189
+ "linkType": "Entry",
190
+ "uiid": "49vicjvqsxs",
191
+ "localized": true
192
+ }
193
+ ],
194
+ "sys": {
195
+ "id": "post_content_type",
196
+ "type": "ContentType",
197
+ "createdAt": "2014-08-21T13:32:30.401Z",
198
+ "createdBy": {
199
+ "sys": {
200
+ "type": "Link",
201
+ "linkType": "User",
202
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
203
+ }
204
+ },
205
+ "space": {
206
+ "sys": {
207
+ "type": "Link",
208
+ "linkType": "Space",
209
+ "id": "v2umtz8ths9v"
210
+ }
211
+ },
212
+ "firstPublishedAt": "2014-08-21T13:32:43.385Z",
213
+ "publishedCounter": 2,
214
+ "publishedAt": "2014-08-27T09:18:36.995Z",
215
+ "publishedBy": {
216
+ "sys": {
217
+ "type": "Link",
218
+ "linkType": "User",
219
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
220
+ }
221
+ },
222
+ "publishedVersion": 11,
223
+ "version": 12,
224
+ "updatedAt": "2014-08-27T09:18:37.003Z",
225
+ "updatedBy": {
226
+ "sys": {
227
+ "type": "Link",
228
+ "linkType": "User",
229
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
230
+ }
231
+ }
232
+ }
233
+ },
234
+ {
235
+ "fields": [
236
+ {
237
+ "name": "testowe",
238
+ "id": "testowe",
239
+ "type": "Link",
240
+ "uiid": "3q907mcb4lc",
241
+ "linkType": "Asset",
242
+ "required": true,
243
+ "localized": true,
244
+ "validations": []
245
+ }
246
+ ],
247
+ "name": "test",
248
+ "sys": {
249
+ "id": "26eLfV14SIOeQkse44q4sw",
250
+ "type": "ContentType",
251
+ "createdAt": "2014-08-22T12:57:43.618Z",
252
+ "createdBy": {
253
+ "sys": {
254
+ "type": "Link",
255
+ "linkType": "User",
256
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
257
+ }
258
+ },
259
+ "space": {
260
+ "sys": {
261
+ "type": "Link",
262
+ "linkType": "Space",
263
+ "id": "v2umtz8ths9v"
264
+ }
265
+ },
266
+ "firstPublishedAt": "2014-08-22T12:57:53.093Z",
267
+ "publishedCounter": 2,
268
+ "version": 17,
269
+ "updatedAt": "2014-10-14T13:07:06.808Z",
270
+ "updatedBy": {
271
+ "sys": {
272
+ "type": "Link",
273
+ "linkType": "User",
274
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
275
+ }
276
+ }
277
+ }
278
+ },
279
+ {
280
+ "name": "Category",
281
+ "description": "",
282
+ "fields": [
283
+ {
284
+ "id": "name",
285
+ "name": "Name",
286
+ "type": "Text",
287
+ "localized": true,
288
+ "validations": [
289
+ {
290
+ "size": {
291
+ "min": 2,
292
+ "max": 22
293
+ }
294
+ },
295
+ {
296
+ "in": [
297
+ "dom",
298
+ "chatka"
299
+ ]
300
+ }
301
+ ]
302
+ },
303
+ {
304
+ "id": "description",
305
+ "name": "Description",
306
+ "type": "Text"
307
+ }
308
+ ],
309
+ "sys": {
310
+ "id": "category_content_type",
311
+ "type": "ContentType",
312
+ "createdAt": "2014-08-21T13:32:20.955Z",
313
+ "createdBy": {
314
+ "sys": {
315
+ "type": "Link",
316
+ "linkType": "User",
317
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
318
+ }
319
+ },
320
+ "space": {
321
+ "sys": {
322
+ "type": "Link",
323
+ "linkType": "Space",
324
+ "id": "v2umtz8ths9v"
325
+ }
326
+ },
327
+ "firstPublishedAt": "2014-08-21T13:32:27.109Z",
328
+ "publishedCounter": 10,
329
+ "version": 184,
330
+ "updatedAt": "2014-10-15T08:38:22.574Z",
331
+ "updatedBy": {
332
+ "sys": {
333
+ "type": "Link",
334
+ "linkType": "User",
335
+ "id": "0fn5fOWn4WsKFyYla1gI5h"
336
+ }
337
+ }
338
+ },
339
+ "displayField": "name"
340
+ }
341
+ ]
342
+ }
343
+ http_version:
344
+ recorded_at: Wed, 15 Oct 2014 08:39:11 GMT
345
+ - request:
346
+ method: get
347
+ uri: https://api.contentful.com/spaces/v2umtz8ths9v/content_types/category_content_type
348
+ body:
349
+ encoding: US-ASCII
350
+ string: ''
351
+ headers:
352
+ User-Agent:
353
+ - RubyContenfulManagementGem/0.2.1
354
+ Authorization:
355
+ - Bearer <ACCESS_TOKEN>
356
+ Content-Type:
357
+ - application/vnd.contentful.management.v1+json
358
+ Content-Length:
359
+ - '0'
360
+ Host:
361
+ - api.contentful.com
362
+ response:
363
+ status:
364
+ code: 200
365
+ message: OK
366
+ headers:
367
+ "^access-Control-Expose-Headers":
368
+ - Etag
369
+ Access-Control-Allow-Headers:
370
+ - 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
371
+ Access-Control-Allow-Methods:
372
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
373
+ Access-Control-Allow-Origin:
374
+ - "*"
375
+ Access-Control-Max-Age:
376
+ - '1728000'
377
+ Cf-Space-Id:
378
+ - v2umtz8ths9v
379
+ Content-Type:
380
+ - application/vnd.contentful.management.v1+json
381
+ Date:
382
+ - Wed, 15 Oct 2014 08:39:12 GMT
383
+ Etag:
384
+ - '"3fb7ea2ba823f7d788e8d78aebe26ff4"'
385
+ Server:
386
+ - nginx
387
+ X-Powered-By:
388
+ - Express
389
+ Content-Length:
390
+ - '1174'
391
+ Connection:
392
+ - keep-alive
393
+ body:
394
+ encoding: UTF-8
395
+ string: |
396
+ {
397
+ "name": "Category",
398
+ "description": "",
399
+ "fields": [
400
+ {
401
+ "id": "name",
402
+ "name": "Name",
403
+ "type": "Text",
404
+ "localized": true,
405
+ "validations": [
406
+ {
407
+ "size": {
408
+ "min": 2,
409
+ "max": 22
410
+ }
411
+ },
412
+ {
413
+ "in": [
414
+ "dom",
415
+ "chatka"
416
+ ]
417
+ }
418
+ ]
419
+ },
420
+ {
421
+ "id": "description",
422
+ "name": "Description",
423
+ "type": "Text"
424
+ }
425
+ ],
426
+ "sys": {
427
+ "id": "category_content_type",
428
+ "type": "ContentType",
429
+ "createdAt": "2014-08-21T13:32:20.955Z",
430
+ "createdBy": {
431
+ "sys": {
432
+ "type": "Link",
433
+ "linkType": "User",
434
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
435
+ }
436
+ },
437
+ "space": {
438
+ "sys": {
439
+ "type": "Link",
440
+ "linkType": "Space",
441
+ "id": "v2umtz8ths9v"
442
+ }
443
+ },
444
+ "firstPublishedAt": "2014-08-21T13:32:27.109Z",
445
+ "publishedCounter": 10,
446
+ "version": 184,
447
+ "updatedAt": "2014-10-15T08:38:22.574Z",
448
+ "updatedBy": {
449
+ "sys": {
450
+ "type": "Link",
451
+ "linkType": "User",
452
+ "id": "0fn5fOWn4WsKFyYla1gI5h"
453
+ }
454
+ }
455
+ },
456
+ "displayField": "name"
457
+ }
458
+ http_version:
459
+ recorded_at: Wed, 15 Oct 2014 08:39:12 GMT
460
+ - request:
461
+ method: put
462
+ uri: https://api.contentful.com/spaces/v2umtz8ths9v/content_types/category_content_type
463
+ body:
464
+ encoding: UTF-8
465
+ string: '{"name":"Category","description":"","fields":[{"id":"name","name":"Name","type":"Text","localized":true,"validations":[{"size":{"min":2,"max":22}},{"in":["dom","chatka"]}]},{"id":"description","name":"Description","type":"Text"},{"id":"valid","name":"Valid","type":"Text","validations":[{"in":["foo","bar","baz"]}]}]}'
466
+ headers:
467
+ User-Agent:
468
+ - RubyContenfulManagementGem/0.2.1
469
+ Authorization:
470
+ - Bearer <ACCESS_TOKEN>
471
+ Content-Type:
472
+ - application/vnd.contentful.management.v1+json
473
+ X-Contentful-Version:
474
+ - '184'
475
+ Host:
476
+ - api.contentful.com
477
+ response:
478
+ status:
479
+ code: 200
480
+ message: OK
481
+ headers:
482
+ "^access-Control-Expose-Headers":
483
+ - Etag
484
+ Access-Control-Allow-Headers:
485
+ - 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
486
+ Access-Control-Allow-Methods:
487
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
488
+ Access-Control-Allow-Origin:
489
+ - "*"
490
+ Access-Control-Max-Age:
491
+ - '1728000'
492
+ Cf-Space-Id:
493
+ - v2umtz8ths9v
494
+ Content-Type:
495
+ - application/vnd.contentful.management.v1+json
496
+ Date:
497
+ - Wed, 15 Oct 2014 08:39:13 GMT
498
+ Etag:
499
+ - '"5934f75fe998406691c91949a51e7bc0"'
500
+ Server:
501
+ - nginx
502
+ X-Powered-By:
503
+ - Express
504
+ Content-Length:
505
+ - '1364'
506
+ Connection:
507
+ - keep-alive
508
+ body:
509
+ encoding: UTF-8
510
+ string: |
511
+ {
512
+ "name": "Category",
513
+ "description": "",
514
+ "fields": [
515
+ {
516
+ "id": "name",
517
+ "name": "Name",
518
+ "type": "Text",
519
+ "localized": true,
520
+ "validations": [
521
+ {
522
+ "size": {
523
+ "min": 2,
524
+ "max": 22
525
+ }
526
+ },
527
+ {
528
+ "in": [
529
+ "dom",
530
+ "chatka"
531
+ ]
532
+ }
533
+ ]
534
+ },
535
+ {
536
+ "id": "description",
537
+ "name": "Description",
538
+ "type": "Text"
539
+ },
540
+ {
541
+ "id": "valid",
542
+ "name": "Valid",
543
+ "type": "Text",
544
+ "validations": [
545
+ {
546
+ "in": [
547
+ "foo",
548
+ "bar",
549
+ "baz"
550
+ ]
551
+ }
552
+ ]
553
+ }
554
+ ],
555
+ "sys": {
556
+ "id": "category_content_type",
557
+ "type": "ContentType",
558
+ "createdAt": "2014-08-21T13:32:20.955Z",
559
+ "createdBy": {
560
+ "sys": {
561
+ "type": "Link",
562
+ "linkType": "User",
563
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
564
+ }
565
+ },
566
+ "space": {
567
+ "sys": {
568
+ "type": "Link",
569
+ "linkType": "Space",
570
+ "id": "v2umtz8ths9v"
571
+ }
572
+ },
573
+ "firstPublishedAt": "2014-08-21T13:32:27.109Z",
574
+ "publishedCounter": 10,
575
+ "version": 185,
576
+ "updatedAt": "2014-10-15T08:39:13.285Z",
577
+ "updatedBy": {
578
+ "sys": {
579
+ "type": "Link",
580
+ "linkType": "User",
581
+ "id": "1E7acJL8I5XUXAMHQt9Grs"
582
+ }
583
+ }
584
+ }
585
+ }
586
+ http_version:
587
+ recorded_at: Wed, 15 Oct 2014 08:39:13 GMT
588
+ recorded_with: VCR 2.9.2