contentful-management 1.6.0 → 1.7.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/.rubocop_todo.yml +3 -3
  4. data/.travis.yml +4 -3
  5. data/CHANGELOG.md +5 -0
  6. data/Gemfile +0 -8
  7. data/Guardfile +3 -54
  8. data/README.md +45 -0
  9. data/Rakefile +0 -5
  10. data/contentful-management.gemspec +8 -5
  11. data/lib/contentful/management/client.rb +44 -14
  12. data/lib/contentful/management/client_upload_methods_factory.rb +19 -0
  13. data/lib/contentful/management/content_type.rb +19 -19
  14. data/lib/contentful/management/dynamic_entry.rb +1 -1
  15. data/lib/contentful/management/entry.rb +57 -50
  16. data/lib/contentful/management/http_client.rb +7 -1
  17. data/lib/contentful/management/request.rb +14 -9
  18. data/lib/contentful/management/resource.rb +7 -7
  19. data/lib/contentful/management/resource/array_like.rb +2 -2
  20. data/lib/contentful/management/resource/system_properties.rb +2 -1
  21. data/lib/contentful/management/resource_builder.rb +6 -3
  22. data/lib/contentful/management/resource_requester.rb +3 -3
  23. data/lib/contentful/management/support.rb +1 -1
  24. data/lib/contentful/management/upload.rb +42 -0
  25. data/lib/contentful/management/version.rb +1 -1
  26. data/spec/fixtures/pixel.jpg +0 -0
  27. data/spec/fixtures/vcr_cassettes/upload/associate_with_asset.yml +426 -0
  28. data/spec/fixtures/vcr_cassettes/upload/create_file.yml +85 -0
  29. data/spec/fixtures/vcr_cassettes/upload/create_path.yml +85 -0
  30. data/spec/fixtures/vcr_cassettes/upload/destroy.yml +133 -0
  31. data/spec/fixtures/vcr_cassettes/upload/find.yml +82 -0
  32. data/spec/fixtures/vcr_cassettes/upload/find_not_found.yml +66 -0
  33. data/spec/lib/contentful/management/client_spec.rb +25 -0
  34. data/spec/lib/contentful/management/upload_spec.rb +92 -0
  35. data/spec/spec_helper.rb +9 -1
  36. metadata +91 -11
@@ -16,7 +16,7 @@ module Contentful
16
16
  'Boolean' => :boolean,
17
17
  'Date' => :date,
18
18
  'Location' => Location
19
- }
19
+ }.freeze
20
20
 
21
21
  # @private
22
22
  def self.define_singleton_properties(entry_class, content_type, client)
@@ -67,6 +67,63 @@ module Contentful
67
67
  { content_type_id: content_type_id }
68
68
  end
69
69
 
70
+ # @private
71
+ def self.parse_attribute_with_field(attribute, field)
72
+ case field.type
73
+ when ContentType::LINK then
74
+ { sys: { type: field.type, linkType: field.link_type, id: attribute.id } } if attribute
75
+ when ContentType::ARRAY then
76
+ parse_fields_array(attribute)
77
+ when ContentType::LOCATION then
78
+ { lat: attribute.properties[:lat], lon: attribute.properties[:lon] } if attribute
79
+ else
80
+ attribute
81
+ end
82
+ end
83
+
84
+ # @private
85
+ def self.hash_with_link_object(type, attribute)
86
+ { sys: { type: 'Link', linkType: type, id: attribute.id } }
87
+ end
88
+
89
+ # @private
90
+ def self.parse_fields_array(attributes)
91
+ type = attributes.first.class
92
+ type == String ? attributes : parse_objects_array(attributes)
93
+ end
94
+
95
+ # @private
96
+ def self.parse_objects_array(attributes)
97
+ attributes.each_with_object([]) do |attr, arr|
98
+ if attr.is_a? Entry
99
+ arr << hash_with_link_object('Entry', attr)
100
+ elsif attr.is_a? Asset
101
+ arr << hash_with_link_object('Asset', attr)
102
+ elsif attr.is_a? Hash
103
+ arr << attr
104
+ elsif attr.class.ancestors.map(&:to_s).include?('Contentful::Entry')
105
+ arr << hash_with_link_object('Entry', attr)
106
+ elsif attr.class.ancestors.map(&:to_s).include?('Contentful::Asset')
107
+ arr << hash_with_link_object('Asset', attr)
108
+ end
109
+ end
110
+ end
111
+
112
+ # Gets Hash of fields for all locales, with locales at a field level
113
+ #
114
+ # @return [Hash] fields by locale
115
+ def self.fields_with_locale(content_type, attributes)
116
+ locale = attributes[:locale] || content_type.sys[:space].default_locale
117
+ fields = content_type.properties[:fields]
118
+ field_names = fields.map { |field| field.id.to_sym }
119
+ attributes.keep_if { |key| field_names.include?(key) }
120
+
121
+ attributes.each do |id, value|
122
+ field = fields.detect { |f| f.id.to_sym == id.to_sym }
123
+ attributes[id] = { locale => parse_attribute_with_field(value, field) }
124
+ end
125
+ end
126
+
70
127
  # @private
