Class: Commercelayer::CLI::Bootstrappers::Contentful

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/commercelayer/cli/bootstrappers/contentful.rb

Instance Method Summary collapse

Methods included from Helpers

#commercelayer_client, #config_data, #config_data_template, #config_path

Constructor Details

#initialize(options = {}) ⇒ Contentful

Returns a new instance of Contentful.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/commercelayer/cli/bootstrappers/contentful.rb', line 8

def initialize(options={})
  puts "Clearing entries..."
  master.entries.all.each do |entry|
    entry.unpublish if entry.published?
    entry.destroy
  end
  puts "Clearing content types..."
  master.content_types.all.each do |content_type|
    content_type.unpublish if content_type.published?
    content_type.destroy
  end
  puts "Clearing assets..."
  master.assets.all.each do |asset|
    asset.unpublish if asset.published?
    asset.destroy
  end
end

Instance Method Details

#bootstrap!Object



26
27
28
29
30
31
32
# File 'lib/commercelayer/cli/bootstrappers/contentful.rb', line 26

def bootstrap!
  create_variant_model!
  create_product_model!
  create_variant_model_fields!
  create_product_model_fields!
  create_records!
end