contentful_bootstrap 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile +1 -0
  4. data/README.md +11 -6
  5. data/bin/contentful_bootstrap +6 -0
  6. data/lib/contentful/bootstrap/command_runner.rb +2 -1
  7. data/lib/contentful/bootstrap/commands/generate_json.rb +4 -3
  8. data/lib/contentful/bootstrap/commands/update_space.rb +3 -2
  9. data/lib/contentful/bootstrap/generator.rb +8 -1
  10. data/lib/contentful/bootstrap/templates/base.rb +8 -7
  11. data/lib/contentful/bootstrap/templates/blog.rb +3 -3
  12. data/lib/contentful/bootstrap/templates/catalogue.rb +14 -14
  13. data/lib/contentful/bootstrap/templates/gallery.rb +8 -8
  14. data/lib/contentful/bootstrap/templates/json_template.rb +7 -6
  15. data/lib/contentful/bootstrap/version.rb +1 -1
  16. data/spec/contentful/bootstrap/command_runner_spec.rb +3 -3
  17. data/spec/contentful/bootstrap/commands/create_space_spec.rb +13 -0
  18. data/spec/contentful/bootstrap/commands/update_space_spec.rb +27 -8
  19. data/spec/contentful/bootstrap/generator_spec.rb +13 -1
  20. data/spec/contentful/bootstrap/templates/base_spec.rb +13 -1
  21. data/spec/contentful/bootstrap/templates/json_template_spec.rb +35 -3
  22. data/spec/fixtures/json_fixtures/asset_no_transform.json +16 -0
  23. data/spec/fixtures/json_fixtures/wl1z0pal05vy_content_types_only.json +157 -0
  24. data/spec/fixtures/vcr_fixtures/asset_no_transform.yml +654 -0
  25. data/spec/fixtures/vcr_fixtures/create_space_with_blog_template.yml +1122 -730
  26. data/spec/fixtures/vcr_fixtures/create_space_with_catalogue_template.yml +2378 -2166
  27. data/spec/fixtures/vcr_fixtures/create_space_with_gallery_template.yml +1549 -928
  28. data/spec/fixtures/vcr_fixtures/generate_json_content_types_only.yml +94 -0
  29. data/spec/spec_helper.rb +5 -0
  30. metadata +11 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aed4d8f7790b4347e4b97050a049803f83ec1384
4
- data.tar.gz: 91d3a12fd648ab548711294e39e9399bbb4c6e03
3
+ metadata.gz: d4714e403b05588c84e46a5f5e66af2224eb566d
4
+ data.tar.gz: a2ef00692e18a5f7251c88b3ffdba02be6a6f39e
5
5
  SHA512:
