Class: Commercelayer::CLI::Bootstrappers::DatoCMS

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

Instance Method Summary collapse

Methods included from Helpers

#commercelayer_client, #config_data, #config_data_template, #config_path

Constructor Details

#initialize(options = {}) ⇒ DatoCMS



8
9
10
11
12
13
14
15
16
17
# File 'lib/commercelayer/cli/bootstrappers/datocms.rb', line 8

def initialize(options={})
  puts "Clearing item types..."
  client.item_types.all.each do |item_type|
    client.item_types.destroy(item_type[:id])
  end
  puts "Clearing uploads..."
  client.uploads.all.each do |upload|
    client.uploads.destroy(upload[:id])
  end
end

Instance Method Details

#bootstrap!Object



19
20
21
22
23
24
25
# File 'lib/commercelayer/cli/bootstrappers/datocms.rb', line 19

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