71
128
  def after_create(attributes)
72
129
  self.locale = attributes[:locale] || client.default_locale
@@ -157,19 +214,6 @@ module Contentful
157
214
 
158
215
  private
159
216
 
160
- def self.parse_attribute_with_field(attribute, field)
161
- case field.type
162
- when ContentType::LINK then
163
- { sys: { type: field.type, linkType: field.link_type, id: attribute.id } } if attribute
164
- when ContentType::ARRAY then
165
- parse_fields_array(attribute)
166
- when ContentType::LOCATION then
167
- { lat: attribute.properties[:lat], lon: attribute.properties[:lon] } if attribute
168
- else
169
- attribute
170
- end
171
- end
172
-
173
217
  def parse_update_attribute(attribute)
174
218
  case attribute
175
219
  when Asset
@@ -206,43 +250,6 @@ module Contentful
206
250
  space_id = space.is_a?(::Contentful::Management::Resource) ? space.id : space['sys']['id']
207
251
  @content_type ||= ::Contentful::Management::ContentType.find(client, space_id, content_type_id)
208
252
  end
209
-
210
- def self.hash_with_link_object(type, attribute)
211
- { sys: { type: 'Link', linkType: type, id: attribute.id } }
212
- end
213
-
214
- def self.parse_fields_array(attributes)
215
- type = attributes.first.class
216
- type == String ? attributes : parse_objects_array(attributes)
217
- end
218
-
219
- def self.parse_objects_array(attributes)
220
- attributes.each_with_object([]) do |attr, arr|
221
- if attr.is_a? Entry
222
- arr << hash_with_link_object('Entry', attr)
223
- elsif attr.is_a? Asset
224
- arr << hash_with_link_object('Asset', attr)
225
- elsif attr.is_a? Hash
226
- arr << attr
227
- elsif attr.class.ancestors.map(&:to_s).include?('Contentful::Entry')
228
- arr << hash_with_link_object('Entry', attr)
229
- elsif attr.class.ancestors.map(&:to_s).include?('Contentful::Asset')
230
- arr << hash_with_link_object('Asset', attr)
231
- end
232
- end
233
- end
234
-
235
- def self.fields_with_locale(content_type, attributes)
236
- locale = attributes[:locale] || content_type.sys[:space].default_locale
237
- fields = content_type.properties[:fields]
238
- field_names = fields.map { |field| field.id.to_sym }
239
- attributes.keep_if { |key| field_names.include?(key) }
240
-
241
- attributes.each do |id, value|
242
- field = fields.detect { |f| f.id.to_sym == id.to_sym }
243
- attributes[id] = { locale => parse_attribute_with_field(value, field) }
244
- end
245
- end
246
253
  end
247
254
  end
248
255
  end
@@ -21,7 +21,13 @@ module Contentful
21
21
  #
22
22
  # @return [HTTP::Response]
23
23
  def post_http(url, params, headers = {}, proxy = {})
24
- http_send(:post, url, { json: params }, headers, proxy)
24
+ data = if url.include?(Client::DEFAULT_CONFIGURATION[:uploads_url])
25
+ { body: params }
26
+ else
27
+ { json: params }
28
+ end
29
+
30
+ http_send(:post, url, data, headers, proxy)
25
31
  end