6
- metadata.gz: a862d0a72856f0707f3ab2cd5920cef7484ea06b051cc308a6e03b45af3b60006dd86c86c4ffa23a9feaf8ed34e6811e813a24d5076bca28abe2d85e47ff2969
7
- data.tar.gz: 31596e9e9211c8ec76daff969d3a79c2ea9aa6e7901ede6ab0b4b63ab7b1b4ecb7627664db8708c3841fc21fe425b96845a96a4eab0e43d519148fc0a5574faa
6
+ metadata.gz: 79e35a1d6e63c0bc61b9e8e3eb0ad0cf8a4222c8ebaf2a010d3cf75f728304d8384b24f1ac129415d254bcfc8d5ea0e3045d243612b1dba64538be9a0dbc84dc
7
+ data.tar.gz: 03aa80d7fa3ac65ed38a27515eed71605715605de6ecf5a191d04ce9fc0e0277b8fbb6a114113029e093cad3faddf9c696515c39758d21119819d7caae2841c0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v3.3.0
6
+ ### Added
7
+ * Adds possibility to change `contentType` for Assets [#39](https://github.com/contentful/contentful-bootstrap.rb/issues/39)
8
+ * Adds `--content-types-only` option to `generate_json`
9
+ * Adds `--skip-content-types` option to `update_space`
10
+
11
+ ### Fixed
12
+ * Fixes a bug in built-in templates using obsolete `link_type` properties
13
+
5
14
  ## v3.2.0
6
15
  ### Added
7
16
  * Adds `update_space` command to update already existing spaces using JSON Templates
data/Gemfile CHANGED
@@ -7,3 +7,4 @@ gem "launchy"
7
7
  gem "inifile"
8
8
  gem "contentful-management"
9
9
  gem "contentful", "~> 0.7", ">= 0.7.3"
10
+ gem 'pry'
data/README.md CHANGED
@@ -7,7 +7,7 @@ A small CLI tool for getting started with Contentful
7
7
  ## Contentful
8
8
  [Contentful](http://www.contentful.com) is a content management platform for web applications,
9
9
  mobile apps and connected devices. It allows you to create, edit & manage content in the cloud
10
- and publish it anywhere via powerful API. Contentful offers tools for managing editorial
10
+ and publish it anywhere via a powerful API. Contentful offers tools for managing editorial
11
11
  teams and enabling cooperation between organizations.
12
12
 
13
13
  ## What does `contentful_bootstrap` do?
@@ -38,13 +38,13 @@ $ contentful_bootstrap generate_token <space_id> [--name token_name] [--config C
38
38
  You can also generate JSON Templates from existing spaces by doing:
39
39
 
40
40
  ```bash
41
- $ contentful_bootstrap generate_json <space_id> <access_token> [--output-file OUTPUT PATH]
41
+ $ contentful_bootstrap generate_json <space_id> <delivery_api_access_token> [--output-file OUTPUT PATH] [--content-types-only]
42
42
  ```
43
43
 
44
44
  You can update existing spaces from JSON Templates by doing:
45
45
 
46
46
  ```bash
47
- $ contentful_bootstrap update_space <space_id> -j template_path [--mark-processed]
47
+ $ contentful_bootstrap update_space <space_id> -j template_path [--mark-processed] [--skip-content-types]
48
48
  ```
49
49
 
50
50
  ### Built-in templates
@@ -99,7 +99,8 @@ To Update an existing Space
99
99
  options = {
100
100
  json_template: "/path/to/template.json", # Will use the JSON file specified as a Template
101
101
  mark_processed: false, # if true will mark all resources as 'bootstrapProcessed and will be avoided on future update_space calls
102
- trigger_oauth: true # if true will trigger OAuth process
102
+ trigger_oauth: true, # if true will trigger OAuth process
103
+ skip_content_types: false, # if true will avoid creating the content types
103
104
  }
104
105
  Contentful::Bootstrap::CommandRunner.new.update_space("space_id", options)
105
106
  ```
@@ -123,7 +124,11 @@ Contentful::Bootstrap::CommandRunner.new.generate_token("space_id", options)
123
124
  To Generate a JSON Template from an exising Space
124
125
 
125
126
  ```ruby
126
- Contentful::Bootstrap::CommandRunner.new.generate_json("space_id", access_token: "access_token")
127
+ Contentful::Bootstrap::CommandRunner.new.generate_json(
128
+ "space_id",
129
+ access_token: "delivery_api_access_token",
130
+ content_types_only: false # if true will not fetch Entries and Assets
131
+ )
127
132
  ```
128
133
 
129
134
  Additionally, you can send an options hash with the following keys:
@@ -156,7 +161,7 @@ CONTENTFUL_MANAGEMENT_ACCESS_TOKEN = a_management_access_token
156
161
 
157
162
  [space_name]
158
163
  SPACE_ID = some_space_id ; Space configurations are not required by this tool, but can be generated by it
159
- CONTENTFUL_DELIVERY_ACCESS_TOKEN = a_delivery_acces_token ; Delivery Access Token is not required for this tool, but can be generated by it
164
+ CONTENTFUL_DELIVERY_ACCESS_TOKEN = a_delivery_acces_token
160
165
  ```
161
166
 
162
167
  ### JSON Templates
@@ -32,6 +32,9 @@ subcommands = {
32
32
  opts.on('-m', '--mark-processed', "Mark Processed Items on JSON Templates") do |m|
33
33
  options[:mark_processed] = m
34
34
  end
35
+ opts.on('-T', '--skip-content-types', "Skip Content Types on Space update") do |t|
36
+ options[:skip_content_types] = t
37
+ end
35
38
  opts.on("-c CONFIG_PATH", "--config CONFIG_PATH", "Specify Configuration Path") do |c|
36
39
  options[:config_path] = c
37
40
  end
@@ -53,6 +56,9 @@ subcommands = {
53
56
  end,
54
57
  'generate_json' => OptionParser.new do |opts|
55
58
  opts.banner = "Usage: generate_json <space_id> <access_token> [--output-file OUTPUT_PATH]"
59
+ opts.on("-t", "--content-types-only", "Only fetch Content Types") do |t|
60
+ options[:content_types_only] = t
61
+ end
56
62
  opts.on("-o OUTPUT_PATH", "--output-file OUTPUT_PATH", "Specify Output File") do |f|
57
63
  options[:filename] = f
58
64
  end
@@ -44,11 +44,12 @@ module Contentful
44
44
  def generate_json(space_id, options = {})
45
45
  filename = options.fetch(:filename, nil)
46
46
  access_token = options.fetch(:access_token, nil)
47
+ content_types_only = options.fetch(:content_types_only, false)
47
48
 
48
49
  fail 'Access Token required' if access_token.nil?
49
50
 
50
51
  Contentful::Bootstrap::Commands::GenerateJson.new(
51
- space_id, access_token, filename
52
+ space_id, access_token, filename, content_types_only
52
53
  ).run
53
54
  end
54
55
  end
@@ -5,11 +5,12 @@ module Contentful
5
5
  module Bootstrap
6
6
  module Commands
7
7
  class GenerateJson
8
- attr_reader :space_id, :filename, :access_token
9
- def initialize(space_id, access_token, filename = nil)
8
+ attr_reader :space_id, :filename, :access_token, :content_types_only
9
+ def initialize(space_id, access_token, filename = nil, content_types_only = false)
10
10
  @space_id = space_id
11
11
  @access_token = access_token
12
12
  @filename = filename
13
+ @content_types_only = content_types_only
13
14
  end
14
15
 
15
16
  def run
@@ -21,7 +22,7 @@ module Contentful
21
22
 
22
23
  puts "Generating JSON Template '#{filename}' for Space: '#{space_id}'"
23
24
 
24
- json = Contentful::Bootstrap::Generator.new(space_id, access_token).generate_json
25
+ json = Contentful::Bootstrap::Generator.new(space_id, access_token, content_types_only).generate_json
25
26
 
26
27
  puts
27
28
  write(json)
@@ -8,10 +8,11 @@ module Contentful
8
8
  module Commands
9
9
  class UpdateSpace < Base
10
10
  attr_reader :json_template
11
- def initialize(token, space_id, json_template = nil, mark_processed = false, trigger_oauth = true)
11
+ def initialize(token, space_id, json_template = nil, mark_processed = false, trigger_oauth = true, skip_content_types = false)
12
12
  super(token, space_id, trigger_oauth)
13
13
  @json_template = json_template
14
14
  @mark_processed = mark_processed
15
+ @skip_content_types = skip_content_types
15
16
  end
16
17
 
17
18
  def run
@@ -46,7 +47,7 @@ module Contentful
46
47
  def update_json_template(space)
47
48
  if ::File.exist?(@json_template)
48
49
  puts "Updating from JSON Template '#{@json_template}'"
49
- Templates::JsonTemplate.new(space, @json_template, @mark_processed, false).run
50
+ Templates::JsonTemplate.new(space, @json_template, @mark_processed, false, @skip_content_types).run
50
51
  puts "JSON Template '#{@json_template}' updated!"
51
52
  else
52
53
  puts "JSON Template '#{@json_template}' does not exist. Please check that you specified the correct file name."
@@ -7,8 +7,11 @@ require 'contentful/bootstrap/version'
7
7
  module Contentful
8
8
  module Bootstrap
9
9
  class Generator
10
- def initialize(space_id, access_token)
10
+ attr_reader :content_types_only
11
+
12
+ def initialize(space_id, access_token, content_types_only)
11
13
  @client = Contentful::Client.new(access_token: access_token, space: space_id)
14
+ @content_types_only = content_types_only
12
15
  end
13
16
 
14
17
  def generate_json
@@ -23,6 +26,8 @@ module Contentful
23
26
  private
24
27
 
25
28
  def assets
29
+ return [] if content_types_only
30
+
26
31
  proccessed_assets = @client.assets(limit: 1000).map do |asset|
27
32
  result = { 'id' => asset.sys[:id], 'title' => asset.title }
28
33
  result['file'] = {
@@ -49,6 +54,8 @@ module Contentful
49
54
  end
50
55
 
51
56
  def entries
57
+ return {} if content_types_only
58
+
52
59
  entries = {}
53
60
 
54
61
  @client.entries(limit: 1000).each do |entry|
@@ -6,14 +6,15 @@ module Contentful
6
6
  module Bootstrap
7
7
  module Templates
8
8
  class Base
9
- attr_reader :space
9
+ attr_reader :space, :skip_content_types
10
10
 
11
- def initialize(space)
11
+ def initialize(space, skip_content_types = false)
12
12
  @space = space
13
+ @skip_content_types = skip_content_types
13
14
  end
14
15
 
15
16
  def run
16
- create_content_types
17
+ create_content_types unless skip_content_types
17
18
  create_assets
18
19
  create_entries
19
20
 
@@ -44,10 +45,10 @@ module Contentful
44
45
 
45
46
  protected
46
47
 
47
- def create_image(name, url)
48
+ def create_file(name, url, properties = {})
48
49
  image = Contentful::Management::File.new
49
- image.properties[:contentType] = 'image/jpeg'
50
- image.properties[:fileName] = "#{name}.jpg"
50
+ image.properties[:contentType] = properties.fetch(:contentType, 'image/jpeg')
51
+ image.properties[:fileName] = "#{name}"
51
52
  image.properties[:upload] = url
52
53
  image
53
54
  end
@@ -63,7 +64,7 @@ module Contentful
63
64
  content_type = space.content_types.new
64
65
  content_type.id = ct['id']
65
66
  content_type.name = ct['name']
66
- content_type.display_field = ct['display_field']
67
+ content_type.display_field = ct['displayField']
67
68
  content_type.description = ct['description']
68
69
 
69
70
  ct['fields'].each do |f|
@@ -10,7 +10,7 @@ module Contentful
10
10
  {
11
11
  'id' => 'author',
12
12
  'name' => 'Author',
13
- 'display_field' => 'name',
13
+ 'displayField' => 'name',
14
14
  'fields' => [
15
15
  {
16
16
  'id' => 'name',
@@ -22,7 +22,7 @@ module Contentful
22
22
  {
23
23
  'id' => 'post',
24
24
  'name' => 'Post',
25
- 'display_field' => 'title',
25
+ 'displayField' => 'title',
26
26
  'fields' => [
27
27
  {
28
28
  'id' => 'title',
@@ -38,7 +38,7 @@ module Contentful
38
38
  'id' => 'author',
39
39
  'name' => 'Author',
40
40
  'type' => 'Link',
41
- 'link_type' => 'Entry'
41
+ 'linkType' => 'Entry'
42
42
  }
43
43
  ]
44
44
  }
@@ -10,7 +10,7 @@ module Contentful
10
10
  {
11
11
  'id' => 'brand',
12
12
  'name' => 'Brand',
13
- 'display_field' => 'name',
13
+ 'displayField' => 'name',
14
14
  'fields' => [
15
15
  {
16
16
  'id' => 'name',
@@ -26,14 +26,14 @@ module Contentful
26
26
  'id' => 'logo',
27
27
  'name' => 'Logo',
28
28
  'type' => 'Link',
29
- 'link_type' => 'Asset'
29
+ 'linkType' => 'Asset'
30
30
  }
31
31
  ]
32
32
  },
33
33
  {
34
34
  'id' => 'category',
35
35
  'name' => 'Category',
36
- 'display_field' => 'title',
36
+ 'displayField' => 'title',
37
37
  'fields' => [
38
38
  {
39
39
  'id' => 'title',
@@ -49,14 +49,14 @@ module Contentful
49
49
  'id' => 'icon',
50
50
  'name' => 'Icon',
51
51
  'type' => 'Link',
52
- 'link_type' => 'Asset'
52
+ 'linkType' => 'Asset'
53
53
  }
54
54
  ]
55
55
  },
56
56
  {
57
57
  'id' => 'product',
58
58
  'name' => 'Product',
59
- 'display_field' => 'name',
59
+ 'displayField' => 'name',
60
60
  'fields' => [
61
61
  {
62
62
  'id' => 'name',
@@ -72,19 +72,19 @@ module Contentful
72
72
  'id' => 'image',
73
73
  'name' => 'Image',
74
74
  'type' => 'Link',
75
- 'link_type' => 'Asset'
75
+ 'linkType' => 'Asset'
76
76
  },
77
77
  {
78
78
  'id' => 'brand',
79
79
  'name' => 'Brand',
80
80
  'type' => 'Link',
81
- 'link_type' => 'Entry'
81
+ 'linkType' => 'Entry'
82
82
  },
83
83
  {
84
84
  'id' => 'category',
85
85
  'name' => 'Category',
86
86
  'type' => 'Link',
87
- 'link_type' => 'Entry'
87
+ 'linkType' => 'Entry'
88
88
  },
89
89
  {
90
90
  'id' => 'url',
@@ -101,32 +101,32 @@ module Contentful
101
101
  {
102
102
  'id' => 'playsam_image',
103
103
  'title' => 'Playsam',
104
- 'file' => create_image('playsam_image', 'https://images.contentful.com/liicpxzmg1q0/4zj1ZOfHgQ8oqgaSKm4Qo2/3be82d54d45b5297e951aee9baf920da/playsam.jpg?h=250&')
104
+ 'file' => create_file('playsam_image.jpg', 'https://images.contentful.com/liicpxzmg1q0/4zj1ZOfHgQ8oqgaSKm4Qo2/3be82d54d45b5297e951aee9baf920da/playsam.jpg?h=250&')
105
105
  },
106
106
  {
107
107
  'id' => 'normann_image',
108
108
  'title' => 'Normann',
109
- 'file' => create_image('normann_image', 'https://images.contentful.com/liicpxzmg1q0/3wtvPBbBjiMKqKKga8I2Cu/75c7c92f38f7953a741591d215ad61d4/zJYzDlGk.jpeg?h=250&')
109
+ 'file' => create_file('normann_image.jpg', 'https://images.contentful.com/liicpxzmg1q0/3wtvPBbBjiMKqKKga8I2Cu/75c7c92f38f7953a741591d215ad61d4/zJYzDlGk.jpeg?h=250&')
110
110
  },
111
111
  {
112
112
  'id' => 'toy_image',
113
113
  'title' => 'Toys',
114
- 'file' => create_image('toy_image', 'https://images.contentful.com/liicpxzmg1q0/6t4HKjytPi0mYgs240wkG/866ef53a11af9c6bf5f3808a8ce1aab2/toys_512pxGREY.png?h=250&')
114
+ 'file' => create_file('toy_image.jpg', 'https://images.contentful.com/liicpxzmg1q0/6t4HKjytPi0mYgs240wkG/866ef53a11af9c6bf5f3808a8ce1aab2/toys_512pxGREY.png?h=250&')
115
115
  },
116
116
  {
117
117
  'id' => 'kitchen_image',
118
118
  'title' => 'Kitchen and Home',
119
- 'file' => create_image('kitchen_image', 'https://images.contentful.com/liicpxzmg1q0/6m5AJ9vMPKc8OUoQeoCS4o/ffc20f5a8f2a71cca4801bc9c51b966a/1418244847_Streamline-18-256.png?h=250&')
119
+ 'file' => create_file('kitchen_image.jpg', 'https://images.contentful.com/liicpxzmg1q0/6m5AJ9vMPKc8OUoQeoCS4o/ffc20f5a8f2a71cca4801bc9c51b966a/1418244847_Streamline-18-256.png?h=250&')
120
120
  },
121
121
  {
122
122
  'id' => 'toy_car',
123
123
  'title' => 'Playsam Toy Car',
124
- 'file' => create_image('toy_car', 'https://images.contentful.com/liicpxzmg1q0/wtrHxeu3zEoEce2MokCSi/acef70d12fe019228c4238aa791bdd48/quwowooybuqbl6ntboz3.jpg?h=250&')
124
+ 'file' => create_file('toy_car.jpg', 'https://images.contentful.com/liicpxzmg1q0/wtrHxeu3zEoEce2MokCSi/acef70d12fe019228c4238aa791bdd48/quwowooybuqbl6ntboz3.jpg?h=250&')
125
125
  },
126
126
  {
127
127
  'id' => 'whiskers',
128
128
  'title' => 'Normann Whisk Beaters',
129
- 'file' => create_image('whiskers', 'https://images.contentful.com/liicpxzmg1q0/10TkaLheGeQG6qQGqWYqUI/d510dde5e575d40288cf75b42383aa53/ryugj83mqwa1asojwtwb.jpg?h=250&')
129
+ 'file' => create_file('whiskers.jpg', 'https://images.contentful.com/liicpxzmg1q0/10TkaLheGeQG6qQGqWYqUI/d510dde5e575d40288cf75b42383aa53/ryugj83mqwa1asojwtwb.jpg?h=250&')
130
130
  }
131
131
  ]
132
132
  end
@@ -10,7 +10,7 @@ module Contentful
10
10
  {
11
11
  'id' => 'author',
12
12
  'name' => 'Author',
13
- 'display_field' => 'name',
13
+ 'displayField' => 'name',
14
14
  'fields' => [
15
15
  {
16
16
  'name' => 'Name',
@@ -22,7 +22,7 @@ module Contentful
22
22
  {
23
23
  'id' => 'image',
24
24
  'name' => 'Image',
25
- 'display_field' => 'title',
25
+ 'displayField' => 'title',
26
26
  'fields' => [
27
27
  {
28
28
  'id' => 'title',
@@ -33,14 +33,14 @@ module Contentful
33
33
  'id' => 'photo',
34
34
  'name' => 'Photo',
35
35
  'type' => 'Link',
36
- 'link_type' => 'Asset'
36
+ 'linkType' => 'Asset'
37
37
  }
38
38
  ]
39
39
  },
40
40
  {
41
41
  'id' => 'gallery',
42
42
  'name' => 'Gallery',
43
- 'display_field' => 'title',
43
+ 'displayField' => 'title',
44
44
  'fields' => [
45
45
  {
46
46
  'id' => 'title',
@@ -51,7 +51,7 @@ module Contentful
51
51
  'id' => 'author',
52
52
  'name' => 'Author',
53
53
  'type' => 'Link',
54
- 'link_type' => 'Entry'
54
+ 'linkType' => 'Entry'
55
55
  },
56
56
  {
57
57
  'id' => 'images',
@@ -59,7 +59,7 @@ module Contentful
59
59
  'type' => 'Array',
60
60
  'items' => {
61
61
  'type' => 'Link',
62
- 'link_type' => 'Entry'
62
+ 'linkType' => 'Entry'
63
63
  }
64
64
  }
65
65
  ]
@@ -72,12 +72,12 @@ module Contentful
72
72
  {
73
73
  'id' => 'pie',
74
74
  'title' => 'Pie in the Sky',
75
- 'file' => create_image('pie', 'https://c2.staticflickr.com/6/5245/5335909339_d307a7cbcf_b.jpg')
75
+ 'file' => create_file('pie.jpg', 'https://c2.staticflickr.com/6/5245/5335909339_d307a7cbcf_b.jpg')
76
76
  },
77
77
  {
78
78
  'id' => 'flower',
79
79
  'title' => 'The Flower',
80
- 'file' => create_image('flower', 'http://c2.staticflickr.com/4/3922/15045568809_b24591e318_b.jpg')
80
+ 'file' => create_file('flower.jpg', 'http://c2.staticflickr.com/4/3922/15045568809_b24591e318_b.jpg')
81
81
  }
82
82
  ]
83
83
  end
@@ -10,14 +10,14 @@ module Contentful
10
10
  ENTRIES_KEY = 'entries'
11
11
  ASSETS_KEY = 'assets'
12
12
  BOOTSTRAP_PROCCESSED_KEY = 'bootstrapProcessed'
13
- DISPLAY_FIELD_KEY = 'display_field'
14
- ALTERNATE_DISPLAY_FIELD_KEY = 'displayField'
13
+ DISPLAY_FIELD_KEY = 'displayField'
14
+ ALTERNATE_DISPLAY_FIELD_KEY = 'display_field'
15
15
  SYS_KEY = 'sys'
16
16
 
17
17
  attr_reader :assets, :entries, :content_types
18
18
 
19
- def initialize(space, file, mark_processed = false, all = true)
20
- @space = space
19
+ def initialize(space, file, mark_processed = false, all = true, skip_content_types = false)
20
+ super(space, skip_content_types)
21
21
  @file = file
22
22
  @all = all
23
23
  @mark_processed = mark_processed
@@ -98,9 +98,10 @@ module Contentful
98
98
  end
99
99
 
100
100
  unprocessed_assets.map do |asset|
101
- asset['file'] = create_image(
101
+ asset['file'] = create_file(
102
102
  asset['file']['filename'],
103
- asset['file']['url']
103
+ asset['file']['url'],
104
+ { contentType: asset['file'].fetch('contentType', 'image/jpeg') }
104
105
  )
105
106
  asset
106
107
  end