26
32
 
27
33
  # Delete Request
@@ -4,19 +4,24 @@ module Contentful
4
4
  # with domain specific logic. The client later uses the Request's #url and #query methods
5
5
  # to execute the HTTP request.
6
6
  class Request
7
- attr_reader :client, :type, :query, :id, :endpoint
7
+ attr_reader :client, :type, :query, :id, :endpoint, :headers
8
8
 
9
- def initialize(client, endpoint, query = {}, id = nil, header = {})
10
- @header = header
9
+ def initialize(client, endpoint, query = {}, id = nil, headers = {})
10
+ @headers = headers
11
11
  @initial_id = id
12
12
  @client = client
13
- @client.version = header[:version]
14
- @client.organization_id = header[:organization_id]
15
- @client.content_type_id = header[:content_type_id]
16
- @client.zero_length = query.empty?
13
+ @client.version = headers[:version]
14
+ @client.organization_id = headers[:organization_id]
15
+ @client.content_type_id = headers[:content_type_id]
17
16
  @endpoint = endpoint
18
17
 
19
- @query = normalize_query(query) if query && !query.empty?
18
+ case query
19
+ when Hash
20
+ @client.zero_length = query.empty?
21
+ @query = normalize_query(query) if query && !query.empty?
22
+ else
23
+ @query = query
24
+ end
20
25
 
21
26
  if id
22
27
  @type = :single
@@ -60,7 +65,7 @@ module Contentful
60
65
 
61
66
  # Returns a new Request object with the same data
62
67
  def copy
63
- self.class.new(@client, @endpoint, @query, @initial_id, @header)
68
+ self.class.new(@client, @endpoint, @query, @initial_id, @headers)
64
69
  end
65
70
 
66
71
  private
@@ -24,7 +24,7 @@ module Contentful
24
24
  float: ->(value) { value.to_f },
25
25
  boolean: ->(value) { !!value },
26
26
  date: ->(value) { !value.nil? ? DateTime.parse(value) : nil }
27
- }
27
+ }.freeze
28
28
  # rubocop:enable Style/DoubleNegation
29
29
 
30
30
  attr_reader :properties, :request, :default_locale, :raw_object
@@ -46,6 +46,11 @@ module Contentful
46
46
  @raw_object = object
47
47
  end
48
48
 
49
+ # @private
50
+ def self.included(base)
51
+ base.extend(ClassMethods)
52
+ end
53
+
49
54
  # @private
50
55
  def after_create(_attributes)
51
56
  end
@@ -200,7 +205,7 @@ module Contentful
200
205
  # @return [Contentful::Management::Resource]
201
206
  def create(client, space_id, attributes)
202
207
  endpoint_options = { space_id: space_id }
203
- endpoint_options[:resource_id] = attributes[:id] if attributes.key?(:id)
208
+ endpoint_options[:resource_id] = attributes[:id] if attributes.respond_to?(:key) && attributes.key?(:id)
204
209
  ResourceRequester.new(client, self).create(
205
210
  endpoint_options,
206
211
  attributes
@@ -273,11 +278,6 @@ module Contentful
273
278
  @coercions_updated = true
274
279
  end
275
280
  end
276
-
277
- # @private
278
- def self.included(base)
279
- base.extend(ClassMethods)
280
- end
281
281
  end
282
282
  end
283
283
  end
@@ -16,7 +16,7 @@ module Contentful
16
16
  items.each(&block)
17
17
  end
18
18
 
19
- alias_method :each, :each_item
19
+ alias each each_item
20
20
 
21
21
  # Delegates to items#empty?
22
22
  def empty?
@@ -28,7 +28,7 @@ module Contentful
28
28
  items.size
29
29
  end
30
30
 
31
- alias_method :length, :size
31
+ alias length size
32
32
  end
33
33
  end
34
34
  end
@@ -15,7 +15,8 @@ module Contentful
15
15
  createdAt: :date,
16
16
  updatedAt: :date,
17
17
  locale: :string
18
- }
18
+ }.freeze
19
+
19
20
  attr_reader :sys
20
21
 
21
22
  # @private
@@ -13,6 +13,7 @@ require_relative 'locale'
13
13
  require_relative 'role'
14
14
  require_relative 'editor_interface'
15
15
  require_relative 'snapshot'
16
+ require_relative 'upload'
16
17
 
17
18
  module Contentful
18
19
  module Management
@@ -33,11 +34,13 @@ module Contentful
33
34
  'Locale' => Contentful::Management::Locale,
34
35
  'Role' => Contentful::Management::Role,
35
36
  'EditorInterface' => Contentful::Management::EditorInterface,
36
- 'Snapshot' => Contentful::Management::Snapshot
37
- }
37
+ 'Snapshot' => Contentful::Management::Snapshot,
38
+ 'Upload' => Contentful::Management::Upload
39
+ }.freeze
40
+
38
41
  # Default Entry Mapping
39
42
  # @see _ README for more information on Entry Mapping
40
- DEFAULT_ENTRY_MAPPING = {}
43
+ DEFAULT_ENTRY_MAPPING = {}.freeze
41
44
 
42
45
  attr_reader :client, :response, :resource_mapping, :entry_mapping, :resource
43
46
 
@@ -20,7 +20,7 @@ module Contentful
20
20
  end
21
21
 
22
22
  def create(endpoint_options = {}, attributes = {})
23
- custom_id = attributes[:id]
23
+ custom_id = attributes.is_a?(Hash) ? attributes[:id] : nil
24
24
  request = Request.new(
25
25
  client,
26
26
  resource_class.build_endpoint(endpoint_options),
@@ -45,12 +45,12 @@ module Contentful
45
45
  def archive(object, endpoint_options = {}, headers = {})
46
46
  update(object, endpoint_options, {}, headers)
47
47
  end
48
- alias_method :publish, :archive
48
+ alias publish archive
49
49
 
50
50
  def unarchive(object, endpoint_options = {}, headers = {})
51
51
  object.refresh_data(delete(endpoint_options, {}, headers))
52
52
  end
53
- alias_method :unpublish, :unarchive
53
+ alias unpublish unarchive
54
54
 
55
55
  private
56
56
 
@@ -5,7 +5,7 @@ module Contentful
5
5
  class << self
6
6
  # Transforms CamelCase into snake_case (taken from zucker)
7
7
  def snakify(object)
8
- snake = String(object).gsub(/(?<!^)[A-Z]/) { "_#$&" }
8
+ snake = String(object).gsub(/(?<!^)[A-Z]/) { "_#{$&}" }
9
9
  snake.downcase
10
10
  end
11
11
 
@@ -0,0 +1,42 @@
1
+ require_relative 'resource'
2
+
3
+ module Contentful
4
+ module Management
5
+ # Resource class for Upload.
6
+ # @see _ https://www.contentful.com/developers/docs/references/content-management-api/#/reference/uploads
7
+ class Upload
8
+ include Contentful::Management::Resource
9
+ include Contentful::Management::Resource::SystemProperties
10
+ include Contentful::Management::Resource::Refresher
11
+
12
+ # @private
13
+ def self.create_headers(_client, _attributes)
14
+ { 'Content-Type' => 'application/octet-stream' }
15
+ end
16
+
17
+ # @private
18
+ def self.create_attributes(_client, path_or_file)
19
+ case path_or_file
20
+ when ::String
21
+ ::File.binread(path_or_file)
22
+ when ::IO
23
+ path_or_file.read
24
+ end
25
+ end
26
+
27
+ # Gets [Contentful::Management::Link]-like representation of the upload
28
+ # This is used in particular for associating the upload with an asset
29
+ #
30
+ # @return [Hash] link-like representation of the upload
31
+ def to_link_json
32
+ {
33
+ sys: {
34
+ type: 'Link',
35
+ linkType: 'Upload',
36
+ id: id
37
+ }
38
+ }
39
+ end
40
+ end
41
+ end
42
+ end
@@ -3,6 +3,6 @@ module Contentful
3
3
  # Management Namespace
4
4
  module Management
5
5
  # Gem Version
6
- VERSION = '1.6.0'
6
+ VERSION = '1.7.0'.freeze
7
7
  end
8
8
  end
Binary file
@@ -0,0 +1,426 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://upload.contentful.com/spaces/facgnwwgj5fe/uploads
6
+ body:
7
+ encoding: ASCII-8BIT
8
+ string: !binary |-
9
+ /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAP//////////////////////////
10
+ ////////////////////////////////////////////////////////////
11
+ 2wBDAf//////////////////////////////////////////////////////
12
+ ////////////////////////////////wAARCAABAAEDASIAAhEBAxEB/8QA
13
+ FQABAQAAAAAAAAAAAAAAAAAAAAP/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QA
14
+ FAEBAAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAM
15
+ AwEAAhEDEQA/AJgA/9k=
16
+ headers:
17
+ User-Agent:
18
+ - RubyContentfulManagementGem/1.6.0
19
+ Authorization:
20
+ - Bearer <ACCESS_TOKEN>
21
+ Content-Type:
22
+ - application/octet-stream
23
+ Connection:
24
+ - close
25
+ Host:
26
+ - upload.contentful.com
27
+ response:
28
+ status:
29
+ code: 201
30
+ message: Created
31
+ headers:
32
+ Access-Control-Allow-Headers:
33
+ - 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,X-Contentful-Skip-Transformation,X-Contentful-User-Agent
34
+ Access-Control-Allow-Origin:
35
+ - "*"
36
+ Access-Control-Expose-Headers:
37
+ - Etag
38
+ Cache-Control:
39
+ - no-cache
40
+ Content-Type:
41
+ - application/vnd.contentful.management.v1+json
42
+ Date:
43
+ - Tue, 25 Apr 2017 14:00:57 GMT
44
+ Server:
45
+ - Contentful
46
+ Strict-Transport-Security:
47
+ - max-age=15768000
48
+ Vary:
49
+ - accept-encoding
50
+ X-Content-Type-Options:
51
+ - nosniff
52
+ X-Contentful-Request-Id:
53
+ - 7a9da6d7a0114f836ad5ea6a6f42e6ca
54
+ Content-Length:
55
+ - '432'
56
+ Connection:
57
+ - Close
58
+ body:
59
+ encoding: ASCII-8BIT
60
+ string: |-
61
+ {
62
+ "sys": {
63
+ "id": "3oMzfmxT3R1OKI3KMSIN5D",
64
+ "type": "Upload",
65
+ "createdAt": "2017-04-25T14:00:58.000Z",
66
+ "expiresAt": "2017-04-27T00:00:00.000Z",
67
+ "space": {
68
+ "sys": {
69
+ "type": "Link",
70
+ "linkType": "Space",
71
+ "id": "facgnwwgj5fe"
72
+ }
73
+ },
74
+ "createdBy": {
75
+ "sys": {
76
+ "type": "Link",
77
+ "linkType": "User",
78
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
79
+ }
80
+ }
81
+ }
82
+ }
83
+ http_version:
84
+ recorded_at: Tue, 25 Apr 2017 14:00:57 GMT
85
+ - request:
86
+ method: post
87
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/assets
88
+ body:
89
+ encoding: UTF-8
90
+ string: '{"fields":{"title":{"en-US":"pixel"},"description":{"en-US":null},"file":{"en-US":{"contentType":"image/jpeg","fileName":"pixel","uploadFrom":{"sys":{"type":"Link","linkType":"Upload","id":"3oMzfmxT3R1OKI3KMSIN5D"}}}}}}'
91
+ headers:
92
+ User-Agent:
93
+ - RubyContentfulManagementGem/1.6.0
94
+ Authorization:
95
+ - Bearer <ACCESS_TOKEN>
96
+ Content-Type:
97
+ - application/vnd.contentful.management.v1+json
98
+ Connection:
99
+ - close
100
+ Host:
101
+ - api.contentful.com
102
+ response:
103
+ status:
104
+ code: 201
105
+ message: Created
106
+ headers:
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,X-Contentful-Skip-Transformation,X-Contentful-User-Agent
109
+ Access-Control-Allow-Methods:
110
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
111
+ Access-Control-Allow-Origin:
112
+ - "*"
113
+ Access-Control-Expose-Headers:
114
+ - Etag
115
+ Access-Control-Max-Age:
116
+ - '1728000'
117
+ Cf-Space-Id:
118
+ - facgnwwgj5fe
119
+ Content-Type:
120
+ - application/vnd.contentful.management.v1+json
121
+ Date:
122
+ - Tue, 25 Apr 2017 14:01:02 GMT
123
+ Etag:
124
+ - '"9aa7cc68e3bab1cfeda37504d38023f2"'
125
+ Server:
126
+ - Contentful
127
+ Strict-Transport-Security:
128
+ - max-age=15768000
129
+ X-Content-Type-Options:
130
+ - nosniff
131
+ X-Contentful-Ratelimit-Hour-Limit:
132
+ - '36000'
133
+ X-Contentful-Ratelimit-Hour-Remaining:
134
+ - '35999'
135
+ X-Contentful-Ratelimit-Reset:
136
+ - '0'
137
+ X-Contentful-Ratelimit-Second-Limit:
138
+ - '10'
139
+ X-Contentful-Ratelimit-Second-Remaining:
140
+ - '9'
141
+ X-Contentful-Request-Id:
142
+ - 8fc219f93ffd89c116cd2528d63315dc
143
+ Content-Length:
144
+ - '983'
145
+ Connection:
146
+ - Close
147
+ Set-Cookie:
148
+ - incap_ses_297_673446=JrtSDbyADRBMs0jlhigfBJ1W/1gAAAAAdp6lvIsIuu+jW2byqp5+AQ==;
149
+ path=/; Domain=.contentful.com
150
+ - nlbi_673446=DW+4CsbJUH3LzlxJ6lKYhQAAAADdhofIdmtWHVGF/jR25CH6; path=/; Domain=.contentful.com
151
+ - visid_incap_673446=+0pTn3jqQjupXMU7xmeyd5lW/1gAAAAAQUIPAAAAAAD2nBAMdXIN27g0uLb21k7M;
152
+ expires=Wed, 25 Apr 2018 07:17:51 GMT; path=/; Domain=.contentful.com
153
+ X-Iinfo:
154
+ - 10-87770413-87770455 NNNN CT(143 138 0) RT(1493128857761 156) q(0 0 3 4) r(40
155
+ 40) U5
156
+ X-Cdn:
157
+ - Incapsula
158
+ body:
159
+ encoding: ASCII-8BIT
160
+ string: |
161
+ {
162
+ "fields": {
163
+ "title": {
164
+ "en-US": "pixel"
165
+ },
166
+ "description": {
167
+ "en-US": null
168
+ },
169
+ "file": {
170
+ "en-US": {
171
+ "contentType": "image/jpeg",
172
+ "fileName": "pixel",
173
+ "uploadFrom": {
174
+ "sys": {
175
+ "type": "Link",
176
+ "linkType": "Upload",
177
+ "id": "3oMzfmxT3R1OKI3KMSIN5D"
178
+ }
179
+ }
180
+ }
181
+ }
182
+ },
183
+ "sys": {
184
+ "id": "3d7PVhU4w8kEWSy0WMCwoC",
185
+ "type": "Asset",
186
+ "version": 1,
187
+ "createdAt": "2017-04-25T14:01:02.079Z",
188
+ "createdBy": {
189
+ "sys": {
190
+ "type": "Link",
191
+ "linkType": "User",
192
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
193
+ }
194
+ },
195
+ "space": {
196
+ "sys": {
197
+ "type": "Link",
198
+ "linkType": "Space",
199
+ "id": "facgnwwgj5fe"
200
+ }
201
+ },
202
+ "updatedAt": "2017-04-25T14:01:02.079Z",
203
+ "updatedBy": {
204
+ "sys": {
205
+ "type": "Link",
206
+ "linkType": "User",
207
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
208
+ }
209
+ }
210
+ }
211
+ }
212
+ http_version:
213
+ recorded_at: Tue, 25 Apr 2017 14:01:02 GMT
214
+ - request:
215
+ method: put
216
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/assets/3d7PVhU4w8kEWSy0WMCwoC/files/en-US/process
217
+ body:
218
+ encoding: US-ASCII
219
+ string: ''
220
+ headers:
221
+ User-Agent:
222
+ - RubyContentfulManagementGem/1.6.0
223
+ Authorization:
224
+ - Bearer <ACCESS_TOKEN>
225
+ Content-Type:
226
+ - application/vnd.contentful.management.v1+json
227
+ X-Contentful-Version:
228
+ - '1'
229
+ Content-Length:
230
+ - '0'
231
+ Version:
232
+ - '1'
233
+ Connection:
234
+ - close
235
+ Host:
236
+ - api.contentful.com
237
+ response:
238
+ status:
239
+ code: 204
240
+ message: No Content
241
+ headers:
242
+ Access-Control-Allow-Headers:
243
+ - 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,X-Contentful-Skip-Transformation,X-Contentful-User-Agent
244
+ Access-Control-Allow-Methods:
245
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
246
+ Access-Control-Allow-Origin:
247
+ - "*"
248
+ Access-Control-Expose-Headers:
249
+ - Etag
250
+ Access-Control-Max-Age:
251
+ - '1728000'
252
+ Cf-Space-Id:
253
+ - facgnwwgj5fe
254
+ Content-Type:
255
+ - application/vnd.contentful.management.v1+json
256
+ Date:
257
+ - Tue, 25 Apr 2017 14:01:02 GMT
258
+ Server:
259
+ - Contentful
260
+ Strict-Transport-Security:
261
+ - max-age=15768000
262
+ X-Content-Type-Options:
263
+ - nosniff
264
+ X-Contentful-Ratelimit-Hour-Limit:
265
+ - '36000'
266
+ X-Contentful-Ratelimit-Hour-Remaining:
267
+ - '35998'
268
+ X-Contentful-Ratelimit-Reset:
269
+ - '0'
270
+ X-Contentful-Ratelimit-Second-Limit:
271
+ - '10'
272
+ X-Contentful-Ratelimit-Second-Remaining:
273
+ - '9'
274
+ X-Contentful-Request-Id:
275
+ - ef4146e26522cbc40db4d6a8adc89585
276
+ Connection:
277
+ - Close
278
+ Set-Cookie:
279
+ - incap_ses_297_673446=7JTFbr8uJmlMs0jlhigfBJ5W/1gAAAAALmemOhmNRGYy9w7nzsvbmQ==;
280
+ path=/; Domain=.contentful.com
281
+ - nlbi_673446=YFhfcMLMd3123ATj6lKYhQAAAAA3NdaOBOgzXWlvNOeddsJm; path=/; Domain=.contentful.com
282
+ - visid_incap_673446=+0pTn3jqQjupXMU7xmeyd5lW/1gAAAAAQUIPAAAAAAD2nBAMdXIN27g0uLb21k7M;
283
+ expires=Wed, 25 Apr 2018 07:18:11 GMT; path=/; Domain=.contentful.com
284
+ X-Iinfo:
285
+ - 9-82559451-82559491 NNNN CT(139 145 0) RT(1493128862019 161) q(0 0 3 0) r(6
286
+ 6) U5
287
+ X-Cdn:
288
+ - Incapsula
289
+ body:
290
+ encoding: ASCII-8BIT
291
+ string: ''
292
+ http_version:
293
+ recorded_at: Tue, 25 Apr 2017 14:01:03 GMT
294
+ - request:
295
+ method: get
296
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/assets/3d7PVhU4w8kEWSy0WMCwoC
297
+ body:
298
+ encoding: US-ASCII
299
+ string: ''
300
+ headers:
301
+ User-Agent:
302
+ - RubyContentfulManagementGem/1.6.0
303
+ Authorization:
304
+ - Bearer <ACCESS_TOKEN>
305
+ Content-Type:
306
+ - application/vnd.contentful.management.v1+json
307
+ Content-Length:
308
+ - '0'
309
+ Connection:
310
+ - close
311
+ Host:
312
+ - api.contentful.com
313
+ response:
314
+ status:
315
+ code: 200
316
+ message: OK
317
+ headers:
318
+ Access-Control-Allow-Headers:
319
+ - 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,X-Contentful-Skip-Transformation,X-Contentful-User-Agent
320
+ Access-Control-Allow-Methods:
321
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
322
+ Access-Control-Allow-Origin:
323
+ - "*"
324
+ Access-Control-Expose-Headers:
325
+ - Etag
326
+ Access-Control-Max-Age:
327
+ - '1728000'
328
+ Cf-Space-Id:
329
+ - facgnwwgj5fe
330
+ Content-Type:
331
+ - application/vnd.contentful.management.v1+json
332
+ Date:
333
+ - Tue, 25 Apr 2017 14:01:07 GMT
334
+ Etag:
335
+ - '"6f254b1909b2b3e99c76c9645817235b"'
336
+ Server:
337
+ - Contentful
338
+ Strict-Transport-Security:
339
+ - max-age=15768000
340
+ X-Content-Type-Options:
341
+ - nosniff
342
+ X-Contentful-Ratelimit-Hour-Limit:
343
+ - '36000'
344
+ X-Contentful-Ratelimit-Hour-Remaining:
345
+ - '35997'
346
+ X-Contentful-Ratelimit-Reset:
347
+ - '0'
348
+ X-Contentful-Ratelimit-Second-Limit:
349
+ - '10'
350
+ X-Contentful-Ratelimit-Second-Remaining:
351
+ - '9'
352
+ X-Contentful-Request-Id:
353
+ - f977caf9f90b3b8f2008c1a7f3db8d00
354
+ Content-Length:
355
+ - '1065'
356
+ Connection:
357
+ - Close
358
+ Set-Cookie:
359
+ - incap_ses_297_673446=50ujVRmxDXVMs0jlhigfBKNW/1gAAAAALf27xhhufhNypRRD/nkrRg==;
360
+ path=/; Domain=.contentful.com
361
+ - nlbi_673446=ohFXDKI2CT4k5Zn26lKYhQAAAADmL1gMKerVIEnncALwbvwd; path=/; Domain=.contentful.com
362
+ - visid_incap_673446=+0pTn3jqQjupXMU7xmeyd5lW/1gAAAAAQUIPAAAAAAD2nBAMdXIN27g0uLb21k7M;
363
+ expires=Wed, 25 Apr 2018 07:18:11 GMT; path=/; Domain=.contentful.com
364
+ X-Iinfo:
365
+ - 7-71938251-71938286 NNNN CT(159 202 0) RT(1493128862887 137) q(0 0 3 4) r(42
366
+ 42) U5
367
+ X-Cdn:
368
+ - Incapsula
369
+ body:
370
+ encoding: ASCII-8BIT
371
+ string: |
372
+ {
373
+ "fields": {
374
+ "title": {
375
+ "en-US": "pixel"
376
+ },
377
+ "description": {
378
+ "en-US": null
379
+ },
380
+ "file": {
381
+ "en-US": {
382
+ "contentType": "image/jpeg",
383
+ "fileName": "pixel",
384
+ "details": {
385
+ "image": {
386
+ "width": 1,
387
+ "height": 1
388
+ },
389
+ "size": 284
390
+ },
391
+ "url": "//images.contentful.com/facgnwwgj5fe/3d7PVhU4w8kEWSy0WMCwoC/454a143d7c7ab596d0a0f2bccb8c2019/pixel"
392
+ }
393
+ }
394
+ },
395
+ "sys": {
396
+ "id": "3d7PVhU4w8kEWSy0WMCwoC",
397
+ "type": "Asset",
398
+ "createdAt": "2017-04-25T14:01:02.079Z",
399
+ "createdBy": {
400
+ "sys": {
401
+ "type": "Link",
402
+ "linkType": "User",
403
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
404
+ }
405
+ },
406
+ "space": {
407
+ "sys": {
408
+ "type": "Link",
409
+ "linkType": "Space",
410
+ "id": "facgnwwgj5fe"
411
+ }
412
+ },
413
+ "version": 2,
414
+ "updatedAt": "2017-04-25T14:01:03.198Z",
415
+ "updatedBy": {
416
+ "sys": {
417
+ "type": "Link",
418
+ "linkType": "User",
419
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
420
+ }
421
+ }
422
+ }
423
+ }
424
+ http_version:
425
+ recorded_at: Tue, 25 Apr 2017 14:01:07 GMT
426
+ recorded_with: VCR 3.0.3